Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --# WaliLogin by Andre A. Walia (walia6)
- --# liscensed under CreativeCommons Attribution.
- --# You may distribute,remix, tweak, and build
- --# upon my work, even commercially, as long as
- --# you credit me by my First, middle initial, and last name.
- characters = {'a','b','c','d','e','f','1','2','3','4','5','6','7','8','9','0'}
- function genSalt()
- toReturn=''
- for xx=1,64 do
- toReturn=toReturn..characters[math.random(1,#characters)]
- end
- return toReturn
- end
- local codes = {
- ["APIS/walCrypt"] = "efeJSTH9",
- ["APIS/sha256"] = "tBStqhvU",
- ["startup"] = "kNJ6sFHd",
- ["addUser"] = "1Tf3CjWS",
- [".shell"] = "WrH70miG"
- }
- re = http.get("http://www.pastebin.com/raw.php?i=GQ1JmtNq").readLine()
- local function get(name,code)
- if code then
- local r=http.get("http://www.pastebin.com/raw.php?i="..code)
- if fs.exists(name) then
- error(name.." already exists")
- end
- local cont = {}
- a = r.readAll()
- local prog = fs.open(name,"w")
- prog.writeLine(a)
- prog.flush()
- prog.close()
- return true
- else
- error("No code?")
- return false
- end
- end
- print()
- print("Would you like to install walia6's login? y/n")
- local a = true
- while a do
- event,char = os.pullEvent("char")
- if string.upper(char) == "N" or string.upper(char) == "Y" then
- k=string.upper(char)
- a=false
- end
- end
- if k == "Y" then
- for k,v in pairs(codes) do
- if fs.exists(k) then
- fs.delete(k)
- end
- get(k,v)
- end
- --get("walCrypt",codes["walCrypt"])
- --get("startup",codes["startup"])
- os.loadAPI("APIS/sha256")
- print()
- write("Username: ")
- user = read()
- while true do
- print()
- write("Password: ")
- pass = read("*")
- write("Enter password again: ")
- if read("*") == pass then
- if fs.exists("loginSettings") then
- fs.delete("loginSettings")
- end
- shell.run("mkdir loginSettings")
- if fs.exists("loginSettings/version") then
- fs.delete("loginSettings/version")
- end
- ff=fs.open("loginSettings/version","w")
- ff.writeLine(re)
- ff.flush()
- ff.close()
- info={}
- info[user] = {}
- info[user]['salt'] = genSalt()
- info[user]['hash'] = sha256.sha256(pass..(info[user]['salt']))
- infoFile=fs.open('accounts','w')
- infoFile.writeLine(textutils.serialize(info))
- infoFile.close()
- info=nil
- break
- else
- print("password do not match")
- end
- end
- os.reboot()
- end
Advertisement
Add Comment
Please, Sign In to add comment