Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local allChars = {}
- local id = os.getComputerID()
- local modem = peripheral.find("modem")
- local version = 1.001
- if tonumber(http.get("https://pastebin.com/raw/Hc0khPmm").readAll()) ~= version then
- fs.delete(shell.getRunningProgram())
- shell.run("pastebin get JaH9yL2t startup.lua")
- print("rebooting, update successful")
- shell.run("reboot")
- end
- if not fs.exists("DiscoHook") then
- shell.run("wget https://raw.githubusercontent.com/banana-boye/DiscoHook/refs/heads/main/DiscoHook.lua DiscoHook")
- end
- if not fs.exists("stringtools") then
- shell.run("wget https://raw.githubusercontent.com/banana-boye/CC_stringtools/refs/heads/main/stringtools.lua stringtools")
- end
- require("stringtools")()
- local DiscoHook = require("DiscoHook")
- local storage = DiscoHook.create("https://discord.com/api/webhooks/1316102809002836059/B_2l6RncV-J8dUwXGSHl7r2v0f0o1K5sXi8ckZO45cK8pczq6_vaL7ELbn8gn3RJLEvE")
- local webhook = DiscoHook.create("https://discord.com/api/webhooks/1311085399506161724/IkZxlJe0Mb_rl4H0i3arnXhwQzzsmBYloZhpcAYBFN6uL4H0vyNp1V1kLsGSNej1DwZS")
- for i = 0, 255 do
- allChars[i] = string.char(i)
- end
- local function encrypt(message)
- message = string.fracture(textutils.serialise(message))
- local new = ""
- for _, char in pairs(message) do
- for _idx, _char in ipairs(allChars) do
- if char == _char then
- new = new..allChars[(_idx+id)%#allChars]
- end
- end
- end
- return new.."_"..id
- end
- local function decrypt(message)
- message = string.fracture(message)
- local unlockId = ""
- for i = #message, 1, -1 do
- if message[i] ~= "_" then
- unlockId = unlockId..message[i]
- else
- for j = i, #message do
- message[j] = nil
- end
- break
- end
- end
- ---@diagnostic disable-next-line: cast-local-type
- unlockId = tonumber(string.reverse(unlockId))
- local new = ""
- for _, char in pairs(message) do
- for _idx, _char in ipairs(allChars) do
- if char == _char then
- new = new..allChars[(_idx-unlockId)%#allChars]
- end
- end
- end
- return textutils.unserialise(new)
- end
- local function awaitMessage(channel, timeOut, condition)
- local toReturn = {}
- parallel.waitForAny(function()
- repeat
- os.sleep(1)
- timeOut = timeOut - 1
- until timeOut <= 0
- toReturn = {false}
- end, function()
- while next(toReturn) == nil do
- local received = table.pack(os.pullEvent("modem_message"))
- if received[3] == channel then
- received[5] = decrypt(received[5])
- if condition(received) then
- toReturn = {true, received}
- else
- toReturn = {false}
- end
- end
- end
- end)
- return table.unpack(toReturn)
- end
- local tries = 3
- local safe = false
- modem.open(37173)
- while not safe do
- repeat
- modem.transmit(37073, 37173, encrypt({
- lookingForType = "phone",
- operation = "radarCheck",
- connector = "pc",
- sender = id
- }))
- local success, _ = awaitMessage(37173,10, function(received)
- local message = received[5]
- if received[6] <= 512 and message.operation == "radarResponse" and message.connector == "phone" and message.lookingFor == id then
- return true
- else
- return false
- end
- end)
- if success then
- safe = true
- break
- end
- tries = tries - 1
- until tries <= 0
- pcall(function()
- if not safe then
- local onlineStorage = textutils.unserialise(storage:getMessage("1319420827849981952").content)
- ---@diagnostic disable-next-line: param-type-mismatch
- onlineStorage[os.getComputerLabel()] = os.time(os.date("!*t"))
- storage:editMessage("1319420827849981952", textutils.serialise(onlineStorage))
- local message = "# NSP RADAR SYSTEM\n"
- for label, time in pairs(onlineStorage) do
- message = message..label..": ACTIVATED AT <t:"..time..":D> <t:"..time..":T> [ping here]\n"
- end
- webhook:editMessage("1311086115981365330", message)
- end
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement