MCPcopy
hub / github.com/mxrch/GHunt / geolocate

Method geolocate

ghunt/apis/geolocation.py:33–67  ·  view source on GitHub ↗
(self, as_client: httpx.AsyncClient, bssid: str, body: dict)

Source from the content-addressed store, hash-verified

31 self._load_api(creds, headers)
32
33 async def geolocate(self, as_client: httpx.AsyncClient, bssid: str, body: dict) -> Tuple[bool, GeolocationResponse]:
34 endpoint_name = inspect.currentframe().f_code.co_name
35
36 verb = "POST"
37 base_url = f"/geolocation/v1/geolocate"
38 data_type = "json" # json, data or None
39
40 if bssid:
41 payload = {
42 "considerIp": False,
43 "wifiAccessPoints": [
44 {
45 "macAddress": "00:25:9c:cf:1c:ad"
46 },
47 {
48 "macAddress": bssid
49 },
50 ]
51 }
52 else:
53 payload = body
54
55 self._load_endpoint(endpoint_name)
56 req = await self._query(as_client, verb, endpoint_name, base_url, None, payload, data_type)
57
58 # Parsing
59 data = json.loads(req.text)
60
61 resp = GeolocationResponse()
62 if "error" in data:
63 return False, resp
64
65 resp._scrape(data)
66
67 return True, resp

Callers 1

mainFunction · 0.95

Calls 4

_scrapeMethod · 0.95
GeolocationResponseClass · 0.90
_load_endpointMethod · 0.80
_queryMethod · 0.80

Tested by

no test coverage detected