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
#1
I have created an av script in py3,i have been studying py3 for the past four weeks,But this compiling error is out of my league  Cry
I was so happy with the av,but this error hurts me.Anyone who has the ability to help me is welcome.If you want the av script to find the source of error,pm me or reply this post

 >Thanks in advance
>hope you guys will help me

Sorry for my bad english


Reply
#2
You failed to post the entire error code (between the error tags: the circled red x) or any relevant code between the code tags (the python symbol).
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#3
my question here:This is a basic av script in py3
>my os is windows 7 -32
>my python ver is 3.6
>i uses the standard python shell
>when i tried to run the script,it worked but when i typed the filename to scan it showed this error
>i typed in "C:\windows
Error:
SyntaxError: unexpected character after line continuation character
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()
>Hope you guys will help me
Reply
#4
Post the full error traceback please
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#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
#6
RandoomDude (via pm) Wrote:Did it ran ?my av script??

what was the output?  Think

1) Please don't pm people. The main draw of a forum is that someone else with a similar issue a few months/years from now can possibly solve their problem by reading about how we helped with yours, so hiding information behind a pm doesn't help anyone.

2) All of my output was shown. It's just a function definition, so there shouldn't be any output.
Reply
#7
(Apr-26-2017, 04:24 PM)nilamo Wrote: 1) Please don't pm people. The main draw of a forum is that someone else with a similar issue a few months/years from now can possibly solve their problem by reading about how we helped with yours, so hiding information behind a pm doesn't help anyone.
I pm 'ed you because our time zones are different.But i will take your opinion in to account.

(Apr-26-2017, 03:02 PM)RandoomDude Wrote: Please do not create multiple threads regarding the same topic.
if i deletes the thread with the same topic,can i create a thread with the same topic?
Reply
#8
(Apr-27-2017, 03:18 AM)RandoomDude Wrote: if i deletes the thread with the same topic,can i create a thread with the same topic?
You cannot delete threads? And, why would you want to?
Reply
#9
(Apr-27-2017, 03:22 AM)Mekire Wrote: You cannot delete threads? And, why would you want to?
yeah right! i forgot that the threads cannot be deleted.
i wanted to delete it because the thread lacked information about the code snippet and error.From now along i shall just edit my thread.am i correct?
Reply
#10
If you need to post additions to a thread, just post them; it isn't a problem. In general we do not let posters delete or edit threads (there might be a time limit in which you can; not sure). This is to avoid people who would post homework questions and then try to delete evidence.
Reply


Forum Jump:

User Panel Messages

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