Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from re import match
- class Detector:
- signa = dict()
- filename ="";
- def __init__(self):
- self.signa["hide"] = 0
- self.signa["echrenameotofile"] = 0
- self.signa["copy"] = 0
- self.signa["call"] = 0
- self.signa["windir"] = 0
- self.signa["rename"] = 0
- self.filename = input("Enter filename for detection: ")
- self.check()
- def check(self):
- with open(self.filename) as f:
- text = f.readlines()
- str_num = 1
- print("---------------------DETECTS------------------------------")
- for i in text:
- if match(r".*attrib .*[%]*[\w_][\w\b_]*[%]* \+h", i) != None:
- print("Hide some files line in " + str(str_num))
- self.signa["hide"] = 1
- if match(".*echo.*>>[%]*[\w_][\w\b_]*[%]*", i) != None:
- print("Write some strange data to file in line " + str(str_num))
- self.signa["echrenameotofile"] = 1
- if match(".*<%0>>[%]*[\w_][\w\b_]*[%]*", i) != None or match(
- ".*copy [%]*[\w_][\w\b_\+\.]* [%]*[\w_][\w\b_\+]*.*", i) != None:
- print("Make copy some file in line " + str(str_num))
- self.signa["copy"] = 1
- if match(".*ren [%]*[\w_][\w\b_]*[%]* \*\.bat", i) != None:
- print("Change extension in line " + str(str_num))
- self.signa["rename"] = 1
- if match("call [%]*[\w_][\w\b_\+\.]*[%]* [%]*[\w_][\w\b_\+\.]*[%]*", i) != None:
- print("Execute other bat-file in line " + str(str_num))
- self.signa["call"] = 1
- if match(r".*mkdir %windir%\\.*", i) != None:
- print("Make direcriory in System Windows directory in line " + str(str_num))
- self.signa["windir"] = 1
- str_num += 1
- print("-----------------------------------------------------------")
- self.results(list(self.signa.values()).count(1))
- def results(self,raiting):
- if (raiting==0):
- print("All right. It is not virus")
- elif (raiting==1):
- print("Detection one type of strange. It may be virus. check it.")
- elif (raiting==2):
- print("Detection two type of strange. It may be virus. check it.")
- elif (raiting==3):
- print("Detection three stranges. It may be virus. check it.")
- elif (raiting==4):
- print("WARNING Detection FOUR type of strange. It may be virus. check it.")
- elif (raiting==5):
- print("DANGER Detection FIVE type of strange. It is virus.")
- elif (raiting==6):
- print("DANGER ! ! ! IT IS VIRUS ! ! !")
- Detector()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement