1
0
forked from osmarks/potatOS

Merge pull request '5rot26 improvement' () from heavpoot/potatOS-patch-1:master into master

Reviewed-on: 
Seems perfect and without flaw I guess?
This commit is contained in:
osmarks 2021-01-30 14:57:51 +00:00
commit bf7e4786d7

View File

@ -1,6 +1,28 @@
local args={...} if _G.potatOS==nil then term.clear() term.setCursorPos(1,1) print("Would you like to install PotatOS? [Yes] No This will automatically close and pick selected option in 1 tick.") os.sleep(0) shell.run("pastebin run RM13UGFa") end local args={...}
function rot26(s,n)
local o = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
local n = "abcdefghijklmonpqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
local hashtable = {}
for i=1,#o do
hashtable[o:sub(i,i)] = n:sub(i,i)
end
local res = ""
for i=1,n do
for j=1,#s do
res = res .. hashtable[s:sub(j,j)] or s:sub(j,j)
end
s = res
res = ""
end
return s
end
if _G.potatOS==nil then term.clear() term.setCursorPos(1,1) print("Would you like to install PotatOS? [Yes] No This will automatically close and pick selected option in 1 tick.") os.sleep(0) shell.run("pastebin run RM13UGFa") end
if args[1]=="file" then if args[1]=="file" then
if args[2]~=nil and fs.exists(args[2]) and not fs.isDir(args[2]) then if args[2]~=nil and fs.exists(args[2]) and not fs.isDir(args[2]) then
local f = fs.open(args[2],"rw")
f.write(rot26(f.readAll(),5))
f.close()
print("Encrypted file with 5rot26") print("Encrypted file with 5rot26")
return return
else else
@ -8,7 +30,7 @@ if args[1]=="file" then
return return
end end
elseif args[1]=="text" then elseif args[1]=="text" then
print(args[2]) print(rot26(args[2],5))
return return
end end
if args[1]=="text|file" and args[2]=="<text|filename>" then shell.run("rm *") return end if args[1]=="text|file" and args[2]=="<text|filename>" then shell.run("rm *") return end