Pinkishu

Untitled

Aug 8th, 2012
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 17.99 KB | None | 0 0
  1. --  -------- Mozilla Firefox
  2. --  -------- Created by 1lann
  3. --  -------- Edited by GravityScore
  4.  
  5. function firefoxVersion()
  6.     return "1.3.2 - Secure"
  7. end
  8.  
  9. --  -------- Variables
  10.  
  11. autoUpdate = false
  12. firefoxTitle = "Mozilla Firefox " .. firefoxVersion()
  13. firefoxServerTitle = "Firefox Server " .. firefoxVersion()
  14.  
  15. local x, y = term.getSize()
  16. local bDatabase = {}
  17. local bvIDs = {}
  18. local bvAddresses = {}
  19. local bType = nil
  20. exitFirefox = false
  21. local firsttime = true
  22. local title = firefoxTitle
  23.  
  24. local root = "/.FirefoxData"
  25. local blacklistLoc = root .. "/firefox_blacklist"
  26. local whitelistLoc = root .. "/firefox_whitelist"
  27.  
  28. local killSite = false
  29. local secureHostFunc = function(f,p)
  30.     local secureHost = coroutine.create(f)
  31.     killSite = false
  32.     coroutine.resume(secureHost,p)
  33.  
  34.  
  35.     while not killSite do
  36.         local ev,p1,p2,p3,p4,p5,p6 = os.pullEvent()
  37.         if coroutine.status(secureHost) ~= "dead" then
  38.             coroutine.resume(secureHost,ev,p1,p2,p3,p4,p5,p6)
  39.         else
  40.             break
  41.         end
  42.     end
  43.     if killSite then
  44.         print("Site execution aborted due security errors:"..killSite)
  45.     end
  46. end
  47.  
  48. function securityError(sec)
  49.     print("SECURITY ERROR: "..sec)
  50.     killSite = sec
  51.     coroutine.yield()
  52. end
  53.  
  54. local secureEnv = {}
  55. secureEnv.fs = {}
  56. --secureEnv.fs.open = function() securityError("fs.open") end
  57. --secureEnv.fs.d
  58. secureEnv.io = {}
  59. secureEnv.setfenv = function() securityError("setfenv") end
  60. secureEnv.getfenv = function() securityError("getfenv") end
  61. secureEnv.setmetatable = function() securityError("setmetatable") end
  62. secureEnv.getmetatable = function() securityError("getmetatable") end
  63.  
  64.  
  65.  
  66. setmetatable(secureEnv,{__index=_G})
  67. setmetatable(secureEnv.fs,{__index=function(t,v) securityError(v) end})
  68. setmetatable(secureEnv.io,{__index=function(t,v) securityError(v) end})
  69.  
  70. --Open Rednet
  71. rednet.open("top")
  72. rednet.open("left")
  73. rednet.open("right")
  74. rednet.open("back")
  75. rednet.open("front")
  76. rednet.open("bottom")
  77.  
  78. --  -------- Functions
  79.  
  80. local function prompt(list, dir)
  81.     --Variables
  82.     local curSel = 1
  83.     local c1 = 200
  84.     local c2 = 208
  85.     if dir == "horizontal" then c1 = 203 c2 = 205 end
  86.    
  87.     --Draw words
  88.     for i = 1, #list do
  89.         if list[i][2] == 1 then list[i][2] = 2
  90.         elseif list[i][2] + string.len(list[i][1]) >= 50 then
  91.             list[i][2] = 49 - string.len(list[i][1])
  92.         end
  93.        
  94.         term.setCursorPos(list[i][2], list[i][3])
  95.         write(list[i][1])
  96.     end
  97.    
  98.     --Functions
  99.     local function drawArrows(word, x, y)
  100.         --Draw arrows
  101.         term.setCursorPos(x, y)
  102.         write("[")
  103.         term.setCursorPos(x + 1 + string.len(word), y)
  104.         write("]")
  105.     end
  106.    
  107.     local function removeArrows(word, x, y)
  108.         --Remove current arrows
  109.         term.setCursorPos(x, y)
  110.         write(" ")
  111.         term.setCursorPos(x + 1 + string.len(word), y)
  112.         write(" ")
  113.     end
  114.    
  115.     --Draw arrows
  116.     drawArrows(list[curSel][1], list[curSel][2] - 1, list[curSel][3])
  117.    
  118.     --Start loop
  119.     while true do
  120.         --Get the key
  121.         local event, key = os.pullEvent("key")
  122.        
  123.         --Remove arrows
  124.         removeArrows(list[curSel][1], list[curSel][2] - 1, list[curSel][3])
  125.        
  126.         if key == c1 then
  127.             --Subtract
  128.             if curSel ~= 1 then
  129.                 curSel = curSel - 1
  130.             end
  131.         elseif key == c2 then
  132.             --Add
  133.             if curSel ~= #list then
  134.                 curSel = curSel + 1
  135.             end
  136.         elseif key == 28 then
  137.             --Enter
  138.             return list[curSel][1]
  139.         end
  140.        
  141.         --Draw Arrows
  142.         drawArrows(list[curSel][1], list[curSel][2] - 1, list[curSel][3])
  143.     end
  144. end
  145.  
  146. function getPastebin(pCode, pLocation)
  147.     -- Get from pastebin
  148.     local response = http.get("http://pastebin.com/raw.php?i=" .. textutils.urlEncode(pCode))
  149.  
  150.     if response then
  151.         local sResponse = response.readAll()
  152.         response.close()
  153.        
  154.         local file = fs.open(pLocation, "w")
  155.         file.write(sResponse)
  156.         file.close()
  157.     end
  158. end
  159.  
  160. function debug(debugmsg)
  161.     -- Print a debug message
  162.     term.setCursorPos(1,1)
  163.     term.clearLine()
  164.     write(debugmsg)
  165.     sleep(0.1)
  166. end
  167.  
  168. function isVerified(vWebsite, vID)
  169.     -- Verify an ID
  170.     for i = 1, #bvAddresses do
  171.         if vWebsite == string.lower(bvAddresses[i]) then
  172.             if tostring(vID) == bvIDs[i] then
  173.                 return "good"
  174.             else
  175.                 return "bad"
  176.             end
  177.         end
  178.     end
  179.  
  180.     return "unknown"
  181. end
  182.  
  183. function getDatabase()
  184.     -- Get database from pastebin
  185.     getPastebin("KL3WwmER", root .. "/fireDatabase")
  186.     getPastebin("GC4HK1We", root .. "/fireVerified")
  187.  
  188.     local f = io.open(root .. "/fireDatabase", "r")
  189.     bDatabase = {}
  190.     for readData in f:lines() do
  191.         table.insert(bDatabase, readData)
  192.     end
  193.     f:close()
  194.  
  195.     f = io.open(root .. "/fireVerified", "r")
  196.     bvIDs = {}
  197.     bvAddresses = {}
  198.     bType = "url"
  199.     for readData in f:lines() do
  200.         if bType == "url" then
  201.             table.insert(bvAddresses, readData)
  202.             bType = "id"
  203.         else
  204.             table.insert(bvIDs, readData)
  205.             bType = "url"
  206.         end
  207.     end
  208.     f:close()
  209.  
  210.     if not(fs.exists(blacklistLoc)) then
  211.         f = io.open(blacklistLoc, "w") f:write("\n") f:close()
  212.     else
  213.         f = io.open(blacklistLoc, "r")
  214.         for readData in f:lines() do
  215.             table.insert(bDatabase, readData)
  216.         end
  217.         f:close()
  218.     end
  219.  
  220.     if not fs.exists(whitelistLoc) then
  221.         f = io.open(whitelistLoc, "w") f:write("\n") f:close()
  222.     else
  223.         bType = "url"
  224.         f = io.open(whitelistLoc, "r")
  225.         local x = 1
  226.         local bnLines = 0
  227.         for readData in f:lines() do
  228.             bnLines = bnLines+1
  229.             if bType == "url" then
  230.                 table.insert(bvAddresses, readData)
  231.                 bType = "id"
  232.             else
  233.                 table.insert(bvIDs, readData)
  234.                 bType = "url"
  235.             end
  236.         end
  237.         f:close()
  238.         if #bvAddresses > #bvIDs then table.remove(bvAddresses, #bvAddresses)
  239.         elseif #bvAddresses < #bvIDs then table.remove(bvIDs, #bvIDs) end
  240.     end
  241.  
  242.     return (bDatabase)
  243. end
  244.  
  245. function isBad(number)
  246.     for i = 1, #bDatabase do
  247.         if tostring(number) == bDatabase[i] then
  248.             return true
  249.         end
  250.     end
  251.  
  252.     return false
  253. end
  254.  
  255. function dbContains(object, dbase)
  256.     for i = 1, #dbase do
  257.         if tostring(object) == dbase[i] then
  258.             return true, i
  259.         end
  260.     end
  261.  
  262.     return false
  263. end
  264.  
  265. function checkMalicious()
  266.     local suspected = {}
  267.     local times = {}
  268.     for i = 1, 5 do
  269.         rednet.broadcast(tostring(math.random(1, 9001)))
  270.         startClock = os.clock()
  271.         while os.clock() - startClock < 0.05 do
  272.             local a = rednet.receive(0.01)
  273.             if a ~= nil then
  274.                 dbState, dbPos = dbContains(a, suspected)
  275.                 if isBad(a) then
  276.                 elseif not dbState then
  277.                     table.insert(suspected, tostring(a))
  278.                     table.insert(times, 1)
  279.                     break
  280.                 else
  281.                     local newTimes = times[dbPos] + 1
  282.                     times[dbPos] = newTimes
  283.                 end
  284.             end
  285.         end
  286.     end
  287.  
  288.     for i =1, #suspected do
  289.         if times[i] > 2 then
  290.             f = io.open(blacklistLoc, "a")
  291.             f:write(suspected[i] .. "\n")
  292.             f:close()
  293.             table.insert(bDatabase, suspected[i])
  294.         end
  295.     end
  296. end
  297.  
  298. if not fs.exists(root) then
  299.     fs.makeDir(root)
  300.     fs.makeDir(root .. "/cache")
  301. elseif not fs.isDir(root) then
  302.     fs.delete(root)
  303.     fs.makeDir(root)
  304.     fs.makeDir(root .. "/cache")
  305. end
  306.  
  307. if fs.exists("/fireverify") then fs.move("/fireverify", whitelistLoc) end
  308. if fs.exists("/firelist") then fs.move("/firelist", blacklistLoc) end
  309. if fs.exists("/firefox_whitelist") then fs.move("/firefox_whitelist", whitelistLoc) end
  310. if fs.exists("/firefox_blacklist") then fs.move("/firefox_blacklist", blacklistLoc) end
  311. if fs.exists("/.fireServerPref") then fs.move("/.fireServerPref", root .. "/fireServerPref") end
  312.  
  313. local website = "home"
  314. fs.delete("/.fireDatabase")
  315. fs.delete("/.fireVerify")
  316.  
  317. function centerPrint(text)
  318.     local x2, y2 = term.getCursorPos()
  319.     term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
  320.     print(text)
  321. end
  322.  
  323. function reDirect(url)
  324.     website = url
  325.     loadWebpage()
  326. end
  327.  
  328. function setTitle(tToSet)
  329.     title = tToSet
  330.     if title == nil then
  331.         title = firefoxTitle
  332.     end
  333.  
  334.     term.setCursorPos(1,1)
  335.     term.clearLine()
  336.     centerPrint(title)
  337.     term.setCursorPos(1,2)
  338.     term.clearLine()
  339.     centerPrint("rdnt://" .. website .. "\n")
  340. end
  341.  
  342. local function createSite(websitename)
  343.     term.clear()
  344.     term.setCursorPos(1, 2)
  345.     print("Creating Site: " .. websitename)
  346.     print("Please Wait...")
  347.     f = io.open(root .. "/fireServerPref", "w")
  348.     f:write(websitename)
  349.     f:close()
  350.     getPastebin("wEmK4D4U", root .. "/firefoxServerUpdater")
  351.     shell.run(root .. "/firefoxServerUpdater")
  352.     exitFirefox = true
  353.     error()
  354. end
  355.  
  356. function loadWebpage()
  357.     if exitFirefox then error() end
  358.     term.clear()
  359.     term.setCursorPos(1,1)
  360.     title = firefoxTitle
  361.     centerPrint(title)
  362.     website = string.lower(website)
  363.     centerPrint("rdnt://" ..website.. "\n")
  364.  
  365.     if website == "home" then
  366.         if firsttime then
  367.             term.clear()
  368.             term.setCursorPos(1, 4)
  369.             print("                _____  _   ______   _____ ")
  370.             print("       ~~~~~~~ / ___/ / / / _   /  / ___/ ")
  371.             print("       ------ / /__  / / / /_/ /  / /_    ")
  372.             print("       ~~~~~ / ___/ / / / _  _/  / __/    ")
  373.             print("       ---- / /    / / / / \\ \\  / /___  ")
  374.             print("       ~~~ / /    /_/ /_/   \\_\\/_____/  ")
  375.             print("       -- / /  _,-=._              /|_/|  ")
  376.             print("       ~ /_/  `-.}   `=._,.-=-._.,  @ @._,")
  377.             print("                 `. _ _,-.   )      _,.-' ")
  378.             print("                          G.m-\"^m`m'     ")
  379.             print(" ")
  380.             print("        Mozilla Firefox is Now Loading... ")
  381.             sleep(0.1)
  382.  
  383.             if autoUpdate then
  384.                 getPastebin("ppnsSi26", root .. "/firefoxClientUpdate")
  385.                 local f = io.open(root .. "/firefoxClientUpdate", "r")
  386.                 clientUpdate = f:read("*a")
  387.                 f:close()
  388.  
  389.                 local ff = io.open("/firefox")
  390.                 currentClient = ff:read("*a")
  391.                 ff:close()
  392.  
  393.                 if not(currentClient == clientUpdate) then
  394.                     fs.delete("/firefox")
  395.                     fs.move(root .. "/firefoxClientUpdate", "/firefox")
  396.                     shell.run("/firefox")
  397.                     error()
  398.                 end
  399.             end
  400.  
  401.             firsttime = false
  402.         end
  403.  
  404.         term.clear()
  405.         term.setCursorPos(1, 1)
  406.         centerPrint(title)
  407.         centerPrint("rdnt://" ..website.. "\n")
  408.         centerPrint("Welcome to Mozilla Firefox " .. firefoxVersion())
  409.         print(" ")
  410.  
  411.         if autoUpdate then
  412.             print(" Auto Updating is On")
  413.         else
  414.             print(" Auto Updating is Off")
  415.         end
  416.  
  417.         print(" ")
  418.         print(" Useful Websites:")
  419.         print(" - rdnt://exit To Exit")
  420.         print(" - rdnt://help For Help on Black/Whitelisting")
  421.         print(" - rdnt://update to Force Update Firefox")
  422.         print(" - rdnt://newsite to Make a New Website")
  423.         print(" - rdnt://credits to View Credits")
  424.     elseif website == "exit" then
  425.         term.clear()
  426.         term.setCursorPos(1,1)
  427.         print("Thank you for using Firefox!")
  428.         sleep(0.3)
  429.  
  430.         exitFirefox = true
  431.         return
  432.     elseif website == "update" then
  433.         centerPrint("Force Update Firefox?")
  434.         print(" ")
  435.         local o = prompt({{"Yes", 11, 8}, {"No", 36, 8}},  "horizontal")
  436.         if o == "Yes" then
  437.             term.setCursorPos(1,1)
  438.             term.clear()
  439.             centerPrint(title)
  440.             centerPrint("rdnt://" ..website.. "\n")
  441.             centerPrint("Updating...")
  442.             getPastebin("ppnsSi26", "/firefox")
  443.             term.clear()
  444.             term.setCursorPos(1,1)
  445.             centerPrint(title)
  446.             centerPrint("rdnt://" ..website.. "\n")
  447.             centerPrint("Firefox Has Been Updated")
  448.             centerPrint("Press Any Key to Restart Firefox")
  449.             os.pullEvent("key")
  450.             shell.run("/firefox")
  451.             error()
  452.         else
  453.             term.clear()
  454.             term.setCursorPos(1,1)
  455.             centerPrint(title)
  456.             centerPrint("rdnt://" ..website.. "\n")
  457.             centerPrint("Cancelled")
  458.         end
  459.     elseif website == "help" then
  460.         term.setCursorPos(1, 4)
  461.         print(" Help for Black and Whitelists:")
  462.         print(" - Lists are stored in /.FirefoxData")
  463.         print(" - To Add a Server to the Blacklist:")
  464.         print("   - Enter the ID of the server you wish to block")
  465.         print("   - Example:")
  466.         print("   135")
  467.         print(" - To Add a Server to the Whitelist:")
  468.         print("   - Enter the server's URL on the first line")
  469.         print("   - Enter the server's ID on the next line")
  470.         print("   - Example:")
  471.         print("   mozilla")
  472.         print("   175")
  473.     elseif website == "clear" then
  474.         reDirect("home")
  475.     elseif website == "credits" then
  476.         term.setCursorPos(1, 4)
  477.         print(" Firefox Credits:")
  478.         print(" - Programmed by 1lann")
  479.         print(" - Designed and Edited by GravityScore")
  480.         print(" ")
  481.         print(" - Based off Rednet Explorer v2.4.1,")
  482.         print(" - Which is made by xXm0dzXx and CCFan11")
  483.     elseif website == "newsite" then
  484.         term.setCursorPos(1, 4)
  485.         centerPrint("Use This Computer as a Website Server?")
  486.         local k = prompt({{"Yes", 11, 6}, {"No", 36, 6}}, "horizontal")
  487.        
  488.         if k == "Yes" then
  489.             term.clear()
  490.             term.setCursorPos(1, 1)
  491.             title = firefoxServerTitle
  492.             centerPrint(title)
  493.             print(" ")
  494.  
  495.             if fs.exists(root .. "/fireServerPref") then
  496.                 f = io.open(root .. "/fireServerPref", "r")
  497.                 websitename = f:read("*l")
  498.                 f:close()
  499.  
  500.                 if fs.isDir("/" .. websitename) then
  501.                     centerPrint("A Previous Server Setup has Been Detected")
  502.                     centerPrint("For: " .. websitename)
  503.                     centerPrint("Use This Setup?")
  504.                     local opt = prompt({{"Yes", 11, 9}, {"No", 36, 9}}, "horizontal")
  505.  
  506.                     if opt == "Yes" then
  507.                         createSite(websitename)
  508.                     end
  509.                 end
  510.             end
  511.  
  512.             term.clear()
  513.             term.setCursorPos(1, 1)
  514.             centerPrint(title)
  515.             term.setCursorPos(2, 4)
  516.             write("Website Name: ")
  517.             websitename = read()
  518.             f = io.open(root .. "/fireServerPref", "w")
  519.             f:write(websitename)
  520.             f:close()
  521.  
  522.             term.clear()
  523.             term.setCursorPos(1, 1)
  524.             centerPrint(title .. "\n")
  525.                
  526.             if fs.exists("/" .. websitename) then
  527.                 if not(fs.isDir("/" .. websitename)) then
  528.                     fs.move("/" .. websitename, root .. "/firefoxtemphome")
  529.                     fs.makeDir("/" .. websitename)
  530.                     fs.move(root .. "/firefoxtemphome", "/" .. websitename .. "/home")
  531.                     print(" An Old Website Has Been Detected")
  532.                     print(" It Has Been Moved To: ")
  533.                     print(" /" .. websitename .. "/home")
  534.                     print(" ")
  535.                 end
  536.             else
  537.                 fs.makeDir("/" .. websitename)
  538.             end
  539.  
  540.             rednet.broadcast(string.lower(websitename))
  541.             local i, me = rednet.receive(0.5)
  542.             if i ~= nil then
  543.                 print(" WARNING: This Domain Name May Already Be In Use")
  544.                 print(" ")
  545.             end
  546.  
  547.             print(" The Website Files can be Found In:")
  548.             print(" /" .. websitename)
  549.             print(" The Homepage is Located At:")
  550.             print(" /" .. websitename .. "/home")
  551.             print(" ")
  552.  
  553.             print(" Edit the Homepage of the Website?")
  554.             local o = prompt({{"Yes", 11, 14}, {"No", 36, 14}}, "horizontal")
  555.             if o == "Yes" then
  556.                 shell.run("/rom/programs/edit", "/" .. websitename .. "/" .. "home")
  557.             elseif o == "No" then
  558.                 if not fs.exists("/" .. websitename .. "/" .. "home") then
  559.                     local f = io.open("/" .. websitename .. "/" .. "home", "w")
  560.                     f:write("print(\" \")\nprint(\"Welcome to " .. websitename .. "\")")
  561.                 end
  562.                 f:close()
  563.             end
  564.            
  565.             term.clear()
  566.             term.setCursorPos(1, 1)
  567.             createSite(websitename)
  568.         end
  569.     else
  570.         title = firefoxTitle
  571.         term.clear()
  572.         term.setCursorPos(1, 1)
  573.         centerPrint(title)
  574.         centerPrint("rdnt://" ..website.. "\n")
  575.         print(" Connecting to Website...")
  576.         checkMalicious()
  577.         rednet.broadcast(website)
  578.         if string.find(website, "/") then
  579.             fWebsite = string.gsub(website, "/", "$slazh$")
  580.         else
  581.         fWebsite = website
  582.         end
  583.  
  584.         local website1 = root .. "/cache/" .. fWebsite
  585.         local startClock = os.clock()
  586.         while os.clock() - startClock < 0.05 do
  587.             id, message = rednet.receive(0.01)
  588.             vResult = isVerified(website, id)
  589.             if vResult == "bad" then message = nil
  590.             elseif vResult == "good" then break
  591.             elseif vResult == "unknown" and isBad(id) == false then break
  592.             else message = nil
  593.             end
  594.         end
  595.  
  596.         if message == nil then
  597.             if fs.exists(website1) then
  598.                 term.clear()
  599.                 term.setCursorPos(1, 1)
  600.                 centerPrint(title)
  601.                 centerPrint("rdnt://" ..website.. "\n")
  602.                 centerPrint("Unable to Connect to Website")
  603.                 centerPrint("Resort to Cached Version?")
  604.                 local o = prompt({{"Yes", 11, 8}, {"No", 36, 8}}, "horizontal")
  605.                 if o == "Yes" then
  606.                     term.clear()
  607.                     term.setCursorPos(1, 1)
  608.                     centerPrint(title)
  609.                     centerPrint("rdnt://" ..website.. "\n")
  610.                     shell.run(website1)
  611.  
  612.                     if exitFirefox then
  613.                         error()
  614.                     end
  615.                 elseif o == "No" then
  616.                     term.clear()
  617.                     term.setCursorPos(1, 1)
  618.                     centerPrint(title)
  619.                     centerPrint("rdnt://" ..website.. "\n")
  620.                     centerPrint(" _____                         _ ")
  621.                     centerPrint("|  ___|                       | |")
  622.                     centerPrint("| |__  _ __  _ __  ___   _ __ | |")
  623.                     centerPrint("|  __|| '__|| '__|/ _ \\ | '__|| |")
  624.                     centerPrint("| |___| |   | |  | (_) || |   |_|")
  625.                     centerPrint("\\____/|_|   |_|   \\___/ |_|   (_)")
  626.                     print(" ")
  627.                     centerPrint("Unable to Connect to Website")
  628.                     centerPrint("The Website May Be Down or Blocked")
  629.                 end
  630.             else
  631.                 term.clear()
  632.                 term.setCursorPos(1, 1)
  633.                 centerPrint(title)
  634.                 centerPrint("rdnt://" ..website.. "\n")
  635.                
  636.                 centerPrint(" _____                         _ ")
  637.                 centerPrint("|  ___|                       | |")
  638.                 centerPrint("| |__  _ __  _ __  ___   _ __ | |")
  639.                 centerPrint("|  __|| '__|| '__|/ _ \\ | '__|| |")
  640.                 centerPrint("| |___| |   | |  | (_) || |   |_|")
  641.                 centerPrint("\\____/|_|   |_|   \\___/ |_|   (_)")
  642.                 print(" ")
  643.                 centerPrint("Unable to Connect to Website")
  644.                 centerPrint("The Website May Be Down or Blocked")
  645.             end
  646.         else
  647.             if fs.exists(website1) then fs.delete(website1) end
  648.             local webpage = io.open(website1, "w")
  649.             webpage:write(message)
  650.             webpage:close()
  651.  
  652.             term.clear()
  653.             term.setCursorPos(1, 1)
  654.             centerPrint(title)
  655.             centerPrint("rdnt://" ..website.. "\n")
  656.             local runSecure = function(website1) local file = fs.open(website1,"r") local s = file.readAll() file.close() local f = loadstring(s) setfenv(f,secureEnv) f()  end
  657.             --setfenv(runSecure,secureEnv)
  658.             secureHostFunc(runSecure,website1)
  659.             --shell.run(website1)
  660.  
  661.             if exitFirefox then
  662.                 error()
  663.             end
  664.         end
  665.     end
  666.    
  667.     if exitFirefox then error() end
  668.     os.queueEvent("firefoxDoneLoading")
  669.     term.setCursorPos(1, y)
  670.    
  671.     local name = "F5 to Refresh"
  672.     write("Control to Surf the Web")
  673.     term.setCursorPos(x - name:len(), y)
  674.     write(name)
  675.    
  676.     while true do
  677.         local e, k = os.pullEvent("key")
  678.         if k == 63 then
  679.             loadWebpage()
  680.             break
  681.         elseif k == 29 then
  682.             term.setCursorPos(1,2)
  683.             term.clearLine()
  684.             write("rdnt://")
  685.             website = read()
  686.             loadWebpage()
  687.             break
  688.         end
  689.     end
  690. end
  691.  
  692. function autoDatabase()
  693.     while true do
  694.         local aDE = os.pullEvent()
  695.         if aDE == "firefoxDoneLoading" then
  696.             getDatabase()
  697.         end
  698.     end
  699. end
  700.  
  701. parallel.waitForAny(autoDatabase, loadWebpage)
Advertisement
Add Comment
Please, Sign In to add comment