Tool(s) to retrieve web POST data?

For everything that's not in any way related to PureBasic. General chat etc...
kawasaki
Enthusiast
Enthusiast
Posts: 182
Joined: Thu Oct 16, 2003 8:09 pm

Tool(s) to retrieve web POST data?

Post by kawasaki »

Hey,

Since this is a Web question, that is relevant to PB (I believe) since I am working with PureBasic and POST Data.

Is there any tools that anyone can think of that can get the POST data that is sent back to the server?

Ideally a tool which sits between a Web control, and the Internet that parses the data you (or in this case I) sent back and lists the POST data?

(sorry if this isn't seen as an acceptable request for this forum.)

Thanks,

Mike
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

I haven't used it with PureBasic before but you may be able to use libcurl to read/write the post data.

http://curl.haxx.se/

Here is a link to an example done in PHP:

http://www.askapache.com/htaccess/sendi ... -curl.html
kawasaki
Enthusiast
Enthusiast
Posts: 182
Joined: Thu Oct 16, 2003 8:09 pm

Post by kawasaki »

Hi Mistrel,

I have looked at LibCurl prior to posting on here, but unfortunately it doesn't meet my requirement.
POST (HTTP)

It's easy to post data using curl. This is done using the -d <data>
option. The post data must be urlencoded.

Post a simple "name" and "phone" guestbook.

curl -d "name=Rafael%20Sagula&phone=3320780" \
http://www.where.com/guest.cgi
- LibCurl Documentation

It appears it only aids sending of POST data, where as I ideally need to see what POST data is sent from a browser to the server.

So if I am browsing say this forum, and I click Submit on entering a post, I need something that shows me what POST data is being sent from my browser to the forum server.

Thanks all the same,

Mike
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Post by Joakim Christiansen »

kawasaki wrote:So if I am browsing say this forum, and I click Submit on entering a post, I need something that shows me what POST data is being sent from my browser to the forum server.
No problem at all, just inspect the HTML code, then you'll know exactly what the browser will send and then you can emulate this in your software.
I did this once when I made a imageshack uploader in PB.

But if you really want to actually capture the data going through your network wires, then I have no idea about that.

Let me know if you find some browser plugin that does this btw, would be nice to have.

Here is some program I made for automatically finding HTML forms:

Code: Select all

Procedure.s HttpGet(Server$,Path$,Cookies$="",Download=#True) ;shitty one for testing
  Protected Request$,Result$,BytesRead,BufferLength=40000,*Buffer = AllocateMemory(BufferLength)
  Protected ServerID = OpenNetworkConnection(Server$,80) ;443 for https
  If ServerID
    Request$ = "GET "+Path$+" HTTP/1.1"+#CRLF$
    Request$ + "Host: "+Server$+#CRLF$
    If Cookies$
      Request$ + "Cookie: "+Cookies$+#CRLF$
    EndIf
    Request$ + "User-Agent: "+UAgent$+#CRLF$+#CRLF$
    SendNetworkData(ServerID,@Request$,Len(Request$));+1)
    If Download
      J01:
      Repeat
        BytesRead = ReceiveNetworkData(ServerID,*Buffer,BufferLength)
        Result$ + PeekS(*Buffer,BytesRead)
      Until BytesRead < BufferLength
      Delay(100)
      If NetworkClientEvent(ServerID) = #PB_NetworkEvent_Data
        Goto J01
      EndIf
    EndIf
    CloseNetworkConnection(ServerID)
  EndIf
  FreeMemory(*Buffer)
  ProcedureReturn Result$
EndProcedure

InitNetwork()
Result$ = HttpGet("imageshack.us","/")
;Debug Result$

For i=1 To CountString(Result$,#LF$)+1
  String$ = StringField(Result$,i,#LF$)
  If FindString(LCase(String$),"<form",1)
    Debug "FORM START ##############################################"
    Debug String$
  ElseIf FindString(LCase(String$),"<input",1)
    Debug String$
  ElseIf FindString(LCase(String$),"<textarea",1)
    Debug String$
  ElseIf FindString(LCase(String$),"<select",1)
    Debug String$
  ElseIf FindString(LCase(String$),"<option",1)
    Debug String$
  ElseIf FindString(LCase(String$),"<button",1)
    Debug String$
  ElseIf FindString(LCase(String$),"</form>",1)
    Debug "FORM END ################################################"
    Debug "": Debug ""
  EndIf
Next

Last edited by Joakim Christiansen on Thu Sep 04, 2008 6:22 pm, edited 1 time in total.
I like logic, hence I dislike humans but love computers.
kawasaki
Enthusiast
Enthusiast
Posts: 182
Joined: Thu Oct 16, 2003 8:09 pm

Post by kawasaki »

First of all the website I am trying to post data to is http://www.sendsmsnow.com/

My goal is to write a client for it so that it checks for any new SMS' every specified minutes, or seconds.

You do have to log into it (hence why I am trying to sort out the POST problem).

But I can't seem to work around doing this, I have sent a post string of

"uname="+username.s+"&upass="+password.s

But for some reason I keep getting back errors.


Here is the chunk of the HTML code that is dealing with the logging in;

Code: Select all

<form action="index.php" method="post"> 
					<tr> 
						<td class="inptext"><b>User name</b></td> 
						<td><input name="uname" size="10"></td> 
					</tr> 
					<tr> 
						<td class="inptext"><b>Password</b></td> 
						<td><input name="upass" size="10" type="password"></td> 
					</tr> 
					<tr> 
						<td align="center" colspan="2"> 
							<table cellspacing="0" cellpadding="0" border="0"> 
								<tr> 
									<td align="right"><input name="urem" type="checkbox" value="remember"></td> 
									<td class="inptext">Remember me</td> 
								</tr> 
							</table> 
						</td> 
					</tr> 
					<tr> 
						<td colspan="2" align="center"> 
							<input type="image" border="0" src="images/submit.gif"> 
						</td> 
					</tr> 
					<tr> 
						<td colspan="2" align="center"><a class="TopNav" href="http://www.sendsmsnow.com/forgetpass.php">Forgot password?</a></td> 
					</tr> 
				</form> 
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Post by Joakim Christiansen »

Hmm, I'm not sure if I really want to start messing around with this myself at this moment.

But does the username contain spaces or weird characters? If so maybe URLEncoder() will help.

And if you get this working and login, then you must usually capture the php session id cookie too and use it in your other post or get requests to stay logged in.

I know some sites can be a pain in the ass, but I hope you get it working :)
But let me know if you ever find some browser plugin or something to get the post requests, that would rock.
I like logic, hence I dislike humans but love computers.
kawasaki
Enthusiast
Enthusiast
Posts: 182
Joined: Thu Oct 16, 2003 8:09 pm

Post by kawasaki »

I will, rest assure it lol
kawasaki
Enthusiast
Enthusiast
Posts: 182
Joined: Thu Oct 16, 2003 8:09 pm

Post by kawasaki »

Well I'll be...


Found the perfect tool! (lmao).

The program is called HTTP Analyzer and it can either be ran stand alone, or be embedded into Microsoft's Internet Explorer. (A screenshot attached.)
HTTP Analyzer is a utility that allows you to capture HTTP/HTTPS traffic in real-time. It can trace and display wide range of information, including Header, Content, Cookies, Query Strings, Post data, Request and Response Stream, redirection URLs and more.

- From the description.
It does cost $75 (for the Internet Explorer Add-on Edition (Non Commercial)), but anyone who is often doing such tasks, may find this an invaluable tool.

The website is: http://www.ieinspector.com/httpanalyzer/index.html

Screenshot;

Image

Sorry for the post lol, and I hope someone else with this problem will stumble across this.

Mike
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Post by Rescator »

Here is a free plugin for Firefox that does what you probably want as well.
http://livehttpheaders.mozdev.org/
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Post by eddy »

@Joakim Christiansen

Nice...:P I'll try your code.
I searched an HTTPS Get example.
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
Post Reply