Jun 30, 2018 05:55 PM
(This post was last modified: Jun 30, 2018 06:19 PM by 100PercentNotAMobster.)
This is the code that wont work. I am trying to get a copy of the virus:
import sys
input("start")
File = sys.argv[0]
WriteThing = "Setting file to mean opening file in read only mode" + File
input(WriteThing)
File = open(File, mode="r")
input("Now Reading file")
File = File.read()
input(File)
This works when I run it as a .py but not as a .exe
The error is: Unicode Decode Error
Pls halp it's so annoying...
Jun 30, 2018 06:25 PM
(This post was last modified: Jun 30, 2018 06:27 PM by scrubjay.)
It's strange that the python script works but not compiled.
Do you defined an encoding?
It would be pretty nice if we could see the full code and you could tell us what exactly you want to do.
Jun 30, 2018 07:09 PM
(This post was last modified: Jun 30, 2018 07:20 PM by 100PercentNotAMobster.)
This is the full code: import os
UserThing = os.getcwd().split('C:\\Users')[1].split('\\')[1]
print(UserThing)
print("C:\\Users\\" + UserThing + "\\Desktop")
NameThing = os.path.basename(__file__).replace('.py', '.exe')
if os.getcwd() != "C:\\Users\\" + UserThing + "\\Desktop":
input("In the if statement")
with open("VirusCopyer.bat", mode = "w", encoding='utf-8') as Fileh:
WriteThing = '''XCOPY "''' + os.getcwd().replace('\\', '\\\\') + "\\" + NameThing + '''" "C:\\Users\\''' + UserThing + '''\\Desktop"'''
Fileh.write(WriteThing)
input("In the with statement")
os.system("cd Desktop")
input("About to start virus copyer batch file")
os.system("start VirusCopyer.bat")
input("About to kill cmd")
os.system("taskkill /F /im cmd.exe")
input("About to rename the file in desktop.")
WriteThing = "C:\\Users\\" + UserThing + "\\Desktop\\AppenderVirus.exe"
os.rename(WriteThing, "C:\\Users\\" + UserThing + "\\Desktop\\ThisIsTheVirusYouShouldDeleteIt.exe")
input("About to start previously renamed file.")
os.chdir("C:\\Users\\" + UserThing + "\\Desktop")
os.system("start ThisIsTheVirusYouShouldDeleteIt.exe")
input("Well its done")
quit()
else:
import sys
input("start")
File = sys.argv[0]
WriteThing = "Setting file to mean opening file in read only mode" + File
input(WriteThing)
File = open(File, mode="r", encoding = "utf-8")
input("Now Reading file")
File = File.read()
input(File)
What I want to do is add the file to desktop so it can be deleted, then I want to add code to chrome or edge or whatever search engine is found, the code that is added should bring up a tkinter window that says gatcha or something.
It says something about invalid start byte in the error.
I don't really understand what you want to do.
You want to copy a file to another location and then delete it? Why you don't just delete it from this location? Why do you have to copy it?
Jul 2, 2018 01:51 AM
(This post was last modified: Jul 2, 2018 01:51 AM by hunter24957.)
Forgive me, I've not worked with a "compiled" Python program before.
However, when an executable is launched by Windows, it's arguments are passed to it like so: "program.exe arg1 arg2 arg3 ... argN", where "program.exe" is the path to the executable and arg1-argN are the program's optional arguments.
Now, I can see that in your piece of broken code you are getting the zeroth argument, which in our case is the executable path, "program.exe".
So essentially what's happening is you're reading your own executable, which is not a text file, hence the unicode decode error.
You need to be getting the actual program argument, arg1, which would be sys.argv[1], since it comes after the executable path. 🤝
do yourself a favor and lay off "virus programming"
as far as i can see you are a complete beginner, and programming a virus requires at least some level of expertise
Jul 2, 2018 03:57 PM
(This post was last modified: Jul 2, 2018 04:03 PM by 100PercentNotAMobster.)
I'm putting it in desktop so a person can delete it (maybe I'll put it somewhere else less obvious idk yet) so a person thinks they've deleted it, but the virus is actually in chrome. This might be totally stupid (probably is I just felt like trying something) because like vegardagain said I'm a total beginner. I just felt like trying this lol.
I actually realize how many things I did that don't make any sense tho...
Jul 3, 2018 11:11 AM
(This post was last modified: Jul 3, 2018 11:13 AM by scrubjay.)
(Jun 30, 2018 07:09 PM)100PercentNotAMobster Wrote: This is the full code: import os
UserThing = os.getcwd().split('C:\\Users')[1].split('\\')[1]
print(UserThing)
print("C:\\Users\\" + UserThing + "\\Desktop")
NameThing = os.path.basename(__file__).replace('.py', '.exe')
if os.getcwd() != "C:\\Users\\" + UserThing + "\\Desktop":
input("In the if statement")
with open("VirusCopyer.bat", mode = "w", encoding='utf-8') as Fileh:
WriteThing = '''XCOPY "''' + os.getcwd().replace('\\', '\\\\') + "\\" + NameThing + '''" "C:\\Users\\''' + UserThing + '''\\Desktop"'''
Fileh.write(WriteThing)
input("In the with statement")
os.system("cd Desktop")
input("About to start virus copyer batch file")
os.system("start VirusCopyer.bat")
input("About to kill cmd")
os.system("taskkill /F /im cmd.exe")
input("About to rename the file in desktop.")
WriteThing = "C:\\Users\\" + UserThing + "\\Desktop\\AppenderVirus.exe"
os.rename(WriteThing, "C:\\Users\\" + UserThing + "\\Desktop\\ThisIsTheVirusYouShouldDeleteIt.exe")
input("About to start previously renamed file.")
os.chdir("C:\\Users\\" + UserThing + "\\Desktop")
os.system("start ThisIsTheVirusYouShouldDeleteIt.exe")
input("Well its done")
quit()
else:
import sys
input("start")
File = sys.argv[0]
WriteThing = "Setting file to mean opening file in read only mode" + File
input(WriteThing)
File = open(File, mode="r", encoding = "utf-8")
input("Now Reading file")
File = File.read()
input(File)
What I want to do is add the file to desktop so it can be deleted, then I want to add code to chrome or edge or whatever search engine is found, the code that is added should bring up a tkinter window that says gatcha or something.
It says something about invalid start byte in the error.
(Jul 2, 2018 03:57 PM)100PercentNotAMobster Wrote: I'm putting it in desktop so a person can delete it (maybe I'll put it somewhere else less obvious idk yet) so a person thinks they've deleted it, but the virus is actually in chrome. This might be totally stupid (probably is I just felt like trying something) because like vegardagain said I'm a total beginner. I just felt like trying this lol.
I actually realize how many things I did that don't make any sense tho...
Well, thats just like 3 Lines of Code
Code import shutil
import os
src = 'your file LALALALLAL' (e.g. args[0])
dst = os.environ['USERHOME'] + '/Desktop/filename.exe'
shutil.copyfile(src, dst)
THANKYOU OMG YOU ARE AWESOME, I don't know what I was trying to do lol. I do have one more question though (well two actually).
So this works on my computer, but not in my vm. I assume this is because desktop is in the directory one drive and I assume this might happen on someone elses computer. And the os.environ['USERHOME'] did not work. I'm using python 36 so maybe that's the problem, or its just because I know nothing lol. So what would the solution to this be?
(Jul 3, 2018 07:35 PM)100PercentNotAMobster Wrote: THANKYOU OMG YOU ARE AWESOME, I don't know what I was trying to do lol. I do have one more question though (well two actually).
So this works on my computer, but not in my vm. I assume this is because desktop is in the directory one drive and I assume this might happen on someone elses computer. And the os.environ['USERHOME'] did not work. I'm using python 36 so maybe that's the problem, or its just because I know nothing lol. So what would the solution to this be?
https://stackoverflow.com/questions/3427...ing-python
just google it bro. It isn't that hard.
Arighty then, thanks again for the help tho.
|