Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- by TheGameBros
- ----------------------------------
- ----- DONT CHANGE UNDER THIS -----
- ----------------------------------
- os.loadAPI("/debipasstor/api/config")
- os.loadAPI("/debipasstor/api/monster010")
- os.loadAPI("/debipasstor/api/btn")
- local software = "DebiPassTor"
- local monitor
- local cfg = {}
- local button = {}
- local input = ""
- local myTimer
- local xyzTimer
- local zyxTimer
- function addButtons()
- for name, data in pairs(button) do
- btn.add(name, data["name"], keyType, name, data["x"], data["y"], data["w"], data["h"], data["color"])
- end
- btn.screen()
- end
- function load()
- if fs.exists("/debipasstor/save") then
- button = monster010.loadFile("/debipasstor/save", true)
- end
- addButtons()
- end
- function StrToNum(str)
- if(str == "one") then
- return 1
- elseif(str == "two") then
- return 2
- elseif(str == "dree") then
- return 3
- elseif(str == "four") then
- return 4
- elseif(str == "five") then
- return 5
- elseif(str == "six") then
- return 6
- elseif(str == "seven") then
- return 7
- elseif(str == "eight") then
- return 8
- elseif(str == "nine") then
- return 9
- elseif(str == "null") then
- return 0
- end
- end
- function keyType(key)
- btn.flash(key)
- if(key == "enter") then
- os.cancelTimer(myTimer)
- checkPW()
- else
- input = input..StrToNum(key)
- end
- myTimer = os.startTimer(5)
- end
- function checkPW()
- if(input == cfg["password"]) then
- rs.setOutput("left",true)
- pwResult(true)
- input = ""
- else
- pwResult(false)
- input = ""
- end
- end
- function pwResult(success)
- monster010.clearMonitor()
- local bgcolor
- local color = colors.white
- local data = {
- label = "",
- xmin = 2,
- ymin = 2,
- xmax = 17,
- ymax = 11,
- }
- if success == true then
- bgcolor = colors.lime
- data["label"] = "Tor freigegeben"
- else
- bgcolor = colors.red
- data["label"] = "Passwort falsch"
- end
- btn.fill(data["label"], bgcolor, color, data)
- if success == true then
- xyzTimer = os.startTimer(1)
- else
- rs.setBundledOutput(cfg["redSide"], colors.black)
- zyxTimer = os.startTimer(3)
- end
- end
- function closeTor()
- local bgcolor = colors.lime
- local color = colors.white
- local data = {
- label = "",
- xmin = 2,
- ymin = 2,
- xmax = 17,
- ymax = 11,
- }
- btn.fill(data["label"], bgcolor, color, data)
- rs.setOutput("left",false)
- zyxTimer = os.startTimer(1)
- os.cancelTimer(xyzTimer)
- end
- function launchTimers()
- while true do
- local event, args = os.pullEvent()
- if event == "key" and args == 19 then
- os.reboot()
- elseif event == "timer" then
- if args == zyxTimer then
- rs.setBundledOutput(cfg["redSide"], colors.black)
- monster010.clearMonitor()
- addButtons()
- os.cancelTimer(zyxTimer)
- elseif args == xyzTimer then
- closeTor()
- elseif args == myTimer then
- input = ""
- os.cancelTimer(myTimer)
- end
- end
- end
- end
- config.load("/debipasstor/cfg")
- cfg = config.getConfig()
- monster010.construct(cfg["monSide"], software)
- monster010.startUp()
- monitor = monster010.getMonitor()
- btn.construct(monitor)
- load()
- addButtons()
- monster010.startUpDone()
- while true do
- parallel.waitForAny(btn.getClick, launchTimers)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement