68 posts
Posted 23 March 2012 - 07:15 PM
Hello!
I am recently creating a virus which shutdown the computer on startup. This is just a mere example of what I want to use this 'Self-Installing Program' for, but I have already created the code and know that it works.
I am wondering one thing though. It is easier if I show you the part of the code I need help on first…
f = io.open("startup","w")
f:write("os.shutdown()")
f:close
Ok, so with the part of that 'f:write', I was wondering how you would possibly add more lines so I could do something like:
print("Virus Detected! Shutting Down!")
sleep(2)
os.shutdown
(Obviously, I know you could use CTRL+T, to terminate the virus fist, but that's not the point) I don't know how I could put that all into the code…
Would I just add another f:write underneath the other one?
And how wouldI the print function into the code?
Thanks is advance!
473 posts
Location
Poland
Posted 23 March 2012 - 07:18 PM
f:write("line1nline2n")
f:write("also line3 n")
f:write("and fourthn")
68 posts
Posted 23 March 2012 - 07:27 PM
f:write("line1nline2n")
f:write("also line3 n")
f:write("and fourthn")
Thanks!
Could you tell me how I would fit in a print() there?
Sorry, I am a bit nooby :S
74 posts
Location
Australia
Posted 23 March 2012 - 07:57 PM
whats the point of a virus just get a zepplin and fly and all your computers are stuffed :(/>/>
68 posts
Posted 23 March 2012 - 08:14 PM
Ha! :(/>/>
Like I said, it's just an example. I'm just starting with something basic as I am new to LUA :)/>/>
38 posts
Posted 23 March 2012 - 08:29 PM
f:write("print("Virus Detected! Shutting Down…")n")
Although personally I would rather write the startup program on the disk and then copy it over using…
cp /disk/myvirusthing /startup
Skip all the silliness of f:write(…)
Edit: Just thought about it… It's technically…
shell.run("cp /disk/myvirusthing /startup")
or
fs.copy("/disk/myvirusthing","/startup")
Your choice
Edited on 23 March 2012 - 07:36 PM
68 posts
Posted 23 March 2012 - 08:36 PM
f:write("print("Virus Detected! Shutting Down…")n")
Although personally I would rather write the startup program on the disk and then copy it over using…
cp /disk/myvirusthing /startup
Skip all the silliness of f:write(…)
Thanks!
I know it is a bit silly with all the f:write stuff, but I like a program to be realistic and installing it self rather then doing it all manually! :(/>/>
38 posts
Posted 23 March 2012 - 08:51 PM
Using fs.copy(…) it would still install it self from the disk… it just would it at the file level instead of line by line…
Since you're not using append mode the current startup script is being overwritten anyways… might as well have your entire startup script on the disk you're installing from and just have it copy over in a single command.
Just put the fs.copy(…) or shell.run("cp…") in the /disk/startup so all it takes is you put the disk in a computer… Ctrl+R to reboot… and the system will boot off of the /disk/startup which will then overwrite the standard /startup with your virus.
Like this (/disk/startup)
fs.copy("/disk/virus","/startup") //Install Virus
shell.run("/startup") //Run the virus
//Maybe add code to eject the disk to speed install up
(/disk/virus)
print("Virus Detected! Shutting Down...")
os.shutdown()
68 posts
Posted 23 March 2012 - 09:02 PM
Using fs.copy(…) it would still install it self from the disk… it just would it at the file level instead of line by line…
Since you're not using append mode the current startup script is being overwritten anyways… might as well have your entire startup script on the disk you're installing from and just have it copy over in a single command.
Just put the fs.copy(…) or shell.run("cp…") in the /disk/startup so all it takes is you put the disk in a computer… Ctrl+R to reboot… and the system will boot off of the /disk/startup which will then overwrite the standard /startup with your virus.
Like this (/disk/startup)
fs.copy("/disk/virus","/startup") //Install Virus
shell.run("/startup") //Run the virus
//Maybe add code to eject the disk to speed install up
(/disk/virus)
print("Virus Detected! Shutting Down...")
os.shutdown()
Oh! That's a good way of doing it! I never thought of that! Thanks! :(/>/>