FoxWorn3365

Gauugle - Client

Sep 23rd, 2021 (edited)
430
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. term.setBackgroundColor(colors.white)
  2. term.clear()
  3.  
  4. -- Sistemo le funzioni per tutto
  5. function header(text, color)
  6.   term.setBackgroundColor(colors[color])
  7.   term.setTextColor(colors.white)
  8.   term.setCursorPos(1, 1)
  9.   print(text)
  10. end
  11.  
  12. function button(x, y, text, color, bkcolor)
  13.   term.setBackgroundColor(colors[bkcolor])
  14.   term.setTextColor(colors[color])
  15.   term.setCursorPos(x, y)
  16.   print(text)
  17. end
  18.  
  19. function bkText(text, col, bkcol)
  20.    term.setBackgroundColor(colors[bkcol])
  21.    term.setTextColor(colors[col])
  22.    print(text)
  23. end
  24.  
  25. function text(text, color)
  26.   term.setBackgroundColor(colors.white)
  27.   term.setTextColor(colors[color])
  28.   print(text)
  29. end
  30.  
  31. function n(col)
  32.   term.setBackgroundColor(colors.white)
  33.   term.setTextColor(colors[col])
  34. end
  35.  
  36. function popupPos(aa)
  37.   term.setCursorPos(5, aa)
  38. end
  39.  
  40. function popup(text, text1, text2, text3, text4, text5) --TEXT = MAX 15 - MM = MAX 15
  41.   drawFilledBox(5, 2, 27, 9, colours.grey)
  42.   term.setTextColor(colors.white)
  43.   term.setCursorPos(5, 2)
  44.   print("|---------------------|")
  45.   term.setCursorPos(5, 3)
  46.   print(text)
  47.   popupPos(4)
  48.   print(text1)
  49.   popupPos(5)
  50.   print(text2)
  51.   popupPos(6)
  52.   print(text3)
  53.   popupPos(7)
  54.   print(text4)
  55.   popupPos(8)
  56.   print(text5)
  57.   term.setCursorPos(5, 9)
  58.   print("|---------------------|")
  59. end
  60.  
  61. local function drawPixelInternal(xPos, yPos)
  62.     term.setCursorPos(xPos, yPos)
  63.     term.write(" ")
  64. end
  65.  
  66. local tColourLookup = {}
  67. for n = 1, 16 do
  68.     tColourLookup[string.byte("0123456789abcdef", n, n)] = 2 ^ (n - 1)
  69. end
  70.  
  71. function drawFilledBox(startX, startY, endX, endY, nColour)
  72.     if type(startX) ~= "number" or type(startX) ~= "number" or type(endX) ~=
  73.         "number" or type(endY) ~= "number" or
  74.         (nColour ~= nil and type(nColour) ~= "number") then
  75.         error("Expected startX, startY, endX, endY, colour", 2)
  76.     end
  77.  
  78.     startX = math.floor(startX)
  79.     startY = math.floor(startY)
  80.     endX = math.floor(endX)
  81.     endY = math.floor(endY)
  82.  
  83.     if nColour then term.setBackgroundColor(nColour) end
  84.     if startX == endX and startY == endY then
  85.         drawPixelInternal(startX, startY)
  86.         return
  87.     end
  88.  
  89.     local minX = math.min(startX, endX)
  90.     if minX == startX then
  91.         minY = startY
  92.         maxX = endX
  93.         maxY = endY
  94.     else
  95.         minY = endY
  96.         maxX = startX
  97.         maxY = startY
  98.     end
  99.  
  100.     for x = minX, maxX do for y = minY, maxY do drawPixelInternal(x, y) end end
  101. end
  102.  
  103. if fs.exists(".settings") == false then
  104.    v = 5
  105. else
  106.   shell.run(".settings")
  107.   v = 0
  108.   rednet.open(side)
  109. end
  110.  
  111. while true do
  112. if v == 0 then
  113.  
  114. term.clear()
  115. header("                     GAUGLE                  [INFO]", "blue")
  116.  
  117.   text("\n\nBenvenuto su GAUGLE!\nIn questo browser potrai cercare roba bella!", "black")
  118.   button(15, 7, "  CERCA QUALCOSA  ", "white", "green")
  119.   button(15, 9, "  AGGIORNA GAUGLE ", "white", "orange")  
  120.   button(15, 11, "   IMPOSTAZIONI   ", "white", "orange")
  121.  
  122. local event, tasto, x, y = os.pullEvent("mouse_click")
  123. if y == 7 and x > 15 and x < 33 then
  124.   v = 1
  125. elseif y == 9 and x > 15 and x < 33 then
  126.   shell.run("rm startup")
  127.   shell.run("pastebin get Q9eXCRxV startup")
  128.   shell.run("reboot")
  129. elseif y == 1 and x > 45 then
  130.   v = 3
  131. elseif y == 11 and x > 14 and x < 33 then
  132.   v = 49
  133. else
  134.   shell.run("startup")
  135. end
  136. elseif v == 1 then
  137.   term.setBackgroundColor(colors.white)
  138.   term.clear()
  139.   header("                     GAUGLE                        ", "blue")
  140.   term.setCursorPos(10, 6)
  141.   text("Vai al sito:", "black")
  142.   term.setCursorPos(10, 7)
  143.   url = read()
  144. if url == "gaugle://info" then
  145.    v = 3
  146. elseif url == "gaugle://mail?rtoken=rednet_TEXT_833jdjdu_B" then
  147.   v = 10
  148. else
  149.   v = 2
  150. end
  151. elseif v == 2 then
  152.         term.clear()
  153.  
  154.  
  155.   rednet.send(modem, "search()"..url)
  156.   local ip, msg, ptrc = rednet.receive(3)
  157.  
  158.  
  159.   if msg == nil then
  160.   term.setBackgroundColor(colors.white)
  161.   term.clear()
  162.   header("[HOME]                GAUGLE             [RESEARCH]", "blue")
  163.   text("http://"..url, "gray")
  164.   text("\nERRORE 404 - Pagina non trovata", "red")
  165.   else
  166.   term.setBackgroundColor(colors.white)
  167.   term.clear()
  168.   header("[HOME]                GAUGLE             [RESEARCH]", "blue")
  169.   text("http://"..url, "gray")
  170.   text("\n"..msg, "black")
  171.   end
  172.   local event, button, x, y = os.pullEvent("mouse_click")
  173.     if y == 1 and x < 7 then
  174.      v = 0
  175.     elseif y == 1 and x > 43 then
  176.        drawFilledBox(8, 2, 40, 2, colours.white)
  177.        term.setCursorPos(8, 2)
  178.        term.setTextColor(colors.gray)
  179.        url = read()
  180.        v = 2
  181.     elseif y == 2 and x > 35 then
  182.        term.setCursorPos(8, 2)
  183.        term.setTextColor(colors.gray)
  184.        url = read()
  185.        v = 2
  186.     end
  187.   elseif v == 3 then
  188.    term.setBackgroundColor(colors.white)
  189.    term.clear()
  190.    header("[HOME]                GAUGLE                       ", "blue")
  191.    text("gaugle://info", "gray")
  192.    text("\n\nGAUUUGLE!\n\nMade by: FoxWorn3365\nVersion: v1.7 [Working on Firewall]\n\nConfiguration Information:\nType: WIRELESS_2.0\nModem IP: 144.91.97."..modem.."\nModem side: "..side, "black")
  193.    local event, button, x, y = os.pullEvent("mouse_click")
  194.    if y == 1 and x < 10 then
  195.       v = 0
  196.     end
  197.  elseif v == 5 then
  198.    term.setBackgroundColor(colors.white)
  199.    term.clear()
  200.    header("[INST]                GAUGLE                       ", "blue")
  201.    text("\n\nInstallazione di GAUGLE", "black")
  202.    text("\nInserisci l'ID del Modem WIFI:", "black")
  203.    local mdwifi = read()
  204.    text("\n\nPerfetto, ora inserisci il lato dove e' presente il wm:", "black")
  205.    local mdside = read()
  206.    local f = fs.open(".settings", "w")
  207.    f.writeLine("modem = "..mdwifi)
  208.    f.writeLine("side = '"..mdside.."'")
  209.    f.close()
  210.    -- Confermo la creazione
  211.    shell.run("startup")
  212.  elseif v == 10 then
  213.      term.setBackgroundColor(colors.white)
  214.      term.clear()
  215.      header("[HOME]                GAUGLE             [  MAIL  ]", "blue")
  216.      text("gaugle://mail", "gray")
  217.      text("\nBenvenuto nella casella MAIL di GAUGLE!", "black")
  218.      button(15, 6, " INVIA UNA EMAIL ", "white", "blue")
  219.      button(15, 8, "  LE TUE EMAIL   ", "white", "blue")
  220.      local event, button, x, y = os.pullEvent("mouse_click")
  221.         if y == 6 and x > 15 and x < 32 then
  222.             v = 15
  223.          elseif y == 8 and x > 15 and x < 32 then
  224.             v = 12
  225.          elseif y == 1 and x < 7 then
  226.             v = 0
  227.          end
  228.   elseif v == 15 then
  229.         term.setBackgroundColor(colors.white)
  230.         term.clear()
  231.         header("[HOME]                GAUGLE             [  MAIL  ]", "blue")
  232.         text("gaugle://mail#send", "gray")
  233.         text("\n\nInvia un'email!", "black")
  234.         text("\n\nInserisci il destinatario:", "blue")
  235.         term.setCursorPos(3, 9)
  236.         print("@mail.com")
  237.         term.setCursorPos(1, 9)
  238.         to = read()
  239.         print(to)
  240.         text("\n\nInserisci il Messaggio:", "blue")
  241.         mam = read()
  242.         print(mam)
  243.         text("Inviato "..mam.." a "..to.."@mail.com", "green")
  244.         rednet.send(to, mam)
  245.         os.pullEvent("mouse_click")
  246.         v = 10
  247.   elseif v == 49 then
  248.         term.setBackgroundColor(colors.white)
  249.         term.clear()
  250.         header("[HOME]                GAUGLE         [Impostazioni]", "blue")
  251.         text("gaugle://settings", "gray")
  252.         text("\n\nImpostazioni di Gauugle:", "black")
  253.         button(15, 8, " Impostazioni di Rete ", "white", "orange")
  254.         button(15, 10, " Impostazioni Firewall ", "white", "orange")
  255.         button(15, 12, " Centro Assistenza ", "white", "red")
  256.         local event, bt, x, y = os.pullEvent("mouse_click")
  257.         if y == 8 then
  258.           v = 5
  259.         elseif y == 10 then
  260.           v = 51
  261.         elseif y == 1 then
  262.           v = 0
  263.         end  
  264.   elseif v == 50 then
  265.         term.setBackgroundColor(colors.white)
  266.         term.clear()
  267.         header("[HOME]                GAUGLE             [FireWall]", "blue")
  268.         text("gaugle://firewallManager", "gray")
  269.         text("\nImpostazioni dei FireWall:", "black")
  270.         rednet.send(modem, "firewall()sus")
  271.         ma = {}
  272.         lo, msg, ptrc = rednet.receive(5)
  273.         if msg == nil then
  274.         print("Al momento non ci sono porte aperte...")
  275.         else
  276.         open = textutils.unserialize(msg)
  277.         nan = 1
  278.         for v, d in pairs(open) do
  279.           ma[nan] = {d, "ATTIVA"}
  280.           print("> Porta: "..d.." | Status: APERTA\n")
  281.           local x, y = term.getCursorPos()
  282.           button(x + 35, y - 2, " CHIUDI ", "white", "red")
  283.           term.setBackgroundColor(colors.white)
  284.           term.setTextColor(colors.black)
  285.           nan = nan + 1
  286.           sleep(0.1)
  287.         end
  288.         end
  289.         local event, t, x, y = os.pullEvent("mouse_click")
  290.         if y == 1 then
  291.         v = 0
  292.         elseif y > 4 and y <= nan + 4 then
  293.            doa = ma[y - 4]
  294.            rednet.send(modem, "remove()"..doa[1])
  295.            v = 51
  296.         end
  297.   elseif v == 51 then
  298.         term.setBackgroundColor(colors.white)
  299.         term.clear()
  300.         header("[HOME]                GAUGLE             [FireWall]", "blue")
  301.         text("gaugle://firewall", "gray")
  302.         text("\nGestisci i FireWall", "black")
  303.         button(15, 6, " Visualizza le Porte Aperte ", "white", "orange")
  304.         button(15, 8, " Apri una Nuova Porta ", "white", "orange")
  305.         local event, t, x, y = os.pullEvent("mouse_click")
  306.         if y == 6 then
  307.          v = 50
  308.         elseif y == 8 then
  309.          v = 52
  310.         elseif y == 1 then
  311.          v = 0
  312.         end
  313.   elseif v == 52 then
  314.         term.setBackgroundColor(colors.white)
  315.         term.clear()
  316.         header("[HOME]                GAUGLE             [FireWall]", "blue")
  317.         text("gaugle://firewallOpenDoor", "gray")
  318.         text("\nApri una porta dal Firewall", "black")
  319.         text("\n\n\nInserisci la porta da aprire (01 - 128)", "black")
  320.         porta = read()
  321.         if tonumber(porta) > 128 then
  322.            text("NUMERO TROPPO GRANDE! MASSIMO 128!", "red")
  323.            sleep(2)
  324.            v = 52
  325.         else
  326.         rednet.send(modem, "add()"..porta)
  327.         v = 51
  328.         end
  329. end
  330. end
  331.  
  332.    
RAW Paste Data