diff --git a/database.py b/database.py index a802630..9df50f5 100644 --- a/database.py +++ b/database.py @@ -1,6 +1,6 @@ import logging import binascii,os,json,datetime,shutil,base64 -from datetime import date +from datetime import date,datetime,timedelta from lib.toolbox import bcolors @@ -76,15 +76,16 @@ class reporting: - MySeatBelt - Result for %s + DonPapi - Result for %s - \n""" % ('res/style.css', "[client_name]") + + \n""" % ('res/style.css', "[client_name]") self.add_to_resultpage(data) # Tableau en top de page pour les liens ? data = """\n""" data = """\n""" data += f""" {menu.upper()}\n""" @@ -95,7 +96,7 @@ class reporting: data = """
\n""" data += """
Menu
\n""" - data += """\n""" % '[client_name]'.upper() + data += """
\n""" data += """

\n""" % date.today().strftime("%d/%m/%Y") data += """""" % os.path.join('res','Logo_LOGIN.PNG') @@ -128,13 +129,29 @@ class reporting: } } } + + function toggleAll() { + toggle_it("cookies"); + toggle_it("wifi"); + toggle_it("taskscheduler"); + toggle_it("credential-blob"); + toggle_it("browser-internet_explorer"); + toggle_it("browser-firefox"); + toggle_it("browser-chrome"); + toggle_it("SAM"); + toggle_it("LSA"); + toggle_it("DCC2"); + toggle_it("VNC"); + toggle_it("MRemoteNG"); + } """ self.add_to_resultpage(data) results = self.get_credz() - data = """
+ data = """
Username
+ @@ -147,7 +164,8 @@ class reporting: cred_id, file_path, username, password, target, type, pillaged_from_computerid, pillaged_from_userid = cred if type != current_type: current_type=type - data += f"""""" + current_type_count=self.get_credz_count(current_type)[0][0] + data += f"""""" #Skip infos of @@ -233,6 +251,72 @@ class reporting: data += """
Username Password Target Type
{current_type}
{current_type} ({current_type_count})

""" self.add_to_resultpage(data) ### + ##### List cookies + results = self.get_cookies() + + data = """ + + + + + + \n""" + + # + current_type = 'cookies' + data += f"""""" + for index, cred in enumerate(results): + name,value,expires_utc,target,type,pillaged_from_computerid,pillaged_from_userid = cred + # Skip infos of + # Get computer infos + res = self.get_computer_infos(pillaged_from_computerid) + for index_, res2 in enumerate(res): + ip, hostname = res2 + computer_info = f"{ip} | {hostname}" + # pillaged_from_userid + if pillaged_from_userid != None: + res = self.get_user_infos(pillaged_from_userid) + for index_, pillaged_username in enumerate(res): + pillaged_from_userid = pillaged_username[0] + else: + pillaged_from_userid = str(pillaged_from_userid) + + if index % 2 == 0: + data += f"""""" + else: + data += f"""""" + + special_style = "" + + ###Print block + for info in [name,value]: + data += f"""""" + for info in [expires_utc]: + data += f"""""" + + # check if info contains a URL + if 'http:' in target or 'https:' in target: + info2 = target[target.index('http'):] + special_ref = f'''href="{info2}" target="_blank" title="{target}"''' + elif 'ftp:' in target: + info2 = target[target.index('ftp'):] + special_ref = f'''href="{info2}" target="_blank" title="{target}"''' + elif "Domain:target=" in target: + info2 = f'''rdp://full%20address=s:{target[target.index('Domain:target=') + len('Domain:target='):]}:3389&username=s:{username}&audiomode=i:2&disable%20themes=i:1''' + special_ref = f'''href="{info2}" title="{target}"''' + elif "LegacyGeneric:target=MicrosoftOffice1" in target: + target = f'''{target[target.index('LegacyGeneric:target=') + len('LegacyGeneric:target='):]}''' + special_ref = f'''href="https://login.microsoftonline.com/" target="_blank" title="OfficeLogin"''' + else: + special_ref = f'''title="{target}"''' + data += f"""""" + + for info in [type, computer_info, pillaged_from_userid]: + data += f"""""" + data += """\n""" + + data += """
NameValueUntilTargetPillaged_from_computeridPillaged_from_userid
Cookies ({len(results)})
{str(info)[:48]} {(datetime(1601, 1, 1) + timedelta(microseconds=info)).strftime('%b %d %Y %H:%M:%S')} {str(target)[:48]} {str(info)[:48]}

""" + self.add_to_resultpage(data) ##### List gathered files results = self.get_file() @@ -445,6 +529,13 @@ class reporting: self.logging.debug(ex) self.logging.debug(f"Export Done!") + def get_credz_count(self,current_type): + with self.conn: + cur = self.conn.cursor() + cur.execute(f"SELECT count(id) FROM credz WHERE LOWER(type)=LOWER('{current_type}')") + results = cur.fetchall() + return results + def get_credz(self, filterTerm=None, credz_type=None): """ Return credentials from the database. @@ -543,6 +634,12 @@ class reporting: results = cur.fetchall() return results + def get_cookies(self): + with self.conn: + cur = self.conn.cursor() + cur.execute(f"SELECT name,value,expires_utc,target,type,pillaged_from_computerid,pillaged_from_userid FROM cookies ORDER BY pillaged_from_computerid ASC, expires_utc DESC ") + results = cur.fetchall() + return results class database: def __init__(self, conn,logger):