12 Replies - 1312 Views - Last Post: 11 July 2012 - 09:28 PM Rate Topic: -----

#1 weazl  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 12
  • Joined: 18-June 12

I'm Having Problems with my Anti-Virus

Posted 25 June 2012 - 01:43 PM

I'm trying to make an antivirus in python however I'm encountering problems when running the program.
This is what's supposed to happen:
I made a text file called "Test" in my desktop and when the program runs the file is supposed to be deleted.
Here is the code:
#Basic antivirus
import os

MD5_hashes = "virus viruses 101010".split()

def main():
    FILE = open(test.txt, "r")
    if MD5_hashes in FILE:
        os.remove

main()


Now the text file contains All the MD5 Hashes but I keep getting this error:
File "C:/Users/EHZIAL/Desktop/AV.py", line 7, in main
FILE = open(test.txt, "r")
NameError: global name 'test' is not defined

PLEASE help!

Is This A Good Question/Topic? 0
  • +

Replies To: I'm Having Problems with my Anti-Virus

#2 McSick  Icon User is offline

  • D.I.C Head

Reputation: 32
  • View blog
  • Posts: 179
  • Joined: 02-September 10

Re: I'm Having Problems with my Anti-Virus

Posted 25 June 2012 - 01:56 PM

On line 7

FILE = open(test.txt, "r")


test.txt -> this needs to be a string. Right now python thinks its an object variable.

It just needs to be in quotes :D

FILE = open("test.txt", "r")


This is at least why you are receiving that error.
Was This Post Helpful? 0
  • +
  • -

#3 weazl  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 12
  • Joined: 18-June 12

Re: I'm Having Problems with my Anti-Virus

Posted 25 June 2012 - 02:33 PM

Thanks BUT, the text file isn't deleted why?
Was This Post Helpful? 0
  • +
  • -

#4 weazl  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 12
  • Joined: 18-June 12

Re: I'm Having Problems with my Anti-Virus

Posted 25 June 2012 - 02:43 PM

OK I figured out why the file isn't deleting it's because I didn't tell python to delete that file http://cdn.dreaminco...lt/rolleyes.gif . But I still get this error
"os.remove("test.txt")
WindowsError: [Error 32] The process cannot access the file because it is being used by another process: 'test.txt'", Why?
Was This Post Helpful? 0
  • +
  • -

#5 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 8371
  • View blog
  • Posts: 31,101
  • Joined: 12-June 08

Re: I'm Having Problems with my Anti-Virus

Posted 25 June 2012 - 02:45 PM

Do you have the file open?
Was This Post Helpful? 0
  • +
  • -

#6 weazl  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 12
  • Joined: 18-June 12

Re: I'm Having Problems with my Anti-Virus

Posted 25 June 2012 - 03:06 PM

Dont't worry I just had to close the file doing "FILE.close()"
Thanks!
Was This Post Helpful? 0
  • +
  • -

#7 weazl  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 12
  • Joined: 18-June 12

Re: I'm Having Problems with my Anti-Virus

Posted 25 June 2012 - 03:43 PM

Help AGAIN. Now that the antivirus is working properly I need 4 things
1. REAL virus signatures
2. The ability to scan when the program window isn't open
3. The ability scan the whole computer or maybe just the Desktop
and
4. A team of at least 5

But I need to know how to Scan the WHOLE desktop. Please tell me how to at least do that
Was This Post Helpful? 0
  • +
  • -

#8 Simown  Icon User is offline

  • Blue Sprat
  • member icon

Reputation: 317
  • View blog
  • Posts: 650
  • Joined: 20-May 10

Re: I'm Having Problems with my Anti-Virus

Posted 25 June 2012 - 04:03 PM

1) Have you tried searching for them?

2) Do you mean on the taskbar, when it's minimised, when the program isn't running? That would be quite a feat.

3) I'd have a look at the os module (and os.path) for this, for manipulating directories.

4) At least 5 people? For what? Do you have anything to back this need for people more than an 11 line program so far?

This post has been edited by Simown: 25 June 2012 - 04:06 PM

Was This Post Helpful? 0
  • +
  • -

#9 weazl  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 12
  • Joined: 18-June 12

Re: I'm Having Problems with my Anti-Virus

Posted 25 June 2012 - 04:19 PM

1. Yes but, I want the newest ones. I found some but I don't know how old they are.

2. Like you know how AVG isn't open, but it is in the taskbar and able to detect viruses still, like that.

3. I searched but I coudn't find what i was looking for.

4. Doing all of that would take up ALOT of time hence the need for at LEAST 5 people
Was This Post Helpful? 0
  • +
  • -

#10 weazl  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 12
  • Joined: 18-June 12

Re: I'm Having Problems with my Anti-Virus

Posted 25 June 2012 - 04:40 PM

Sorry to be annoying but I ask for help AGAIN (and I may keep asking for a while) but when I try to scan the whole desktop I get this error:
IOError: [Errno 13] Permission denied:
Why?
Was This Post Helpful? 0
  • +
  • -

#11 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 5951
  • View blog
  • Posts: 23,214
  • Joined: 23-August 08

Re: I'm Having Problems with my Anti-Virus

Posted 26 June 2012 - 03:58 AM

You are NOT NEARLY ready to undertake this project. Try learning Python first, with something a little less "ambitious".
Was This Post Helpful? 3
  • +
  • -

#12 weazl  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 12
  • Joined: 18-June 12

Re: I'm Having Problems with my Anti-Virus

Posted 26 June 2012 - 11:33 AM

OK.
Was This Post Helpful? 0
  • +
  • -

#13 k3y  Icon User is offline

  • D.I.C Head

Reputation: 36
  • View blog
  • Posts: 205
  • Joined: 25-February 12

Re: I'm Having Problems with my Anti-Virus

Posted 11 July 2012 - 09:28 PM

View Postweazl, on 25 June 2012 - 05:43 PM, said:

Help AGAIN. Now that the antivirus is working properly I need 4 things
1. REAL virus signatures
2. The ability to scan when the program window isn't open
3. The ability scan the whole computer or maybe just the Desktop
and
4. A team of at least 5

But I need to know how to Scan the WHOLE desktop. Please tell me how to at least do that


Are you trying to create a fully functional anti-virus in python (it's possible.. it think). If so hats off to you and all but... well... just good luck
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1