View difference between Paste ID: sCZep1Za and cJejUuP4
SHOW: | | - or go back to the newest paste.
1
--Anti CtrlT
2
os.pullEvent=os.pullEventRaw
3
4
--Variables
5-
passcheck=tonumber(469)
5+
ntapiloc = shell.resolve("nerdtalk")
6
sendchan = 14003
7
replchan = 4862
8
auth = 8246
9
compid = os.getID()
10-
   rednet.open(b)
10+
11
--Loading API's
12
if not fs.exists(ntapiloc) then
13
        print("Nerdtalk is not present on this system, attempting to download...")
14
        if http then
15
                local wHandle = http.get("http://pastebin.com/raw.php?i=9zdaF9SV")
16-
term.clear()
16+
                if wHandle then
17-
term.setCursorPos(1,1)
17+
                        local fHandle = fs.open(ntapiloc, "w")
18-
print("Magpie Security v2|")
18+
                        if fHandle then
19-
print("------------------'")
19+
                                fHandle.write(wHandle.readAll())
20-
write("Password: ")
20+
                                fHandle.close()
21-
ui=read("*")
21+
                        else
22-
rednet.send(passcheck, ui)
22+
                                print("Could not open executable for writing.")
23-
id,msg=rednet.receive()
23+
                        end
24-
if msg == "yes" then
24+
                        wHandle.close()
25-
  term.clear()
25+
                else
26-
  term.setCursorPos(1,1)
26+
                        print("Could not connect to pastebin.")
27-
  print("Magpie Security|")
27+
                end
28-
  print("---------------'")
28+
        else
29-
else
29+
                print("HTTP is disabled.")
30-
  print("wrong")
30+
        end
31
end
32
os.loadAPI(ntapiloc)
33
34
--Modem Detection
35
for a,b in pairs(rs.getSides()) do
36
  if peripheral.getType(b) == 'modem' then
37
   m = peripheral.wrap(b)
38
   m.open(sendchan)
39
   m.open(replchan)
40
   break
41
  end
42
end
43
44
--Sub Functions
45
function checkID()
46
  if compid == 469 then
47
    logging = false
48
  end
49
end
50
51
function header()
52
  nerdtalk.clearPage()
53
  nerdtalk.centerPrint("| Magpie Industries |")
54
  nerdtalk.centerPrint(" ------------------- ")
55
end
56
57
--Main Program
58
function login()
59
  header()
60
  print(" ")
61
  print(" ")
62
  print(" ")
63
  nerdtalk.leftWrite("           Password: ")
64
  ui = read("*")
65
  m.transmit(sendchan, replchan, ui)
66
 local event, nil1, id, authchan, msg, nil2 = os.pullEvent("modem_message")
67
  if  authchan == auth then
68
    if msg == "AuthAccept" then
69
      header()
70
      nerdtalk.centerPrint("Connection Accepted")
71
      logging = false
72
    elseif msg == "NoBall" then
73
      nerdtalk.centerPrint("Incorrect")
74
    else
75
      nerdtalk.clearPage()
76
      term.setCursorPos(1, 9)
77
      nerdtalk.centerPrint("Incorrect Password")
78
    end
79
  end
80
end
81
82
logging = true
83
84
checkID()
85
86
while logging do
87
  login()
88
end