def housekeeping(self, mm): for team in mm.teams: shells = team.root_shells + team.user_shells + team.unpriv_shells db.insert('access_log', ['cycle', 'team_id', 'shells'], (str(mm.cycles), str(team.id), str(shells))) for job in mm.jobs: pass
def __init__(self, mod_name, mod_os, mod_flavor, mod_type, mod_lang, mod_destructive, mod_scannable, mod_difficulty, mod_priv_required): db.insert('modules', [ 'name', 'os', 'flavor', 'mod_type', 'mod_lang', 'destructive', 'scannable', 'difficulty', 'priv_required' ], (mod_name, mod_os, mod_flavor, mod_type, mod_lang, mod_destructive, mod_scannable, mod_difficulty, mod_priv_required))
def __init__(self, v_id, v_sys_id, mod_name, mod_info, access=""): self.system_id = int(v_sys_id) self.mod_name = mod_name self.mod_info = ast.literal_eval(mod_info) self.access = access if not v_id == "new": self.id = int(v_id) else: store_mod_info = '\"' + str(self.mod_info) + '\"' db.insert('vulns', ['system_id', 'mod_name', 'mod_info'], \ (self.system_id, self.mod_name, store_mod_info)) self.id = db.get( 'vulns', ['id'], where="system_id=%s and mod_name=%s and mod_info=%s", args=(self.system_id, self.mod_name, store_mod_info))[0][0]
def __init__(self, team_id, team_name, team_ip, team_difficulty): self.name = team_name self.ip = team_ip self.difficulty = int(team_difficulty) self.root_shells = 0 self.user_shells = 0 self.unpriv_shells = 0 self.systems = [] if not team_id == "new": self.id = int(team_id) else: db.insert('teams', ['name', 'ip', 'difficulty'], (self.name, self.ip, self.difficulty)) self.id = db.get('teams', ['id'], where="name=%s and ip=%s", args=(self.name, self.ip))[0][0]
def __init__(self, sys_id, sys_num, sys_status, sys_name, sys_team_id, sys_ip, sys_os, sys_flavor, sys_vulns=()): self.num = int(sys_num) self.status = sys_status self.name = sys_name self.team_id = int(sys_team_id) self.ip = sys_ip self.last_octet = self.ip.split('.')[3] self.os = sys_os self.flavor = sys_flavor self.root_shells = 0 self.user_shells = 0 self.unpriv_shells = 0 self.access = 0 self.vulns = [] if not sys_id == "new": self.id = int(sys_id) else: db.insert( 'systems', ['num', 'status', 'name', 'team_id', 'ip', 'os', 'flavor'], (sys_num, self.status, self.name, self.team_id, str( self.ip), self.os, self.flavor)) self.id = db.get('systems', ['id'], where="num=%s and team_id=%s", args=(self.num, self.team_id))[0][0] # [0][0] for vuln in sys_vulns: self.vulns.append(Vuln("new", self.id, vuln[0], vuln[1]))