1+ import os
2+
13from ghunt import globals as gb
24from ghunt .objects .base import GHuntCreds
35from ghunt .apis .peoplepa import PeoplePaHttp
@@ -16,108 +18,108 @@ async def hunt(as_client: httpx.AsyncClient, gaia_id: str, json_file: Path=None)
1618 if not as_client :
1719 as_client = get_httpx_client ()
1820
19- # ghunt_creds = await auth.load_and_auth(as_client)
21+ ghunt_creds = await auth .load_and_auth (as_client )
2022
2123 # #gb.rc.print("\n[+] Target found !", style="spring_green3")
2224
23- # people_pa = PeoplePaHttp(ghunt_creds)
25+ people_pa = PeoplePaHttp (ghunt_creds )
2426 # # vision_api = VisionHttp(ghunt_creds)
25- # is_found, target = await people_pa.people(as_client, gaia_id, params_template="max_details")
26- # if not is_found:
27- # exit("[-] The target wasn't found.")
27+ is_found , target = await people_pa .people (as_client , gaia_id , params_template = "max_details" )
28+ if not is_found :
29+ exit ("[-] The target wasn't found." )
2830
29- # if json_file:
30- # json_results = {}
31+ if json_file :
32+ json_results = {}
3133
32- # containers = target.sourceIds
34+ containers = target .sourceIds
3335
34- # if len(containers) > 1 or not "PROFILE" in containers:
35- # print("[!] You have this person in these containers :")
36- # for container in containers:
37- # print(f"- {container.title()}")
36+ if len (containers ) > 1 or not "PROFILE" in containers :
37+ print ("[!] You have this person in these containers :" )
38+ for container in containers :
39+ print (f"- { container .title ()} " )
3840
39- # if not "PROFILE" in containers:
40- # exit("[-] Given information does not match a public Google Account.")
41+ if not "PROFILE" in containers :
42+ exit ("[-] Given information does not match a public Google Account." )
4143
42- # container = "PROFILE"
44+ container = "PROFILE"
4345
44- # gb.rc.print("🙋 Google Account data\n", style="plum2")
46+ gb .rc .print ("🙋 Google Account data\n " , style = "plum2" )
4547
46- # # if container in target.names:
47- # # print(f"Name : {target.names[container].fullname}\n")
48+ # if container in target.names:
49+ # print(f"Name : {target.names[container].fullname}\n")
4850
49- # if container in target.profilePhotos:
50- # if target.profilePhotos[container].isDefault:
51- # print("[-] Default profile picture")
52- # else:
53- # print("[+] Custom profile picture !")
54- # print(f"=> {target.profilePhotos[container].url}")
51+ if container in target .profilePhotos :
52+ if target .profilePhotos [container ].isDefault :
53+ print ("[-] Default profile picture" )
54+ else :
55+ print ("[+] Custom profile picture !" )
56+ print (f"=> { target .profilePhotos [container ].url } " )
5557
5658 # # await ia.detect_face(vision_api, as_client, target.profilePhotos[container].url)
5759 # print()
5860
59- # if container in target.coverPhotos:
60- # if target.coverPhotos[container].isDefault:
61- # print("[-] Default cover picture\n")
62- # else:
63- # print("[+] Custom cover picture !")
64- # print(f"=> {target.coverPhotos[container].url}")
61+ if container in target .coverPhotos :
62+ if target .coverPhotos [container ].isDefault :
63+ print ("[-] Default cover picture\n " )
64+ else :
65+ print ("[+] Custom cover picture !" )
66+ print (f"=> { target .coverPhotos [container ].url } " )
6567
6668 # # await ia.detect_face(vision_api, as_client, target.coverPhotos[container].url)
67- # print()
69+ print ()
6870
69- # print(f"Last profile edit : {target.sourceIds[container].lastUpdated.strftime('%Y/%m/%d %H:%M:%S (UTC)')}\n")
71+ print (f"Last profile edit : { target .sourceIds [container ].lastUpdated .strftime ('%Y/%m/%d %H:%M:%S (UTC)' )} \n " )
7072
71- # print(f"Gaia ID : {target.personId}\n")
73+ print (f"Gaia ID : { target .personId } \n " )
7274
73- # if container in target.profileInfos:
74- # print("User types :")
75- # for user_type in target.profileInfos[container].userTypes:
76- # definition = get_user_type_definition(user_type)
77- # gb.rc.print(f"- {user_type} [italic]({definition})[/italic]")
75+ if container in target .profileInfos :
76+ print ("User types :" )
77+ for user_type in target .profileInfos [container ].userTypes :
78+ definition = get_user_type_definition (user_type )
79+ gb .rc .print (f"- { user_type } [italic]({ definition } )[/italic]" )
7880
79- # gb.rc.print(f"\n📞 Google Chat Extended Data\n", style="light_salmon3")
81+ gb .rc .print (f"\n 📞 Google Chat Extended Data\n " , style = "light_salmon3" )
8082
81- # # print(f"Presence : {target.extendedData.dynamiteData.presence}")
82- # print(f"Entity Type : {target.extendedData.dynamiteData.entityType}")
83- # # print(f"DND State : {target.extendedData.dynamiteData.dndState}")
84- # gb.rc.print(f"Customer ID : {x if (x := target.extendedData.dynamiteData.customerId) else '[italic]Not found.[/italic]'}")
83+ #print(f"Presence : {target.extendedData.dynamiteData.presence}")
84+ print (f"Entity Type : { target .extendedData .dynamiteData .entityType } " )
85+ #print(f"DND State : {target.extendedData.dynamiteData.dndState}")
86+ gb .rc .print (f"Customer ID : { x if (x := target .extendedData .dynamiteData .customerId ) else '[italic]Not found.[/italic]' } " )
8587
86- # gb.rc.print(f"\n🌐 Google Plus Extended Data\n", style="cyan")
88+ gb .rc .print (f"\n 🌐 Google Plus Extended Data\n " , style = "cyan" )
8789
88- # print(f"Entreprise User : {target.extendedData.gplusData.isEntrepriseUser}")
89- # # print(f"Content Restriction : {target.extendedData.gplusData.contentRestriction}")
90+ print (f"Entreprise User : { target .extendedData .gplusData .isEntrepriseUser } " )
91+ #print(f"Content Restriction : {target.extendedData.gplusData.contentRestriction}")
9092
91- # if container in target.inAppReachability:
92- # print("\n[+] Activated Google services :")
93- # for app in target.inAppReachability[container].apps:
94- # print(f"- {app}")
93+ if container in target .inAppReachability :
94+ print ("\n [+] Activated Google services :" )
95+ for app in target .inAppReachability [container ].apps :
96+ print (f"- { app } " )
9597
9698 gb .rc .print ("\n 🗺️ Maps data" , style = "green4" )
9799
98100 err , stats = await gmaps .get_reviews (as_client , gaia_id )
99101 gmaps .output (err , stats , gaia_id )
100102
101- # if json_file:
102- # if container == "PROFILE":
103- # json_results[f"{container}_CONTAINER"] = {
104- # "profile": target,
105- # "maps": {
106- # "photos": photos,
107- # "reviews": reviews,
108- # "stats": stats
109- # }
110- # }
111- # else:
112- # json_results[f"{container}_CONTAINER"] = {
113- # "profile": target
114- # }
103+ if json_file :
104+ if container == "PROFILE" :
105+ json_results [f"{ container } _CONTAINER" ] = {
106+ "profile" : target ,
107+ "maps" : {
108+ # "photos": photos,
109+ # "reviews": reviews,
110+ "stats" : stats
111+ }
112+ }
113+ else :
114+ json_results [f"{ container } _CONTAINER" ] = {
115+ "profile" : target
116+ }
115117
116- # if json_file:
117- # import json
118- # from ghunt.objects.encoders import GHuntEncoder;
119- # with open(json_file, "w", encoding="utf-8") as f:
120- # f.write(json.dumps(json_results, cls=GHuntEncoder, indent=4))
121- # gb.rc.print(f"\n[+] JSON output wrote to {json_file} !", style="italic")
118+ if json_file :
119+ import json
120+ from ghunt .objects .encoders import GHuntEncoder ;
121+ with open (json_file , "w" , encoding = "utf-8" ) as f :
122+ f .write (json .dumps (json_results , cls = GHuntEncoder , indent = 4 ))
123+ gb .rc .print (f"\n [+] JSON output wrote to { json_file } !" , style = "italic" )
122124
123125 await as_client .aclose ()
0 commit comments