Advertisement
Guest User

startup

a guest
Aug 19th, 2014
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.08 KB | None | 0 0
  1.  
  2.         function logged()
  3.         local menu_options = { --This is our menu table. It contains basic data about the menu
  4.           [1] = {text="Check Log!", color=colors.lime},
  5.           [2] = {text="Edit Log!", color=colors.lime},
  6.           [3] = {text="Check Files!", color=colors.lime},
  7.           [4] = {text="Disconnect!", color=colors.lime}
  8.         }
  9.         local termX, termY = term.getSize() --The x/y size of the terminal
  10.         local function menuDraw(selected) --Our main draw function
  11.           local yPos = termY/2 - #menu_options/2 --The initial y position
  12.           for index, data in pairs(menu_options) do
  13.             menu_options[index].bounds = { --Create a new table in each option with the boundary data
  14.               x1 = termX/2 - (#data.text+4)/2;
  15.               x2 = termX/2 + (#data.text+4)/2;
  16.               y = yPos;
  17.             }
  18.             term.setTextColor(data.color)
  19.             term.setCursorPos(data.bounds.x1, data.bounds.y)
  20.  
  21.             local text =
  22.               index==selected and "[ "..data.text.." ]" or
  23.               "  "..data.text.."  " --Essentially an if statement, but in a contracted form
  24.             term.write(text)
  25.             yPos = yPos+1 --Increment the initial y pos so we can move on the next line
  26.         end
  27.       end
  28.  
  29.     local function checkClick(x,y) --Check the mouse click to see if there's a menu option
  30.       for index, data in pairs(menu_options) do
  31.         if x>= data.bounds.x1 and x<= data.bounds.x2 and y==data.bounds.y then
  32.           return index --Returns the index of the clicked option
  33.         end
  34.       end
  35.       return false --If it went through the entire for loop without success, return false
  36.     end
  37.  
  38.     term.setBackgroundColor(colors.white)
  39.     term.clear()
  40.  
  41.     local selector = 1 --Our selector
  42. while true do --The main loop. I would generally put this inside of a function for a program.
  43.   menuDraw(selector) --Draw the menu first
  44.   local e = {os.pullEvent()} --Pull an event and put the returned values into a table
  45.   if e[1] == "key" then --If it's a key...
  46.     if e[2] == keys.down then -- ... and it's the down arrow
  47.       selector = selector < #menu_options and selector+1 or 1 --Increment the selector if the selector < #menu_options. Otherwise reset it to 1
  48.     elseif e[2] == keys.up then
  49.       selector = selector > 1 and selector-1 or #menu_options --Decrement the selector if the selector > 1. Otherwise, reset it to #menu_options
  50.     elseif e[2] == keys.enter then
  51.       break --Break out of the loop
  52.     end
  53.   elseif e[1] == "mouse_click" then
  54.     local value = checkClick(e[3], e[4]) --Check the mouse click
  55.     if value then --If checkClick returns a value and not false
  56.       selector = value --Set the selector to that value and break out of the loop
  57.       break
  58.     end
  59.   end
  60. end
  61.  
  62. term.clear()
  63. term.setCursorPos(1,1)
  64. if selector == (1) then
  65. rednet.send(tonumber(Hack),"log")
  66. id,msg = rednet.receive()
  67. print(msg)
  68. print("Press any key to Continue!")
  69. io.read()
  70. logged()
  71. elseif selector == (2) then
  72. rednet.send(tonumber(Hack),"log")
  73. id,msg = rednet.receive()
  74. print(msg)
  75. print("Press any key to Edit!")
  76. io.read()
  77. term.clear()
  78. term.setCursorPos(1,1)
  79. print("Type done to Finish!")
  80. local file = fs.open("Elog","a")
  81. while true do
  82. input = io.read()
  83. if input == ("done") then
  84. break
  85. else
  86. file.writeLine(input)
  87. end
  88. end
  89. file.close()
  90. local file = fs.open("Elog","r")
  91. read = file.readAll()
  92. rednet.send(tonumber(Hack),"elog",tostring(read))
  93. file.close()
  94. local file = fs.open("Elog","w")
  95. file.write()
  96. file.close()
  97. logged()
  98. elseif selector == (3) then
  99. rednet.send(tonumber(Hack),"file")
  100. id,msg = rednet.receive()
  101. print(msg)
  102. print("Press any key to Continue!")
  103. io.read()
  104. logged()
  105. elseif selector == (4) then
  106. print("Disconnecting..")
  107. sleep(1)
  108. os.reboot()
  109. end
  110. end
  111. --Made by DEATHBYSH33P with bugfixing from 1lann
  112. term.setTextColor(colors.lime)
  113. term.setBackgroundColor(colors.white)
  114. term.clear()
  115. term.setCursorPos(1,1)
  116. textutils.slowPrint("WatchLinkBETA")
  117. textutils.slowPrint("Made by deathbysh33p")
  118. sleep(1)
  119. os.loadAPI("specs")
  120. Enc = specs.Enc
  121. PC = specs.PasswordCracker
  122. shell.openTab("Red")
  123. function main()
  124. local menu_options = { --This is our menu table. It contains basic data about the menu
  125.   [1] = {text="Rednet Log", color=colors.lime},
  126.   [2] = {text="Info", color=colors.lime},
  127.   [3] = {text="Hacked Ip's",color=colors.lime},
  128.   [4] = {text="Scanned Ip's",color=colors.lime},
  129.   [5] = {text="Scan for Devices",color=colors.lime},
  130.   [6] = {text="Hack an IP",color=colors.lime},
  131.   [7] = {text="Connect",color=colors.lime},
  132.   [8] = {text="Bank",color=colors.lime}
  133. }
  134. local termX, termY = term.getSize() --The x/y size of the terminal
  135. local function menuDraw(selected) --Our main draw function
  136.   local yPos = termY/2 - #menu_options/2 --The initial y position
  137.   for index, data in pairs(menu_options) do
  138.     menu_options[index].bounds = { --Create a new table in each option with the boundary data
  139.       x1 = termX/2 - (#data.text+4)/2;
  140.       x2 = termX/2 + (#data.text+4)/2;
  141.       y = yPos;
  142.     }
  143.     term.setTextColor(data.color)
  144.     term.setCursorPos(data.bounds.x1, data.bounds.y)
  145.  
  146.     local text =
  147.       index==selected and "[ "..data.text.." ]" or
  148.       "  "..data.text.."  " --Essentially an if statement, but in a contracted form
  149.     term.write(text)
  150.     yPos = yPos+1 --Increment the initial y pos so we can move on the next line
  151.   end
  152. end
  153.  
  154. local function checkClick(x,y) --Check the mouse click to see if there's a menu option
  155.   for index, data in pairs(menu_options) do
  156.     if x>= data.bounds.x1 and x<= data.bounds.x2 and y==data.bounds.y then
  157.       return index --Returns the index of the clicked option
  158.     end
  159.   end
  160.   return false --If it went through the entire for loop without success, return false
  161. end
  162.  
  163. term.setBackgroundColor(colors.white)
  164. term.clear()
  165.  
  166. local selector = 1 --Our selector
  167. while true do --The main loop. I would generally put this inside of a function for a program.
  168.   menuDraw(selector) --Draw the menu first
  169.   local e = {os.pullEvent()} --Pull an event and put the returned values into a table
  170.   if e[1] == "key" then --If it's a key...
  171.     if e[2] == keys.down then -- ... and it's the down arrow
  172.       selector = selector < #menu_options and selector+1 or 1 --Increment the selector if the selector < #menu_options. Otherwise reset it to 1
  173.     elseif e[2] == keys.up then
  174.       selector = selector > 1 and selector-1 or #menu_options --Decrement the selector if the selector > 1. Otherwise, reset it to #menu_options
  175.     elseif e[2] == keys.enter then
  176.       break --Break out of the loop
  177.     end
  178.   elseif e[1] == "mouse_click" then
  179.     local value = checkClick(e[3], e[4]) --Check the mouse click
  180.     if value then --If checkClick returns a value and not false
  181.       selector = value --Set the selector to that value and break out of the loop
  182.       break
  183.     end
  184.   end
  185. end
  186.  
  187. term.clear()
  188. term.setCursorPos(1,1)
  189. if selector == (1) then
  190. local file = fs.open("log","r")
  191. read = file.readAll()
  192. print(read)
  193. file.close()
  194. print("Press any key to Continue")
  195. io.read()
  196. main()
  197. elseif selector == (2) then
  198. local file = fs.open("specs","r")
  199. read = file.readAll()
  200. print(read)
  201. print("Press any key to Continue")
  202. io.read()
  203. main()
  204. elseif selector == (3) then
  205. local file = fs.open("contacts","r")
  206. read = file.readAll()
  207. print(read)
  208. print("Press any Key to Continue")
  209. io.read()
  210. main()
  211. elseif selector == (4) then
  212. local file = fs.open("scanned","r")
  213. read = file.readAll()
  214. print(read)
  215. file.close()
  216. print("Press any key to Continue")
  217. io.read()
  218. main()
  219. elseif selector == (5) then
  220. rednet.broadcast("Scan")
  221. print("Scanning")
  222. id,msg = rednet.receive()
  223. print("ID Found!")
  224. sleep(1)
  225. local file = fs.open("scanned","a")
  226. file.writeLine(id)
  227. file.close()
  228. main()
  229. elseif selector == (6) then
  230. print("Enter the ID")
  231. Hack = read()
  232. print("Attempting to Crack ID's Password with")
  233. print("PasswordCracker lvl "..PC)
  234. if tonumber(Hack) == nil then
  235.   sleep(1)
  236.   print("Invalid ID")
  237.   sleep(1)
  238.   main()
  239. end
  240. rednet.send(tonumber(Hack),"PC",tonumber(PC))
  241. id,msg,msg2 = rednet.receive(5)
  242. if msg2 == ("success") then
  243. print(msg)
  244. local file = fs.open("contacts","a")
  245. file.writeLine(tonumber(Hack).." : "..tostring(msg))
  246. file.close()
  247. sleep(1)
  248. main()
  249. elseif msg2 == ("fail") then
  250. print(msg)
  251. sleep(1)
  252. main()
  253. elseif not id then
  254. sleep(1)
  255. print("No Response!")
  256. sleep(1)
  257. main()
  258. end
  259. elseif selector == (7) then
  260.   print("Type in the id and password!")
  261.   print("ID : ")
  262.   term.setCursorPos(6,3)
  263.   Hack = io.read()
  264.   print("PassWord : ")
  265.   term.setCursorPos(12,4)
  266.   Hack2 = io.read()
  267.   print("Connecting...")
  268.   if tonumber(Hack) == nil then
  269.   sleep(1)
  270.   print("Invalid ID")
  271.   sleep(1)
  272.   main()
  273.   end
  274.   rednet.send(tonumber(Hack),"Connect",tonumber(Hack2))
  275.   id,msg = rednet.receive(5)
  276.   if msg == ("success") then
  277.     textutils.slowPrint("Access Granted!")
  278.     term.clear()
  279.     term.setCursorPos(1,1)
  280.     logged()
  281.     sleep(1)
  282.     elseif msg == ("fail") then
  283.     print("ID or PassWord was incorrect!")
  284.     sleep(1)
  285.     main()
  286.     elseif not id then
  287.     print("No Response!")
  288.     sleep(1)
  289.     main()
  290.      end
  291.      end
  292.      end
  293.      main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement