2

I want to be able to run some kind of shell script/curl commands to toggle my TV services by accessing a form on my router page using curl or wget.

I have been able to get past authentication using the -u username:password on the command line; Got to the critical page using

/index.cgi?page=services&sessionid=X6dRAsbOxWh9sc9llfGngL9lH4rQOsA>

(I have tried it without the sessionid parameter and the -u and it works)

I have got far enough to be able to set HTML controls, but somewhere a save button calls a piece of JavaScript. I know that the name of the option button is "services" and the value can be 0 or 1, but I dont know how to call the FormSubmit('butt2') in order to submit the values. I can initialize a cookie jar … I seem to be so close but executing the script with the the values set and the right parameter 'butt2'

Please help

Desperate Dad

1
  • You'll need to somehow recreate what the Javascript snippet is doing, which probably isn't all that hard -- likely it's just doing form validation. If you'll find that snippet (defined either in the source of the page you're trying to submit, or in a Javascript file included via <script> tag from there, as function FormSubmit(...)), and edit the entirety of that function into your question, that should be enough to let me give you a worthwhile answer. May 8, 2013 at 22:18

1 Answer 1

2

What you need to do is not load the page, fill in the form and submit it - but instead just submit the same data directly to the same place that submitting the form manually would normally do.

If you look at the JS on that page, at some point it will do a form.submit, or an ajax submit to a URL. What you need to do is to directly POST the same data, to the same URL as the form would, but using CURL/WGET instead.

Here are some answers that explain how to do that and how to find out what data you need to submit:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .