Advertisement
LazerAio

CCH

Apr 9th, 2022
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. args = {...}
  2. if not fs.exists("skynet") then
  3. shell.run("APM install SkyNet")
  4. error("Missing skynet")
  5. end
  6. print(args[2])
  7. sky = require "skynet"
  8. function encrypt(MSG,Key,SecondKey)
  9. Letters = {}
  10. for i=1,string.len(MSG) do
  11. Letters[i] = string.sub(MSG,i,i)
  12. end
  13. Out = {}
  14. for i=1,#Letters do
  15. Out[i] = (string.byte(Letters[i]))*(Key/SecondKey)
  16. end
  17. end
  18. FinRX = {}
  19. function decrypt(CODE,Key,SecondKey)
  20. Out = string.char((CODE)/(Key/SecondKey))
  21. if FinRX[#FinRX] == "*" and Out == "*" then
  22. FinFinRX = ""
  23. for y=1,#FinRX-1 do
  24. FinFinRX = FinFinRX .. FinRX[y]
  25. end
  26. print("RECEIVED > "..FinFinRX,os.date())
  27. if string.upper(string.sub(FinFinRX,1,8)) == "PASTEBIN" then
  28. print("FORBBIDEN!")
  29. elseif string.upper(string.sub(FinFinRX,1,4)) == "WGET" then
  30. print("FORBBIDEN!")
  31. elseif string.upper(string.sub(FinFinRX,1,2)) == "FG" then
  32. print("FORBBIDEN!")
  33. elseif string.upper(string.sub(FinFinRX,1,2)) == "BG" then
  34. print("FORBBIDEN!")
  35. elseif string.upper(string.sub(FinFinRX,1,10)) == "BACKGROUND" then
  36. print("FORBBIDEN!")
  37. elseif string.upper(string.sub(FinFinRX,1,10)) == "FOREGROUND" then
  38. print("FORBBIDEN!")
  39. elseif string.upper(string.sub(FinFinRX,1,5)) == "ALIAS" then
  40. print("FORBBIDEN!")
  41. elseif string.upper(string.sub(FinFinRX,1,4)) == "CBOR" then
  42. print("FORBBIDEN!")
  43. elseif string.upper(string.sub(FinFinRX,1,5)) == "SHELL" then
  44. print("FORBBIDEN!")
  45. else
  46. print("OK!")
  47. end
  48. FinRX = {}
  49. elseif Out == ":" then
  50. FinRX[#FinRX+1] = " "
  51. else
  52. FinRX[#FinRX+1] = Out
  53. end
  54. end
  55. function send(CH,Out)
  56. for k=1,#Out do
  57. sky.send(CH,Out[k])
  58. end
  59. end
  60. function receive(CH)
  61. while true do
  62. RXCH,RXMSG = sky.receive(CH)
  63. decrypt(RXMSG,tonumber(args[3]),tonumber(args[4]))
  64. end
  65. end
  66. if #args < 5 then
  67. print("CCH <S/R> <MSG/'n'> <KEY> <KEY2> <CH>")
  68. else
  69. if args[1] == "S" then
  70. encrypt(args[2],tonumber(args[3]),tonumber(args[4]))
  71. send(args[5],Out)
  72. elseif args[1] == "R" then
  73. receive(args[5])
  74. else
  75. print("EXCPECTED R OR S")
  76. print("ERROR: CCH "..args[1],"<-- HERE")
  77. end
  78. end
  79.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement