View difference between Paste ID: x7iDDmQa and 6WpAVENC
SHOW: | | - or go back to the newest paste.
1
fileName = "admin"
2
if(fs.exists(fileName) == true)then
3
	print("Installing Admin System")
4
    shell.run("rename "..fileName.." startup")
5
    sleep(5)
6-
ser = 46    -- Server ID#
6+
    os.reboot()
7-
side = "top" -- Rednet Modem Side
7+
8-
dSide = "left" -- Disk Drive Side (End)
8+
side = nil  -- Rednet Modem Side
9
dSide = nil   -- Disk Drive Side (End)
10
11
-- Determine where the modem is.
12
print("Looking for drive,")
13
if peripheral.isPresent("left") and peripheral.getType("left")=="drive" then
14
  dSide = "left"
15
elseif peripheral.isPresent("right") and peripheral.getType("right")=="drive" then
16
  dSide = "right"
17
elseif peripheral.isPresent("top") and peripheral.getType("top")=="drive" then
18
  dSide = "top"
19
elseif peripheral.isPresent("back") and peripheral.getType("back")=="drive" then
20
  dSide = "back"
21
elseif peripheral.isPresent("bottom") and peripheral.getType("bottom")=="drive" then
22
  dSide = "bottom"
23
else
24
	print("No Disk Drive Found")
25
	dSide = false
26
end
27
while dSide == false do
28
	
29
	sleep(5)
30
	shell.run("startup")
31
	
32
end
33
print("Disk Drive found on "..dSide)
34
35
36
-- Determine where the modem is.
37
print("Looking for modem,")
38
if peripheral.isPresent("left") and peripheral.getType("left")=="modem" then
39
  side = "left"
40
elseif peripheral.isPresent("right") and peripheral.getType("right")=="modem" then
41
  side = "right"
42
elseif peripheral.isPresent("top") and peripheral.getType("top")=="modem" then
43
  side = "top"
44
elseif peripheral.isPresent("back") and peripheral.getType("back")=="modem" then
45
  side = "back"
46
elseif peripheral.isPresent("bottom") and peripheral.getType("bottom")=="modem" then
47
  side = "bottom"
48
else
49
	print("No Modem Found")
50
	side = false
51
end
52
while side == false do
53
	
54
	sleep(5)
55
	shell.run("startup")
56
	
57
end
58
print("Modem found on "..side)
59
rednet.open(side)
60
61
ser = nil    -- Server ID#
62
function getserver()
63
  local fname = "ServerID"
64
  if fs.exists(fname) then
65
		file = fs.open(fname, "r")
66
		ser = tonumber(file.readAll())
67
		file.close()
68
		print("Server ID: "..ser)
69
  else
70
		print("No server configured")
71
		print("This ID is: ".. os.getComputerID())
72
		term.write("Server ID: ")
73
		ser = io.read()
74
		file = fs.open(fname, "w")
75
		file.write(ser)
76
		file.close()
77
		ser = tonumber(ser)
78
  end
79
end
80
81
getserver()
82
83
--[ BlueBank Admin by TrumpetMiner v3.5
84
--[ pastebin get 6WpAVENC admin
85
--[ Setup
86
term.setBackgroundColor(colors.blue)
87
term.setTextColor(colors.yellow)
88
side = nil  -- Rednet Modem Side
89
dSide = nil   -- Disk Drive Side (End)
90
91
-- Determine where the modem is.
92
dSide  = nil
93
print("Looking for drive,")
94
if peripheral.isPresent("left") and peripheral.getType("left")=="drive" then
95
  dSide = "left"
96
elseif peripheral.isPresent("right") and peripheral.getType("right")=="drive" then
97
  dSide = "right"
98
elseif peripheral.isPresent("top") and peripheral.getType("top")=="drive" then
99
  dSide = "top"
100
elseif peripheral.isPresent("back") and peripheral.getType("back")=="drive" then
101
  dSide = "back"
102
elseif peripheral.isPresent("bottom") and peripheral.getType("bottom")=="drive" then
103
  dSide = "bottom"
104
else
105
	print("No Disk Drive Found")
106
	dSide = false
107
end
108
while dSide == false do
109
	
110
	sleep(5)
111
	shell.run("startup")
112
	
113
end
114
print("Disk Drive found on "..dSide)
115
116
117
-- Determine where the modem is.
118
side = nil
119
print("Looking for modem,")
120
if peripheral.isPresent("left") and peripheral.getType("left")=="modem" then
121
  side = "left"
122
elseif peripheral.isPresent("right") and peripheral.getType("right")=="modem" then
123
  side = "right"
124
elseif peripheral.isPresent("top") and peripheral.getType("top")=="modem" then
125
  side = "top"
126
elseif peripheral.isPresent("back") and peripheral.getType("back")=="modem" then
127
  side = "back"
128
elseif peripheral.isPresent("bottom") and peripheral.getType("bottom")=="modem" then
129
  side = "bottom"
130
else
131
	print("No Modem Found")
132
	side = false
133
end
134
while side == false do
135
	
136
	sleep(5)
137
	shell.run("startup")
138
	
139
end
140
print("Modem found on "..side)
141
rednet.open(side)
142
143
ser = nil    -- Server ID#
144
function getserver()
145
  local fname = "ServerID"
146
  if fs.exists(fname) then
147
		file = fs.open(fname, "r")
148
		ser = tonumber(file.readAll())
149
		file.close()
150
		print("Server ID: "..ser)
151
  else
152
		print("No server configured")
153
		print("This ID is: ".. os.getComputerID())
154
		term.write("Server ID: ")
155
		ser = io.read()
156
		file = fs.open(fname, "w")
157
		file.write(ser)
158
		file.close()
159
		ser = tonumber(ser)
160
  end
161
end
162
getserver()
163
164
function start()
165
 term.clear()
166
 term.setCursorPos(3,4)
167
 print "[Add Money]"
168
 --term.setCursorPos(3,6)
169
 --print "[Check Balance]"
170
 term.setCursorPos(3,8)
171
 print "[New Encryption Key]"
172
 term.setCursorPos(3,10)
173
 print "[Auth Code Request]"
174
175
event, button, x, y = os.pullEvent("mouse_click")
176
177
if x >= 3 and x <= 14 and y == 4 then
178
  term.clear()
179
  term.setCursorPos(3,4)
180
  write "User: "
181
  user = read()
182
  term.setCursorPos(3,6)
183
  write "Amount: "
184
  amt = read()
185
  term.setCursorPos(3,8)
186
  write "Authorization Code > "
187
  auth = read()
188
  rednet.send(ser,"Add")
189
  rednet.send(ser,user)
190
  rednet.send(ser,amt)
191
  rednet.send(ser,auth)
192
  id, msg = rednet.receive()
193
  term.clear()
194
  term.setCursorPos(3,4)
195
  print(msg)
196
  os.pullEvent("mouse_click")
197
  start()
198
elseif x >=3 and x <= 22 and y == 8 then
199
  key()
200
elseif x >= 3 and x <= 21 and y == 10 then
201
  term.clear()
202
  rednet.send(ser,"Auth")
203
  id, msg = rednet.receive()
204
  term.setCursorPos(3,4)
205
  print(msg)
206
  os.pullEvent("mouse_click")
207
  start()
208
else
209
  start()
210
end
211
end
212
213
function key()
214
 term.clear()
215
 if disk.hasData(dSide) == true then
216
   term.setCursorPos(3,4)
217
218
   start()
219
 else
220
   term.setCursorPos(3,4)
221
   print "Please Insert Key"
222
   os.pullEvent("disk")
223
   key()
224
 end
225
end
226
227
start()