LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   post data -- how to copy what web-browser submits (https://www.linuxquestions.org/questions/programming-9/post-data-how-to-copy-what-web-browser-submits-4175615347/)

schneidz 10-09-2017 07:31 PM

post data -- how to copy what web-browser submits
 
i want to script toggling fields from a quickbase website so i dont have to login and manually type the same thing for multiple users.

is there a way to find out what post data is being transferred and what the variables would be (not seeing that option in elinks).

i am having trouble formatting my wget.

Turbocapitalist 10-10-2017 02:35 AM

You can look at the XHTML form itself and pick out the various fields and their values. Then use those to pass those with wget to your targeted web server. See the --post-data or --post-data-file options, and maybe along with the --method option.

Code:

wget --help | less
man wget

View Source should be available in your browser. Another option is to view the individual element. ctrl-shift-i is often the shortcut to view the elements.

See the standard for details about the form element and the data fields that in can include, if you want background.

However, if the web page has all that hidden behind Javascript, then not only are the desingers low-life scum but you have more work. In that case you would have to do a man-in-the-middle attack against your own browser to sniff to outgoing connection. It's easy, but has a lot of set up to get in place.

schneidz 10-10-2017 08:39 AM

yes, i think i am being obscured by js. thru trial-and-error, this is where i'm stuck:
Code:

/usr/bin/wget --save-cookies cookies-0.txt --keep-session-cookies --post-data "loginid=$user&password=$pass" 'https://quickbase.02144.com/db/main?a=SignIn&nexturl=https%3A%2F%2Fquickbase.02144.com%2Fdb%2Fba72vkeua&rc=psi' -O s-0.html

 /usr/bin/wget --load-cookies cookies-0.txt --save-cookies cookies-1.txt --keep-session-cookies 'https://quickbase.02144.com/db/ba72vkeua?srchtxt=58289709&a=QuickSearch2&all=true' -O s-1.html

 /usr/bin/wget --load-cookies cookies-1.txt --save-cookies cookies-2.txt --keep-session-cookies --post-data "_fid_34=Open&saveBTN=Save" 'https://quickbase.02144.com/db/ba72vket9?a=FinishEditRecord&subact=save&rid=5222&rl=' -O s-2.html

the html that is returned to me, i got it to say open is selected (rather than the default closed) but when i check it in firefox its still in closed status. there must be some button that the bash script has to emulate to push; if only i can get a glimpse of what the web-browser is actually posting (packet sniffing ?) ?
Code:

[schneidz@xwascldm3d close]$ less s-2.html
...
<tr>
<td>&nbsp;</td>
<td class=ilc align=right>Status&nbsp;</td>
<td class=cc>    <select onMouseDown='CaptureSelectStateIfSafari(event);return true;' onChange=' OnCHF(this);'  name='_fid_34' id='_fid_34' size=1>
        <option value=''></option>
        <option value='Canceled'>Canceled</option>
        <option value='Closed'>Closed</option>
      <option value='Open' selected>Open</option>
        <option value='Processing'>Processing</option>
        <option value='Under Review'>Under Review</option>
    </select>

<input name=_fid_oval_34 type=hidden value="Closed">
</td>
<td class=cc valign=top style="padding:5px;">Closed</td>
</tr>


dugan 10-10-2017 12:01 PM

You can also use a local web proxy, like Fiddler or Charles Proxy.

Turbocapitalist 10-10-2017 12:08 PM

Quote:

Originally Posted by schneidz (Post 5768374)
there must be some button that the bash script has to emulate to push; if only i can get a glimpse of what the web-browser is actually posting (packet sniffing ?) ?

There might be some plugin for Firefox that does that. Otherwise, you'll have to set up a web proxy and use that to spy on the traffic. That is a bit more complicated when TLS (HTTPS) is involved because then there are some extra steps.


All times are GMT -5. The time now is 08:06 PM.