LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-09-2017, 08:31 PM   #1
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,150

Rep: Reputation: 887Reputation: 887Reputation: 887Reputation: 887Reputation: 887Reputation: 887Reputation: 887
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.
 
Old 10-10-2017, 03:35 AM   #2
Turbocapitalist
Senior Member
 
Registered: Apr 2005
Distribution: Ubuntu, Devuan, OpenBSD
Posts: 2,628
Blog Entries: 3

Rep: Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159
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.
 
Old 10-10-2017, 09:39 AM   #3
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,150

Original Poster
Rep: Reputation: 887Reputation: 887Reputation: 887Reputation: 887Reputation: 887Reputation: 887Reputation: 887
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>

Last edited by schneidz; 10-10-2017 at 09:41 AM.
 
Old 10-10-2017, 01:01 PM   #4
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: Slackware
Posts: 7,624

Rep: Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948
You can also use a local web proxy, like Fiddler or Charles Proxy.
 
Old 10-10-2017, 01:08 PM   #5
Turbocapitalist
Senior Member
 
Registered: Apr 2005
Distribution: Ubuntu, Devuan, OpenBSD
Posts: 2,628
Blog Entries: 3

Rep: Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159
Quote:
Originally Posted by schneidz View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Eolie Web Browser for GNOME - The Simplest Web Browser LXer Syndicated Linux News 0 09-28-2017 03:22 AM
"Web of Trust" browser add-on found to be harvesting and selling data frankbell General 7 11-08-2016 09:03 AM
[SOLVED] Using curl to post data in a bash script rather than use a web page. pobrika Programming 3 06-08-2012 04:32 AM
shell script to submit web POST data? Yalla-One Programming 5 11-03-2006 05:21 AM
Sar data via web browser Mike_the_Man Linux - Software 1 10-20-2006 11:21 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration