Open main menu
Posts
Gists
Guilds
Users
Decipher
Docs
Open user menu
Log in
Sign up
Create a new gist
Posts
Gists
Guilds
Users
Decipher
Docs
Files
setup.src
cli/npcRshell.src
cli/academicMissions.src
src/mail.src
setup.src
import_code("/home/me/h/libs/list.src")
import_code("/home/me/h/libs/disk.src")
import_code("/home/me/h/libs/passwords.src")
comp = get_shell.host_computer
print "setup hacking script"
comp.File("/home/me/h/src/tableAttack.src").copy(home_dir + "/Config", "tableAttack.src")
comp.File("/home/me/h/src/rserverInstaller.src").copy(home_dir + "/Config", "rserverInstaller.src")
print "compiling cli tools"
if comp.File(home_dir + "/vegaTools") then comp.File(home_dir + "/vegaTools").delete
comp.File("/home/me/h/cli").copy(home_dir, "vegaTools")
for f in comp.File(home_dir + "/vegaTools").get_files
get_shell.build(home_dir + "/vegaTools/" + f.name, home_dir + "/vegaTools")
b =
get_shell.build(home_dir + "/vegaTools/" + f.name, home_dir + "/vegaTools")
if b isa string then print(f.name + " error: <color=red>" + b + "</color>")
f.delete
end for
Disk.init("/home/me/Config", "passwords")
// setup passwords db
if Disk.read_chars.len > 0 then exit
if(Disk.blobs.len > 1) then exit("password generation setup already completed")
PasswordGenerator.init(PASSWORDS)
print "generating passwords, it will take a while"
HASH_TABLE=PasswordGenerator.AllPasswords
print "done"
print "parsing passwords obj"
f = function(o)
return o[1]
end function
pass_list = HASH_TABLE.to_list.map(@f)
print "done"
print "writing to disk"
Disk.write(pass_list.join(char(10)))
print "done"
cli/npcRshell.src
import_code("/home/me/h/src/utils.src") // exports map.inspect, p
import_code("/home/me/h/libs/list.src") // exports list utils and map utils
import_code("/home/me/h/libs/disk.src") // exports Disk, Block
import_code("/home/me/h/libs/nmap.src") // exports Nmap, Service
import_code("/home/me/h/libs/scan.src") // exports Scan
import_code("/home/me/h/libs/json.src") // exports Json
import_code("/home/me/h/src/rndIP.src") // exports rnd_ip
import_code("/home/me/h/libs/optionSelector.src") // exports option_selector
import_code("/home/me/h/src/machine.src") // exports Machine, MachineService, depends on Scan, Nmap , Json, rnd_ip
import_code("/home/me/h/src/shell.src") // extend map
TABLEATTACK_SCRIPT = get_shell.host_computer.File(home_dir + "/Config/tableAttack.src")
EMPTY_LOG_PATH = home_dir + "/Config/emptyLog"
RSERVER_INSTALLER_SCRIPT = get_shell.host_computer.File(home_dir + "/Config/rserverInstaller.src")
PASSWORDS_DISK = new Disk
PASSWORDS_DISK.init(home_dir + "/Config", "passwords")
EXPLOITS_DISK = new Disk
EXPLOITS_DISK.init(home_dir + "/Config", "exploits")
ENTRIES_DISK = new Disk
ENTRIES_DISK.init(home_dir + "/Config", "entries")
Machine.metaxploit = include_lib("/lib/metaxploit.so")
Scan.metaxploit = include_lib("/lib/metaxploit.so")
get_shell.host_computer.touch(home_dir + "/Config", "rservers.txt")
RSERVERS_FILE = get_shell.host_computer.File(home_dir + "/Config/rservers.txt")
Command = {}
Command.npcRsrv_sig = {}
Command.npcRsrv_sig["description"] = "hack a random pc and setup rshell server in it"
Command.npcRsrv_sig["args"] = []
Command.npcRsrv_sig["options"] = [{["-w", "--wipe"]: "wipe the server logs instead of connecting"}]
Command.npcRsrv = function(args = [], options = {})
re_hack = function(s)
ip = s.split(":")[0]
port = s.split(":")[1].to_int
machine = new Machine
machine.init(ip, PASSWORDS_DISK, EXPLOITS_DISK, ENTRIES_DISK)
server_service = null
for s in machine.services
if s.port == port then server_service = s
end for
server_service.set_exploits
server_shell = server_service.quick_root_shell(TABLEATTACK_SCRIPT)
router_shell = machine.router_service
router_shell.set_exploits
router_shell = router_shell.quick_root_shell(TABLEATTACK_SCRIPT)
router_shell.clear_logs(EMPTY_LOG_PATH)
server_shell.clear_logs(EMPTY_LOG_PATH)
if options["-w"] then exit
server_shell.start_terminal
end function
rservers = RSERVERS_FILE.get_content.split(char(10)).compact
if rservers.len > 0 then
print "you arealdy have hacked rservers, do you want to reuse them?" + char(10)
for i in rservers.indexes
rservers[i] = [@re_hack, rservers[i], rservers[i]]
end for
rservers.push ["return", null, "hack a new one"]
option_selector rservers
end if
while true
machine = new Machine
machine.init(rnd_ip, PASSWORDS_DISK, EXPLOITS_DISK, ENTRIES_DISK)
if machine.open_services.len == 0 then continue
router_shell = machine.router_service
router_shell.set_exploits
router_shell = router_shell.quick_root_shell(TABLEATTACK_SCRIPT)
if router_shell == null then continue
router_shell.clear_logs(EMPTY_LOG_PATH)
server_shell = null
server_port = null
for s in machine.open_services
s.set_exploits
shell = s.quick_root_shell(TABLEATTACK_SCRIPT)
if shell != null then
server_shell = shell
server_port = s.port
break
end if
end for
if server_shell == null then continue
server_shell.clear_logs(EMPTY_LOG_PATH)
router_shell = machine.router_service
router_shell.set_exploits
router_shell = router_shell.quick_root_shell(TABLEATTACK_SCRIPT)
if router_shell == null then continue
router_shell.clear_logs(EMPTY_LOG_PATH)
machine.save_exploits
server_shell.install_rserver(RSERVER_INSTALLER_SCRIPT)
RSERVERS_FILE.set_content(RSERVERS_FILE.get_content + char(10) + machine.ip + ":" + server_port)
server_shell.start_terminal
end while
end function
import_code("/home/me/h/libs/thor.src") //depends on Listlib, exports Thor
Thor.init(Command, "npcRsrv")
cli/academicMissions.src
import_code("/home/me/h/src/utils.src") // exports map.inspect, p
import_code("/home/me/h/libs/list.src") // exports list utils and map utils
import_code("/home/me/h/libs/disk.src") // exports Disk, Block
import_code("/home/me/h/libs/nmap.src") // exports Nmap, Service
import_code("/home/me/h/libs/scan.src") // exports Scan
import_code("/home/me/h/libs/json.src") // exports Json
import_code("/home/me/h/src/rndIP.src") // exports rnd_ip
import_code("/home/me/h/src/mail.src") // exports Mail, Inbox
import_code("/home/me/h/libs/optionSelector.src") // exports option_selector
import_code("/home/me/h/src/machine.src") // exports Machine, MachineService, depends on Scan, Nmap , Json, rnd_ip
import_code("/home/me/h/src/shell.src") // extend map
TABLEATTACK_SCRIPT = get_shell.host_computer.File(home_dir + "/Config/tableAttack.src")
EMPTY_LOG_PATH = home_dir + "/Config/emptyLog"
PASSWORDS_DISK = new Disk
PASSWORDS_DISK.init(home_dir + "/Config", "passwords")
EXPLOITS_DISK = new Disk
EXPLOITS_DISK.init(home_dir + "/Config", "exploits")
ENTRIES_DISK = new Disk
ENTRIES_DISK.init(home_dir + "/Config", "entries")
Machine.metaxploit = include_lib("/lib/metaxploit.so")
Scan.metaxploit = include_lib("/lib/metaxploit.so")
get_shell.host_computer.touch(home_dir + "/Config", "sites.txt")
SITES_FILE = get_shell.host_computer.File(home_dir + "/Config/sites.txt")
Command = {}
Command.academicMissions_sig = {}
Command.academicMissions_sig["description"] = "Reads your email to find academic missions and format them"
Command.academicMissions_sig["args"] = ["email*", "password*"]
Command.academicMissions_sig["options"] = []
Command.academicMissions = function(args = [], options = {})
inbox = new Inbox
inbox.init(args[0], args[1])
for m in inbox.list
p m
p m.is_mission
p m.mission_type
p m.is_mission_complete
p m.mission_info
end for
end function
import_code("/home/me/h/libs/thor.src") //depends on Listlib, exports Thor
Thor.init(Command, "academicMissions")
src/mail.src
Mail = {}
Mail.attrs = ["id", "from", "subject"]
Mail.init = function(inbox, str)
self.inbox = inbox
self.meta_mail = inbox.meta_mail
self.id = str[str.indexOf("MailID: "):][8:].split(char(10))[0]
self.from = str[str.indexOf("From: "):][6:].split(char(10))[0]
self.subject = str[str.indexOf("Subject: "):][9:].split(char(10))[0]
self.content = self.meta_mail.read(self.id)
self.content = self.content[self.content.indexOf("Subject: "):].split(char(10))[1:].join(char(10))
end function
Mail.is_mission = function
return self.subject == "Mission Contract"
end function
Mail.mission_type = function
if self.is_mission == false then return null
if self.content.indexOf("academic record") then
return "academic_record"
end if
end function
Mail.is_mission_complete = function
if self.is_mission == false then return null
if self.content.indexOf("customer is satisfied") then
return true
end if
return false
end function
Mail.mission_info = function
if self.is_mission == false then return null
// code smell
if self.mission_type == "academic_record" then
return self.get_academic_record_mission_info
end if
end function
Mail.get_academic_record_mission_info = function
info = {}
info.remote_ip = self.content[self.content.indexOf("remote ip of the victim is"):][27:].split(char(10))[0][3:-4]
info.database_ip = self.content[self.content.indexOf("database is located is"):][23:].split(char(10))[0][3:-4]
info.student = self.content[self.content.indexOf("modify belongs to"):][19:].split(char(10))[0][3:-5]
info.subject = self.content[self.content.indexOf("modify the subject"):][19:].split(" ")[0][3:-4]
return info
end function
Inbox = {}
Inbox.init = function(email, password)
self.meta_mail = mail_login(email, password)
if self.meta_mail isa string then exit(self.meta_mail)
end function
Inbox.list = function
mails = self.meta_mail.fetch()
for i in mails.indexes
m = new Mail
m.init(self, mails[i])
mails[i] = m
end for
return mails
end function