Created fileUtil
This commit is contained in:
@@ -1,27 +1,26 @@
|
|||||||
require 'FileUtils'
|
require_relative 'filesUtil'
|
||||||
require_relative 'searchUtil'
|
|
||||||
|
|
||||||
|
|
||||||
class Cryptowallfinder
|
class Cryptowallfinder
|
||||||
|
|
||||||
attr_accessor :outputFile, :path
|
attr_accessor :outputFile, :path
|
||||||
|
|
||||||
@search = Searchutil.new
|
def initialize
|
||||||
|
@filesUtil = Filesutil.new
|
||||||
|
end
|
||||||
|
|
||||||
def infectedFiles(decryptFile)
|
def infectedFiles(decryptFile)
|
||||||
infectedPath = File.dirname("#{decryptFile}")
|
infectedPath = @filesUtil.getDirectoryNameByFile(decryptFile)
|
||||||
infectedFiles = Dir["#{infectedPath}/*.*"]
|
infectedFiles = @filesUtil.getAllFilesByPath(infectedPath)
|
||||||
return infectedFiles
|
return infectedFiles
|
||||||
end
|
end
|
||||||
|
|
||||||
def infectedFileExpandedPath(file)
|
def infectedFileExpandedPath(file)
|
||||||
infectedFileExpandedPath = File.expand_path(file.to_s)
|
return @filesUtil.getExpandedPathByFileName(file)
|
||||||
return infectedFileExpandedPath
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def decryptFiles(path)
|
def decryptFiles(path)
|
||||||
decryptFiles = Dir["#{path}/**/DECRYPT_INSTRUCTION.TXT"]
|
return @filesUtil.findFilesByFileName(path,'DECRYPT_INSTRUCTION.txt')
|
||||||
return decryptFiles
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def writeMyFile(whatToWrite)
|
def writeMyFile(whatToWrite)
|
||||||
@@ -36,7 +35,7 @@ class Cryptowallfinder
|
|||||||
|
|
||||||
def deleteInstructions(file)
|
def deleteInstructions(file)
|
||||||
if isTorInstructions(file) or isDecryptInstructions(file)
|
if isTorInstructions(file) or isDecryptInstructions(file)
|
||||||
FileUtils.rm(File.expand_path(file.to_s))
|
@filesUtil.removeFile(file)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
25
source/filesUtil.rb
Normal file
25
source/filesUtil.rb
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
require 'FileUtils'
|
||||||
|
|
||||||
|
class Filesutil
|
||||||
|
def findFilesByFileName(path,filename)
|
||||||
|
files = Dir["#{path}/**/#{filename}"]
|
||||||
|
return files
|
||||||
|
end
|
||||||
|
|
||||||
|
def getExpandedPathByFileName(file)
|
||||||
|
return File.expand_path(file.to_s)
|
||||||
|
end
|
||||||
|
|
||||||
|
def removeFile(file)
|
||||||
|
FileUtils.rm(getExpandedPathByFileName(file))
|
||||||
|
end
|
||||||
|
|
||||||
|
def getDirectoryNameByFile(file)
|
||||||
|
return File.dirname("#{file}")
|
||||||
|
end
|
||||||
|
|
||||||
|
def getAllFilesByPath(path)
|
||||||
|
return Dir["#{path}/*.*"]
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
require 'FileUtils'
|
|
||||||
|
|
||||||
class Searchutil
|
|
||||||
|
|
||||||
end
|
|
||||||
Reference in New Issue
Block a user