Skip to content

Commit

Permalink
Set a custom user-agent to hopefully help with uploading.
Browse files Browse the repository at this point in the history
Signed-off-by: Jeroen Oudshoorn <[email protected]>
  • Loading branch information
jayofelony committed Jan 1, 2025
1 parent b132434 commit fc0c72f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
9 changes: 5 additions & 4 deletions pwnagotchi/plugins/default/wigle.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ def _send_to_wigle(lines, api_key, donate=True, timeout=30):

dummy.seek(0)

headers = {'Authorization': f"Basic {api_key}",
'Accept': 'application/json'}
data = {'donate': 'on' if donate else 'false'}
payload = {'file': (pwnagotchi.name() + ".csv", dummy, 'multipart/form-data', {'Expires': '0'})}
headers = {"Authorization": f"Basic {api_key}",
"Accept": "application/json",
"HTTP_USER_AGENT": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1"}
data = {"donate": "on" if donate else "false"}
payload = {"file": (pwnagotchi.name() + ".csv", dummy, "multipart/form-data", {"Expires": "0"})}
try:
res = requests.post('https://api.wigle.net/api/v2/file/upload',
data=data,
Expand Down
9 changes: 6 additions & 3 deletions pwnagotchi/plugins/default/wpa-sec.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@ def _upload_to_wpasec(self, path, timeout=30):
Uploads the file to https://wpa-sec.stanev.org, or another endpoint.
"""
with open(path, 'rb') as file_to_upload:
cookie = {'key': self.options['api_key']}
payload = {'file': file_to_upload}
cookie = {"key": self.options['api_key']}
payload = {"file": file_to_upload,
"multipart/form-data": {"Expires": "0"}}
headers = {"HTTP_USER_AGENT": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1"}
try:
result = requests.post(self.options['api_url'],
cookies=cookie,
files=payload,
headers=headers,
timeout=timeout)
if result.status_code == 200:
if ' already submitted' in result.text:
Expand Down Expand Up @@ -97,7 +100,7 @@ def on_webhook(self, path, request):

def on_internet_available(self, agent):
"""
Called in manual mode when there's internet connectivity
Called when there's internet connectivity
"""
if not self.ready or self.lock.locked():
return
Expand Down

0 comments on commit fc0c72f

Please sign in to comment.