def export_loot(): """Export all loot entries""" lootbox = get_loot() loot = [{ "id": l.id, "lsass": get_lsass_goodies(l.lsass), "hive": get_hive_goodies(l.hive), "sysinfo": parse_sysinfo(l.sysinfo, ) } for l in lootbox] return jsonify(loot)
def test_get_loot(backend): from powerhub import sql loot_count = len(sql.get_loot()) out = execute_cmd(backend('Get-Loot')) assert "At line:" not in out # "At line:" means PS error # for i in range(60): # time.sleep(1) # loot = sql.get_loot() # if (loot and loot[0].lsass and loot[0].hive and loot[0].sysinfo): # break # assert i < 59 loot = sql.get_loot() assert loot_count + 1 == len(loot) loot = loot[-1] assert "Administrator" in loot.hive assert "500" in loot.hive assert "Microsoft Windows" in loot.sysinfo assert "isadmin" in loot.sysinfo assert "session_id" in loot.lsass
def loot_tab(): # turn sqlalchemy object 'lootbox' into dict/array lootbox = get_loot() loot = [{ "nonpersistent": db is None, "id": l.id, "lsass": get_lsass_goodies(l.lsass), "lsass_full": l.lsass, "hive": get_hive_goodies(l.hive), "hive_full": l.hive, "sysinfo": parse_sysinfo(l.sysinfo, ) } for l in lootbox] context = { "loot": loot, "AUTH": args.AUTH, "VERSION": __version__, } return render_template("loot.html", **context)