Python Forum
Need Help with an Antivirus script in py3
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need Help with an Antivirus script in py3
#5
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> def scan(pathname, signatures, depth):
...     for item in os.listdir(pathname) and depth > 0:
...         n = os.path.join(pathname, item)
...         try:
...             scan(n, signatures, depth-1)
...         except:
...             f = open(n, 'r')
...             s = f.read()
...             for virus in signatures:
...                 if s.find(signatures[virus]) > 0:
...                     print('{}, found virus {}'.format(n,virus))
...             f.close()
...
>>>
Works fine for me. Please show the whole error, and probably more of your actual script. Otherwise, we're just taking wild guesses.
Reply


Messages In This Thread
RE: Need Help with an Antivirus script in py3 - by nilamo - Apr-26-2017, 03:54 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020