Advertisement
Guest User

stress.lua

a guest
Dec 29th, 2019
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.04 KB | None | 0 0
  1. print("Welcome to the TerraInc Network Stress-Testing Utility.")
  2. print("")
  3. print("Note: This product is paid software, you are free to make copies for your own use, as well as modify your own copies, but distribution is not allowed without express, written permission by the copyright holder.")
  4. print("")
  5. print("Supplemental Note: This product is only licensed for use against your own systems.")
  6. print("Press any key and/or press enter to continue.")
  7. read()
  8. term.clear()
  9. term.setCursorPos(1,1)
  10.  
  11. function calc()
  12.     msg = math.random(1000000000)
  13. end
  14.  
  15. function target()
  16.     term.clear()
  17.     term.setCursorPos(1,1)
  18.     print("Target Channel/ID:")
  19.     local channel = read()
  20.     local channel2 = tonumber(channel)
  21.     tonumber(channel)
  22.     sleep(1)
  23.     term.clear()
  24.     term.setCursorPos(1,1)
  25.     print("Reply Channel:")
  26.     local reply = read()
  27.     local reply2 = tonumber(reply)
  28.     tonumber(reply)
  29. end
  30.  
  31. function payload()
  32.     term.clear()
  33.     term.setCursorPos(1,1)
  34.     print("Random payload or defined payload?")
  35.     print("Press 1 for random payload")
  36.     print("Press 2 for defined payload.")
  37.     local menu2 = read()
  38.     if (menu2 == ("1"))
  39.     then
  40.         local opt = (true)
  41.         calc()
  42.     else
  43.         local opt = (false)
  44.         print("Enter payload:")
  45.         local msg = read()
  46.     end
  47. end
  48.  
  49. function fire()
  50.     modem.open(channel)
  51.     if (opt == false)
  52.     then
  53.         while true do
  54.             modem.transmit(channel, reply, msg)
  55.             coroutine.yield()
  56.         end
  57.     else
  58.         while true do
  59.             modem.transmit(channel, reply, msg)
  60.             calc()
  61.             coroutine.yield()
  62.         end
  63.     end
  64. end
  65.  
  66. function setup()
  67.     while true do
  68.         print("Setup:")
  69.         print("Press 1 to set Channel/ID.")
  70.         print("Press 2 to set payload.")
  71.         print("Press 3 to open fire.")
  72.         menu = read()
  73.     end
  74.  
  75.     if (menu == "1") then
  76.         target()
  77.     elseif (menu == "2") then
  78.         payload()
  79.     elseif (menu == "3") then
  80.         fire()
  81.     end
  82. end
  83. setup()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement