Posting file via cURL

The gear needed for wardriving

11 posts • Page 1 of 1

Postby xenoxaos » Tue Apr 08, 2014 9:40 am

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.

Postby strasharo » Wed Mar 02, 2016 10:01 am

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/

Postby ViperVirus » Sun Oct 09, 2016 4:45 pm

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!"

Postby strasharo » Sun Oct 09, 2016 5:32 pm

This message has been there for ages.

Postby strasharo » Tue May 15, 2018 7:07 am

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
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.

Postby Binary_Buddha » Mon Jun 01, 2020 9:17 pm

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
I tried that and I get the following:

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"}
Not entirely sure how it's deriving the file name issue. Any ideas?

Postby strasharo » Sat Jun 06, 2020 9:27 am

What file did you try to upload?

Postby Binary_Buddha » Sat Jun 06, 2020 12:03 pm

What file did you try to upload?
It was a CSV file from the kismetdb_to_wiglecsv command.

I omitted the @ symbol and used the full path for the file option.

Postby strasharo » Sat Jun 06, 2020 12:19 pm

You need the @ symbol even with full path.

Postby Binary_Buddha » Fri Jul 15, 2022 8:46 am

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"}

Postby Binary_Buddha » Sat Jul 16, 2022 4:32 am

NVM that worked... must have been a network issue.

11 posts • Page 1 of 1

Return to “Net Hugging Hardware and Software”

Who is online

Users browsing this forum: No registered users and 6 guests