Open the program and get 2 options:
1; Backup
Spoiler
When you press backup, the program will create a new temporary file. It will then scan your PC.If it detects a folder then it will write this code into the new file:
fs.makeDir(*foldername*)
If it detects a file, it will first upload that file to pastebin. After that, it will take the pastebin ID of that file and do this:
shell.run("pastebin", "get", "*file id*", "*file name*")
At the very end, it uploads the temporary file with all the files inside of it to pastebin. The ID of that file is your backup ID.
Spoiler
After the long process of backing up your PC, it should give you a backup ID. That ID is actually using pastebin. When you enter that code, the program gets the file ID from pastebin and executes it. The reason it can be executed is because the backup stores all the files in lua. So after it being ran, it creates all the files/folders and deletes the file that has the program's data.THIS REQUIRES THE HTTP API TO BE ENABLED!
Download
local selection = 2
--<Test ID: nnzXLrVj>--
shell.run("clear")
print("SystemBackup v1.0")
print("n1; Backupn2; Restoren3; Exit")
while true do
local e, k = os.pullEvent( "key" )
if k == 2 or k == 3 then
selection = k
break
elseif k == 4 then
os.reboot()
end
end
if selection == 2 then
backup = fs.open(".backupsaving123", "w")
files = fs.list("/")
for i = 1,#files do
if not fs.isReadOnly(files[i]) then
if fs.isDir(files[i]) then
backup.writeLine('fs.makeDir("' ..files[i].. '")')
else
-- Read in the file
local sName = fs.getName( files[i] )
if sName == ".backupsaving123" then else
local file = fs.open( files[i], "r" )
local sText = file.readAll()
file.close()
-- POST the contents to pastebin
write( "Backing up " ..sName.. "..." )
local key = "0ec2eb25b6166c0c27a394ae118ad829"
local response = http.post(
"http://pastebin.com/api/api_post.php",
"api_option=paste&"..
"api_dev_key="..key.."&"..
"api_paste_format=lua&"..
"api_paste_name="..textutils.urlEncode(sName).."&"..
"api_paste_code="..textutils.urlEncode(sText)
)
if response then
local sResponse = response.readAll()
response.close()
local sCode = string.match( sResponse, "[^/]+$" )
backup.writeLine( 'shell.run("pastebin", "get", "'..sCode..'", "'..files[i]..'")')
end
end
end
end
end
backup.close()
-- Read in the file
local sName = fs.getName( ".backupsaving123" )
local file = fs.open( ".backupsaving123" , "r" )
local sText = file.readAll()
file.close()
-- POST the contents to pastebin
write( "Connecting to pastebin.com... " )
local key = "0ec2eb25b6166c0c27a394ae118ad829"
local response = http.post(
"http://pastebin.com/api/api_post.php",
"api_option=paste&"..
"api_dev_key="..key.."&"..
"api_paste_format=lua&"..
"api_paste_name="..textutils.urlEncode(sName).."&"..
"api_paste_code="..textutils.urlEncode(sText)
)
if response then
local sResponse = response.readAll()
response.close()
local sCode = string.match( sResponse, "[^/]+$" )
print("Backup Complete! Backup ID: " ..sCode)
else
print("Failed.")
end
fs.delete(".backupsaving123")
else
write("nBackup ID: ")
id = read()
shell.run("pastebin", "get", id, "backupretreiver")
shell.run("backupretreiver")
fs.delete("backupretreiver")
print("Complete!")
end
tl;dr
The program uploads all your files to pastebin. Then creates a pastebin that links to all your files on pastebin.