# wget to submit form



## mike909 (Apr 9, 2009)

I'm trying to use wget to submit a form. I have tried to dig out what is actually being "posted" and where, using tamperdata (see below).









Here is my wget command:

```
wget --http-user=xyz --http-password=xyz --post-data='submit_button=Filters&change_action=&submit_type=save&action=Apply&blocked_service=&filter_web=&filter_policy=&f_status=0&services_array=53%3A53%3A17%3ADNS%28%26nbsp%3B%290%3A0%3A1%3APing%28%26nbsp%3B%29443%3A443%3A6%3AHTTPS%28%26nbsp%3B%2921%3A21%3A6%3AFTP%28%26nbsp%3B%29110%3A110%3A6%3APOP3%28%26nbsp%3B%29143%3A143%3A6%3AIMAP%28%26nbsp%3B%2925%3A25%3A6%3ASMTP%28%26nbsp%3B%29119%3A119%3A6%3ANNTP%28%26nbsp%3B%2923%3A23%3A6%3ATelnet%28%26nbsp%3B%29161%3A161%3A17%3ASNMP%28%26nbsp%3B%2969%3A69%3A17%3ATFTP%28%26nbsp%3B%29500%3A500%3A17%3AIKE%28%26nbsp%3B%2980%3A80%3A6%3AHTTP%28%26nbsp%3B%29&services_length=13&service_applist=&blocked_service0=&blocked_service1=&blocked_service2=&blocked_service3=&blocked_service4=&blocked_service5=&blocked_service6=&blocked_service7=&blocked_service8=&blocked_service9=&wait_time=3&start=&f_id=1&f_name=faceboook&f_status1=disable&f_status2=allow&day_all=1&time_all=1&host0=www.facebook.com&host1=&host2=&host3=&url0=facebook&url1=&url3=&url4=&Add_Service_Name=&Add_Service_Port_S=0&Add_Service_Port_E=0&Add_Service_Protocol=23&end=' http://10.0.0.1/Filters.asp
--2009-04-08 13:58:03--  http://10.0.0.1/Filters.asp
Connecting to 10.0.0.1:80... connected.
HTTP request sent, awaiting response... No data received.
Retrying.
```
I can succesfully authenticate to this routers web interface, with the following:

```
wget --keep-session-cookies --http-user=xyz --http-password=xyz http://10.0.0.1/
Connecting to 10.0.0.1:80... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Connecting to 10.0.0.1:80... connected.
HTTP request sent, awaiting response... 200 Ok
Length: unspecified [text/html]
Saving to: `index.html.4'

    [   <=>                                                                                                                       ] 73,195       126K/s   in 0.6s    

2009-04-08 14:04:10 (126 KB/s) - `index.html.4' saved [73195]
```
Looking for a hint. This is so I can enable/disable a setting on a linksys router page.
Thanks.


----------



## wmorri (May 29, 2008)

Hi,

Can you get a larger screenshot of that, I can't see what you are wanting to turn on.

Cheers!


----------



## mike909 (Apr 9, 2009)

Are you looking for just the POSTDATA ? You can get that from the command (after the --post-data option). Seems like that's the only thing getting cut off from the screenshot. I can pretty easily see everything else...is there a specific field you want me to zoom in on? Sorry, just trying to figure out what info to provide you.
Thanks for offering to help,


----------



## wmorri (May 29, 2008)

Hi,

I am just looking for a bigger picture of your firefox session. It is just too small to read. I don't need a specific section, just the entire image.

Cheers!


----------



## mike909 (Apr 9, 2009)

wierd, the "attachment" is only 640 px wide, but the image inside the post is 1400...I guess the forum automatically scales down the "attachment"? 
Anyway, here is a link to a 1400px × 1050px version of the image:
http://ubuntuforums.org/attachment.php?attachmentid=109123&d=1239224127
Thanks.


----------



## mike909 (Apr 9, 2009)

Ok, I think ive figured it out. I just need to clean it up a bit so it doesn't DL temp files, but here's basically what I did:
This example used to enable/disable a filter on my linksys router:
use "tamper-data" plugin in firefox to get the information that is actually being submitted and where. Take the URL form the top window (not the "referrer URL from the "request header" window). Use that URL in the following command:
wget --http-user=<user> --http-password=<password> --post-file=<file containing the "POSTDATA"> http://10.0.0.1/apply.cgi
The post-file should contain only the data taken from the "request header value" (ie everything AFTER the "POSTDATA=" if you copy it out of tamper-data...which in this case begins with "submit_button...")


----------



## wmorri (May 29, 2008)

If you got it to work that is great. I wasn't sure how to do it to be honest. I haven't done much with wget yet, but I will be working on that more now. I need to learn how to do it.

Cheers!


----------

