From 6624e3a8e0292c7cf1415bd0bda07d61218dd767 Mon Sep 17 00:00:00 2001 From: Shion Ichikawa Date: Mon, 22 Jan 2024 01:23:30 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20for=20#482,=20making=20Per?= =?UTF-8?q?son.profilePhotos=20dict[str,=20list(PersonPhoto)]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ghunt/modules/email.py | 17 +++++++++-------- ghunt/modules/gaia.py | 17 +++++++++-------- ghunt/parsers/people.py | 6 ++++-- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/ghunt/modules/email.py b/ghunt/modules/email.py index de7b7306..c6b43885 100644 --- a/ghunt/modules/email.py +++ b/ghunt/modules/email.py @@ -46,14 +46,15 @@ async def hunt(as_client: httpx.AsyncClient, email_address: str, json_file: bool print(f"Name : {target.names[container].fullname}\n") if container in target.profilePhotos: - if target.profilePhotos[container].isDefault: - print("[-] Default profile picture") - else: - print("[+] Custom profile picture !") - print(f"=> {target.profilePhotos[container].url}") - - await ia.detect_face(vision_api, as_client, target.profilePhotos[container].url) - print() + for photo in target.profilePhotos[container]: + if photo.isDefault: + print("[-] Default profile picture") + print(f"=> {photo.url}") + else: + print("[+] Custom profile picture !") + print(f"=> {photo.url}") + await ia.detect_face(vision_api, as_client, photo.url) + print() if container in target.coverPhotos: if target.coverPhotos[container].isDefault: diff --git a/ghunt/modules/gaia.py b/ghunt/modules/gaia.py index b56e1e04..fe6e410b 100644 --- a/ghunt/modules/gaia.py +++ b/ghunt/modules/gaia.py @@ -46,14 +46,15 @@ async def hunt(as_client: httpx.AsyncClient, gaia_id: str, json_file: bool=None) print(f"Name : {target.names[container].fullname}\n") if container in target.profilePhotos: - if target.profilePhotos[container].isDefault: - print("[-] Default profile picture") - else: - print("[+] Custom profile picture !") - print(f"=> {target.profilePhotos[container].url}") - - await ia.detect_face(vision_api, as_client, target.profilePhotos[container].url) - print() + for photo in target.profilePhotos[container]: + if photo.isDefault: + print("[-] Default profile picture") + print(f"=> {photo.url}") + else: + print("[+] Custom profile picture !") + print(f"=> {photo.url}") + await ia.detect_face(vision_api, as_client, photo.url) + print() if container in target.coverPhotos: if target.coverPhotos[container].isDefault: diff --git a/ghunt/parsers/people.py b/ghunt/parsers/people.py index 4f83dcea..ed0ceabf 100644 --- a/ghunt/parsers/people.py +++ b/ghunt/parsers/people.py @@ -119,7 +119,7 @@ def __init__(self): self.emails: Dict[str, PersonEmail] = PersonContainers() self.names: Dict[str, PersonName] = PersonContainers() self.profileInfos: Dict[str, PersonProfileInfo] = PersonContainers() - self.profilePhotos: Dict[str, PersonPhoto] = PersonContainers() + self.profilePhotos: Dict[str, list[PersonPhoto]] = PersonContainers() self.coverPhotos: Dict[str, PersonPhoto] = PersonContainers() self.inAppReachability: Dict[str, PersonInAppReachability] = PersonContainers() self.extendedData: PersonExtendedData = PersonExtendedData() @@ -148,7 +148,9 @@ async def _scrape(self, as_client: httpx.AsyncClient, person_data: Dict[str, any for photo_data in person_data["photo"]: person_photo = PersonPhoto() await person_photo._scrape(as_client, photo_data, "profile_photo") - self.profilePhotos[profile_data["metadata"]["container"]] = person_photo + if not self.profilePhotos.get(profile_data["metadata"]["container"]): + self.profilePhotos[profile_data["metadata"]["container"]] = [] + self.profilePhotos[profile_data["metadata"]["container"]].append(person_photo) if (source_ids := person_data.get("metadata", {}).get("identityInfo", {}).get("sourceIds")): for source_ids_data in source_ids: