Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- args = {...}
- if not fs.exists("skynet") then
- shell.run("APM install SkyNet")
- error("Missing skynet")
- end
- print(args[2])
- sky = require "skynet"
- function encrypt(MSG,Key,SecondKey)
- Letters = {}
- for i=1,string.len(MSG) do
- Letters[i] = string.sub(MSG,i,i)
- end
- Out = {}
- for i=1,#Letters do
- Out[i] = (string.byte(Letters[i]))*(Key/SecondKey)
- end
- end
- FinRX = {}
- function decrypt(CODE,Key,SecondKey)
- Out = string.char((CODE)/(Key/SecondKey))
- if FinRX[#FinRX] == "*" and Out == "*" then
- FinFinRX = ""
- for y=1,#FinRX-1 do
- FinFinRX = FinFinRX .. FinRX[y]
- end
- print("RECEIVED > "..FinFinRX,os.date())
- if string.upper(string.sub(FinFinRX,1,8)) == "PASTEBIN" then
- print("FORBBIDEN!")
- elseif string.upper(string.sub(FinFinRX,1,4)) == "WGET" then
- print("FORBBIDEN!")
- elseif string.upper(string.sub(FinFinRX,1,2)) == "FG" then
- print("FORBBIDEN!")
- elseif string.upper(string.sub(FinFinRX,1,2)) == "BG" then
- print("FORBBIDEN!")
- elseif string.upper(string.sub(FinFinRX,1,10)) == "BACKGROUND" then
- print("FORBBIDEN!")
- elseif string.upper(string.sub(FinFinRX,1,10)) == "FOREGROUND" then
- print("FORBBIDEN!")
- elseif string.upper(string.sub(FinFinRX,1,5)) == "ALIAS" then
- print("FORBBIDEN!")
- elseif string.upper(string.sub(FinFinRX,1,4)) == "CBOR" then
- print("FORBBIDEN!")
- elseif string.upper(string.sub(FinFinRX,1,5)) == "SHELL" then
- print("FORBBIDEN!")
- else
- print("OK!")
- end
- FinRX = {}
- elseif Out == ":" then
- FinRX[#FinRX+1] = " "
- else
- FinRX[#FinRX+1] = Out
- end
- end
- function send(CH,Out)
- for k=1,#Out do
- sky.send(CH,Out[k])
- end
- end
- function receive(CH)
- while true do
- RXCH,RXMSG = sky.receive(CH)
- decrypt(RXMSG,tonumber(args[3]),tonumber(args[4]))
- end
- end
- if #args < 5 then
- print("CCH <S/R> <MSG/'n'> <KEY> <KEY2> <CH>")
- else
- if args[1] == "S" then
- encrypt(args[2],tonumber(args[3]),tonumber(args[4]))
- send(args[5],Out)
- elseif args[1] == "R" then
- receive(args[5])
- else
- print("EXCPECTED R OR S")
- print("ERROR: CCH "..args[1],"<-- HERE")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement