Python Forum
Need Help with an Antivirus script in py3 - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Need Help with an Antivirus script in py3 (/thread-3045.html)



Need Help with an Antivirus script in py3 - RandoomDude - Apr-26-2017

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





RE: Need Help with an Antivirus script in py3 - sparkz_alot - Apr-26-2017

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).


help,Av Script not running(Renewed by the opinion from some user) - RandoomDude - Apr-26-2017

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


RE: help,Av Script not running(Renewed by the opinion from some user) - wavic - Apr-26-2017

Post the full error traceback please


RE: Need Help with an Antivirus script in py3 - nilamo - Apr-26-2017

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.


RE: Need Help with an Antivirus script in py3 - nilamo - Apr-26-2017

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.


RE: Need Help with an Antivirus script in py3 - RandoomDude - Apr-27-2017

(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?


RE: Need Help with an Antivirus script in py3 - Mekire - Apr-27-2017

(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?


RE: Need Help with an Antivirus script in py3 - RandoomDude - Apr-27-2017

(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?


RE: Need Help with an Antivirus script in py3 - Mekire - Apr-27-2017

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.