Posting file via cURL
Has anyone had any success with uploading a file using cURL? I figure I would have to login and get the cookie, then use that to post the file in another cURL request.
EDIT:
After a bit of trial and error, I was able to successfully get this accomplished. And with the new site design, the URL has changed
curl --cookie "auth=COOKIE_DATA_FROM_YOUR_BROWSER" --form stumblefile=@FILENAME --form Send=Send --form observer=YOUR_USERNAME https://wigle.net/upload
As long as the cookie isn't set to expire, you should be able to add this to any bash script or whatever to automatically upload your files.
EDIT:
After a bit of trial and error, I was able to successfully get this accomplished. And with the new site design, the URL has changed
curl --cookie "auth=COOKIE_DATA_FROM_YOUR_BROWSER" --form stumblefile=@FILENAME --form Send=Send --form observer=YOUR_USERNAME https://wigle.net/upload
As long as the cookie isn't set to expire, you should be able to add this to any bash script or whatever to automatically upload your files.
Just managed to do it like this:
Code: Select all
curl -F observer=MYUSERNAME -F password=MYPASSWORD -F stumblefile=@./Kismet-20160301-22-30-03-1.gpsxml.gz -F Send=Send https://wigle.net/gps/gps/main/confirmfile/
Currently that works but it may not in the future as at the top of the site your posting to it says "NOTE: this version of the site is slated for deactivation!"Just managed to do it like this:Code: Select all
curl -F observer=MYUSERNAME -F password=MYPASSWORD -F stumblefile=@./Kismet-20160301-22-30-03-1.gpsxml.gz -F Send=Send https://wigle.net/gps/gps/main/confirmfile/
This message has been there for ages.
Since the old API is now gone, here's how to post a file using the new one via curl:
Just replace the file name with the file you are going to upload and the auth token with the one visible in the sample curl field here:
https://wigle.net/account
Or you can skip the token part and just upload the file anonymously.
Code: Select all
curl -i -H 'Accept:application/json' -u <token> --basic -F file=@./<filename> -F donate=true https://api.wigle.net/api/v2/file/upload
https://wigle.net/account
Or you can skip the token part and just upload the file anonymously.
I tried that and I get the following:Since the old API is now gone, here's how to post a file using the new one via curl:
Code: Select all
curl -i -H 'Accept:application/json' -u <token> --basic -F file=@./<filename> -F donate=true https://api.wigle.net/api/v2/file/upload
Code: Select all
HTTP/1.1 200 OK
Server: nginx/1.16.1
Date: Mon, 01 Jun 2020 21:13:22 GMT
Content-Type: application/json
Content-Length: 83
Connection: keep-alive
Strict-Transport-Security: max-age=63072000; includeSubdomains; preload
{"success":false,"message":"File upload failed; an original file name is required"}
What file did you try to upload?
It was a CSV file from the kismetdb_to_wiglecsv command.What file did you try to upload?
I omitted the @ symbol and used the full path for the file option.
You need the @ symbol even with full path.
You need the @ symbol even with full path.
Code: Select all
curl -i -H Accept:application/json -u <api name>:<api token> --basic -F file=@/home/hal/.kismet/logs/active/Kismet-20220715-08-06-07-1.wiglecsv -F donate=true https://api.wigle.net/api/v2/file/upload
HTTP/1.1 400 Bad Request
Server: nginx/1.20.0
Date: Fri, 15 Jul 2022 08:43:48 GMT
Content-Type: application/json
Content-Length: 45
Connection: keep-alive
{"code":400,"message":"HTTP 400 Bad Request"}
NVM that worked... must have been a network issue.
Return to “Net Hugging Hardware and Software”
Who is online
Users browsing this forum: No registered users and 4 guests