Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Virus using Python
#7
(Dec-06-2016, 12:24 AM)miira Wrote: This is the whole homework. I couldn't understand a thing. I've studied Python but only the basics. This is for y security class. I don't even know what it does! So basically we have to put it in order so we can infect the file, that's the only thing that I'm getting out of it. That's why I asked for help. Can anyone explain to me what this code is supposed to do, like in details?

No, to explain it in detail would be to do your homework for you.  Besides, each 'def' has a line (double quoted in blue) which explains what it does (which you should comment out or the program won't run).  Also notice that even with all the 'def's' given, there is nothing invoking any of them. It seems your job is to invoke the functions in the proper order, perhaps using the output of one function to feed another.

One particularly troubly function is this:
def getPythonList():
   "getPythonList - Return a list of Python programs"
   progs = glob.glob("*.py")
   return progs
This basically is saying, look for any  python file in the current directory and we will infect it.  If you create this script in the same location as other scripts, you will f__k them up.  I would create a separate directory with only one sample .py file (say a "hello world" script) then create this homework assignment within that directory.
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


Messages In This Thread
Virus using Python - by miira - Nov-29-2016, 07:00 PM
RE: Virus using Python - by Yoriz - Nov-29-2016, 07:16 PM
RE: Virus using Python - by Larz60+ - Nov-29-2016, 08:46 PM
RE: Virus using Python - by Ofnuts - Nov-29-2016, 09:43 PM
RE: Virus using Python - by nilamo - Nov-29-2016, 10:36 PM
RE: Virus using Python - by miira - Dec-06-2016, 12:24 AM
RE: Virus using Python - by sparkz_alot - Dec-06-2016, 02:26 PM
RE: Virus using Python - by nilamo - Dec-06-2016, 03:34 PM

Forum Jump:

User Panel Messages

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