Question: Next, write another script named Q 1 B . py , that receives as a parameter ( on the command line ) the name of
Next, write another script named QBpy that receives as a parameter on the command line
the name of a py file in the current directory, eg xpy
QBpy should check two things:
Is the given Python file a script ie is it intended to be run directly
a For our purposes, a Python file is considered a script if it contains an
if namemain: statement
Is it uninfected ie does it not yet contain the virus code
If both checks are true, then the QB script should rewrite the input script eg xpy so that
the new xpy will contain a Python script with the same functionality as of the original xpy
except that the new script will also perform the following simple spyware payload functionality:
Whenever the new xpy script is run, it appends, to the end of a file called QBout, a line
containing the entire command line used to invoke it ie the filescript name xpy followed
by the arguments parameters with which the script xpy was run, if any. If QBout does not
exist when the new xpy is run, then xpy should create QBout.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
