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/missions.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")
get_import_paths = function(code)
lines = code.split(char(10))
r = []
for l in lines
if l.indexOf("import_code" + "(""") != null then r.push(l.split("""")[1])
end for
return r
end function
check_sum_source = function(code)
comp = get_shell.host_computer
codes = [code]
for s in get_import_paths(code)
codes.push comp.File(s).get_content
end for
return md5(codes.join(""))
end function
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"
comp.create_folder(home_dir, "vegaTools")
while true
comp.touch(home_dir, ".vega_watch")
watch_file = comp.File(home_dir + "/.vega_watch")
comp.touch(home_dir, ".vega_watch")
watch_file = comp.File(home_dir + "/.vega_watch")
watch_data = {}
f = function(o)
return o.split("=")
end function
if watch_file.get_content.len > 1 then watch_data = watch_file.get_content.split(char(10)).map(@f).to_map
watch_data = {}
f = function(o)
return o.split("=")
end function
if watch_file.get_content.len > 1 then watch_data = watch_file.get_content.split(char(10)).map(@f).to_map
for f in comp.File("/home/me/h/cli").get_files
if watch_data.hasIndex(f.name) == false then watch_data[f.name] =
md5
(f.get_content)
for f in comp.File("/home/me/h/cli").get_files
if watch_data.hasIndex(f.name) == false then watch_data[f.name] =
check_sum_source
(f.get_content)
compiled_script = comp.File(home_dir + "/vegaTools/" + f.name[:-4])
compiled_script = comp.File(home_dir + "/vegaTools/" + f.name[:-4])
if watch_data[f.name] !=
md5
(f.get_content) or compiled_script == null then
print "compiling " + f.name
f.copy(home_dir + "/vegaTools", f.name)
b = get_shell.build(home_dir + "/vegaTools/" + f.name, home_dir + "/vegaTools")
if b.len > 0 then print(f.name + " error: <color=red>" + b + "</color>")
comp.File(home_dir + "/vegaTools/" + f.name).delete
watch_data[f.name] =
md5
(f.get_content)
end if
end for
f = function(o)
return o[0] + "=" + o[1]
end function
watch_file.set_content watch_data.to_list.map(@f).join(char(10))
if watch_data[f.name] !=
check_sum_source
(f.get_content) or compiled_script == null then
print "compiling " + f.name
f.copy(home_dir + "/vegaTools", f.name)
b = get_shell.build(home_dir + "/vegaTools/" + f.name, home_dir + "/vegaTools")
if b.len > 0 then print(f.name + " error: <color=red>" + b + "</color>")
comp.File(home_dir + "/vegaTools/" + f.name).delete
watch_data[f.name] =
check_sum_source
(f.get_content)
end if
end for
f = function(o)
return o[0] + "=" + o[1]
end function
watch_file.set_content watch_data.to_list.map(@f).join(char(10))
if params.hasIndex(0) == false or params[0] != "-w" then break
end while
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/missions.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, Mission, depends on list utils
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.missions_sig = {}
Command.missions_sig["description"] = "Reads your email to find academic missions and format them"
Command.missions_sig["args"] = ["email*", "password*"]
Command.missions_sig["options"] = [{["-s", "--delete-skip"]: "deletes missions with skip marked as true"}]
Command.missions_sig["options"].push {["-d", "--delete-completed"]: "deletes completed missions"}
Command.missions = function(args = [], options = {})
inbox = new Inbox
inbox.init(args[0], args[1])
if options["-d"] == true then
for m in inbox.missions
if m.is_completed == true then
m.meta_mail.delete(m.mail.id)
end if
end for
end if
missions_group = inbox.grouped_missions
for key in missions_group.indexes
print "===================<b>" + key + "</b>====================="
for mission in missions_group[key]
if mission.info.skip == true and options["-s"] == true then
mission.meta_mail.delete(mission.mail.id)
continue
end if
print "---------------------------"
for o in mission.info
print o.key + ": " + o.value
end for
end for
end for
end function
import_code("/home/me/h/libs/thor.src") //depends on Listlib, exports Thor
Thor.init(Command, "missions")
src/mail.src
Mission = {}
// type : enum [academic_record]
// is_completed : boolean
// info : map
Mission.attrs = ["type", "is_completed"]
Mission.init = function(mail)
self.mail = mail
self.inbox = mail.inbox
self.meta_mail = mail.inbox.meta_mail
self.is_completed = false
if self.mail.content.indexOf("customer is satisfied") then
self.is_completed = true
end if
self.set_type
end function
Mission.set_type = function
// also code sme
ll
if self.mail.content.indexOf(
"academic
record"
) then
self.type
= "
academic
_record"
else i
f self.mail.content.indexOf(
"police record")
then
self.type =
"police_record"
end if
self.type = nu
ll
key_words = {}
key_words["academic record"] =
"academic
_
record"
key_words["police record"]
= "
police
_record"
key_words["login credentials"] = "login_credentials"
for i in key_words.indexes
i
f self.mail.content.indexOf(
i)
then
self.type =
key_words[i]
end if
end for
end function
Mission.info = function
// code smell
if self.type == "academic_record" then
return self.get_academic_record_info
else if self.type == "police_record" then
return self.get_police_record_info
else if self.type == "login_credentials" then
return self.get_login_credentials_info
end if
end function
Mission.get_academic_record_info = function
info = {}
info.remote_ip = self.mail.content[self.mail.content.indexOf("remote ip of the victim is"):][27:].split(char(10))[0][3:-4]
info.database_ip = self.mail.content[self.mail.content.indexOf("database is located is"):][23:].split(char(10))[0][3:-4]
info.student = self.mail.content[self.mail.content.indexOf("modify belongs to"):][19:].split(char(10))[0][3:-5]
info.subject = self.mail.content[self.mail.content.indexOf("modify the subject"):][19:].split(" ")[0][3:-4]
info.skip = false
info.database_port = null
router = get_router(info.remote_ip)
for port in router.used_ports
if router.port_info(port).indexOf("students") != null then
info.database_port = port.port_number
if port.is_closed == true then
info.skip = true
end if
end if
end for
if info.database_port == null then
info.skip = true
end if
return info
end function
Mission.get_police_record_info = function
info = {}
info.remote_ip = self.mail.content[self.mail.content.indexOf("remote ip of the victim is"):][27:].split(char(10))[0][3:-4]
info.convicted = self.mail.content[self.mail.content.indexOf("modify belongs to"):][19:].split(char(10))[0][3:-5]
info.skip = false
info.database_port = null
if self.mail.content.indexOf("client wants to delete the charge") then
info.type = "delete"
info.charge = self.mail.content[self.mail.content.indexOf("delete the charge of"):][21:].split(" ")[0][3:-5]
else if self.mail.content.indexOf("client wants to add the charge") then
info.type = "add"
info.charge = self.mail.content[self.mail.content.indexOf("add the charge of"):][18:].split(" ")[0][3:-4]
info.year = self.mail.content[self.mail.content.indexOf("in the year"):][12:].split(" ")[0][:-1]
else
info.type = "edit"
info.charge = self.mail.content[self.mail.content.indexOf("modify the charge of"):][21:].split(" ")[0][3:-4]
info.change = self.mail.content[self.mail.content.indexOf("date of the crime is"):][21:].split(char(10))[0]
end if
router = get_router(info.remote_ip)
for port in router.used_ports
if router.port_info(port).indexOf("criminals") != null then
info.database_port = port.port_number
if port.is_closed == true then
info.skip = true
end if
end if
end for
if info.database_port == null then
info.skip = true
end if
return info
end function
Mission.get_login_credentials_info = function
info = {}
info.skip = false
info.remote_ip = self.mail.content[self.mail.content.indexOf("remote ip of the victim is"):][27:].split(" ")[0][3:-5]
info.lan_ip = self.mail.content[self.mail.content.indexOf("ip LAN is"):][10:].split(char(10))[0][3:-4]
info.admin_email = whois(info.remote_ip).split(char(10))[2].split(":")[1][1:]
if self.mail.content.indexOf("login credentials of any user") then
info.user = "any"
info.skip = true
else
info.user = self.mail.content[self.mail.content.indexOf("of the user"):][12:].split(char(10))[0][3:-5]
end if
return info
end function
Mail = {}
// id : string
// from : string
// subject : string
// content : string
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))
if self.is_mission == true then
self.mission = new Mission
self.mission.init(self)
end if
end function
Mail.is_mission = function
return self.subject == "Mission Contract"
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
Inbox.missions = function
f = function(o)
return o.is_mission == true
return o.is_mission == true
and o.mission.type != null
end function
missions = self.list.select(@f)
f = function(o)
return o.mission
end function
missions = missions.map(@f)
f = function(o)
return o.type
end function
missions = missions.lsort(@f)
return missions
end function
Inbox.grouped_missions = function()
missions = {}
for m in self.missions
if missions.hasIndex(m.type) == false then
missions[m.type] = []
end if
missions[m.type].push m
end for
return missions
end function