Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
files=files,
timeout=self._session.timeout
)
else:
response = self._session.requests.request(
method,
path,
data=params,
headers=headers,
files=files,
timeout=self._session.timeout
)
if self._enable_debug_logger:
import curlify
print(curlify.to_curl(response.request))
fb_response = FacebookResponse(
body=response.text,
headers=response.headers,
http_status=response.status_code,
call={
'method': method,
'path': path,
'params': params,
'headers': headers,
'files': files,
},
)
if fb_response.is_failure():
raise fb_response.error()
def __show_curl(self, response_object):
"""Render an HTTP request as a cURL to STDERR
"""
if self.show_curl:
try:
curl_text = curlify.to_curl(response_object.request)
except Exception as err:
curl_text = 'Failed to render curl command: {0}'.format(err)
print_stderr(curl_text)
lon = location["kismet.common.location.avg_loc"]["kismet.common.location.lon"]
last_results.append(DeviceGPS(pair["kismet.device.base.macaddr"].upper(), pair["kismet.device.base.name"], (lat,lon), now))
else:
_LOGGER.debug("["+self.server+"] "+"Couldn't find GPS Coordinates in result..")
_LOGGER.debug("["+self.server+"] "+"Try to reproduce with: "+curlify.to_curl(r.request))
last_results.append(Device(pair["kismet.device.base.macaddr"].upper(), pair["kismet.device.base.name"], now))
else:
if r.text == "[]":
_LOGGER.debug(f"[{self.server}] Nobody in range...")
else:
_LOGGER.error(f"[{self.server}] Got an error in the kismet reply: {r.text}")
_LOGGER.debug(f"[{self.server}] Try to reproduce with: "+curlify.to_curl(r.request))
else:
_LOGGER.error(f"[{self.server}] Got an error in the kismet query. Error code {r.status_code}, reply text {r.text}")
_LOGGER.debug(f"[{self.server}] Try to reproduce with: "+curlify.to_curl(r.request))
except requests.exceptions.ConnectionError:
_LOGGER.error("["+self.server+"] "+"Error connecting to kismet instance")
self.last_results = last_results
_LOGGER.debug("["+self.server+"] "+"Kismet scan finished")
return True
lon = 0.0
if "kismet.common.location.avg_loc" in location:
lat = location["kismet.common.location.avg_loc"]["kismet.common.location.lat"]
lon = location["kismet.common.location.avg_loc"]["kismet.common.location.lon"]
last_results.append(DeviceGPS(pair["kismet.device.base.macaddr"].upper(), pair["kismet.device.base.name"], (lat,lon), now))
else:
_LOGGER.debug("["+self.server+"] "+"Couldn't find GPS Coordinates in result..")
_LOGGER.debug("["+self.server+"] "+"Try to reproduce with: "+curlify.to_curl(r.request))
last_results.append(Device(pair["kismet.device.base.macaddr"].upper(), pair["kismet.device.base.name"], now))
else:
if r.text == "[]":
_LOGGER.debug(f"[{self.server}] Nobody in range...")
else:
_LOGGER.error(f"[{self.server}] Got an error in the kismet reply: {r.text}")
_LOGGER.debug(f"[{self.server}] Try to reproduce with: "+curlify.to_curl(r.request))
else:
_LOGGER.error(f"[{self.server}] Got an error in the kismet query. Error code {r.status_code}, reply text {r.text}")
_LOGGER.debug(f"[{self.server}] Try to reproduce with: "+curlify.to_curl(r.request))
except requests.exceptions.ConnectionError:
_LOGGER.error("["+self.server+"] "+"Error connecting to kismet instance")
self.last_results = last_results
_LOGGER.debug("["+self.server+"] "+"Kismet scan finished")
return True
location = pair["dot11.advertisedssid.location"]
if location and "kismet.common.location.loc_valid" in location and location["kismet.common.location.loc_valid"] == 1:
# instead of delving further into the structure, we use the integer coordinates
#lat = location["kismet.common.location.avg_lat"] * .000001
#lon = location["kismet.common.location.avg_lon"] * .000001
lat = 0.0
lon = 0.0
if "kismet.common.location.avg_loc" in location:
lat = location["kismet.common.location.avg_loc"]["kismet.common.location.lat"]
lon = location["kismet.common.location.avg_loc"]["kismet.common.location.lon"]
last_results.append(DeviceGPS(pair["kismet.device.base.macaddr"].upper(), pair["kismet.device.base.name"], (lat,lon), now))
else:
_LOGGER.debug("["+self.server+"] "+"Couldn't find GPS Coordinates in result..")
_LOGGER.debug("["+self.server+"] "+"Try to reproduce with: "+curlify.to_curl(r.request))
last_results.append(Device(pair["kismet.device.base.macaddr"].upper(), pair["kismet.device.base.name"], now))
else:
if r.text == "[]":
_LOGGER.debug(f"[{self.server}] Nobody in range...")
else:
_LOGGER.error(f"[{self.server}] Got an error in the kismet reply: {r.text}")
_LOGGER.debug(f"[{self.server}] Try to reproduce with: "+curlify.to_curl(r.request))
else:
_LOGGER.error(f"[{self.server}] Got an error in the kismet query. Error code {r.status_code}, reply text {r.text}")
_LOGGER.debug(f"[{self.server}] Try to reproduce with: "+curlify.to_curl(r.request))
except requests.exceptions.ConnectionError:
_LOGGER.error("["+self.server+"] "+"Error connecting to kismet instance")
self.last_results = last_results
files=files,
timeout=self._session.timeout
)
else:
response = self._session.requests.request(
method,
path,
data=params,
headers=headers,
files=files,
timeout=self._session.timeout
)
if self._enable_debug_logger:
import curlify
print(curlify.to_curl(response.request))
fb_response = FacebookResponse(
body=response.text,
headers=response.headers,
http_status=response.status_code,
call={
'method': method,
'path': path,
'params': params,
'headers': headers,
'files': files,
},
)
if fb_response.is_failure():
raise fb_response.error()
files=files,
timeout=self._session.timeout
)
else:
response = self._session.requests.request(
method,
path,
data=params,
headers=headers,
files=files,
timeout=self._session.timeout
)
if self._enable_debug_logger:
import curlify
print(curlify.to_curl(response.request))
fb_response = FacebookResponse(
body=response.text,
headers=response.headers,
http_status=response.status_code,
call={
'method': method,
'path': path,
'params': params,
'headers': headers,
'files': files,
},
)
if fb_response.is_failure():
raise fb_response.error()