Highlighted
Absent Member.. Absent Member..
Absent Member..
242 views

scripting WinSock+HTTP/HTML??

Hi,
Trying to submit data to a server. Was given a .Net application to generate and capture the output. (the .net application simulates the process of the application on users' PCs)

On a successful submission, I place a hit on a proxy server (web_submit_data).

After much trial and error WinSoc allowed me to get the 'send buf0' and 'recv buf1' data that I needed.
I want to use an element returned in that string to be the trigger to send the 'web_submit_data' request.

here's the initial action:
#include "lrs.h"


Action()
{
lrs_create_socket("socket0", "TCP", "RemoteHost=hostname.domainname.com:2066", LrsLastArg);

lrs_send("socket0", "buf0", LrsLastArg);

lrs_receive("socket0", "buf1", LrsLastArg);



return 0;
}

The 'buf1' response is simple, looks like:
"\r\n"
"\r"
"\n"
"SuccessWait\r\n"
"
\r\n"

I want to use that 'Result' tag (successWait and Success are my good values) as my indicator to post the submit data:

web_submit_data("login.aspx",
"Action= http://proxyname.Domain.com/Citrix/MetaFrame/auth/login.aspx",
"Method=POST",
"TargetFrame=",
"RecContentType=text/html",
"Referer= http://hostname.domainname.com:81/handler.aspx",
"Snapshot=t3.inf",
"Mode=HTML",
ITEMDATA,
"Name=LoginType", "Value=Explicit", ENDITEM,
"Name=user", "Value={AUserName}", ENDITEM,
"Name=password", "Value=AstaticPwd", ENDITEM,
"Name=domain", "Value=A_StaticDomain", ENDITEM,
LAST);

any thoughts?
Thanks in advance!
0 Likes
3 Replies
Highlighted
Absent Member.
Absent Member.

Re: scripting WinSock+HTTP/HTML??

you can use the lrs_save_param to capture the value you need (SuccessWait), then just eval the created value by this lrs function and do whatever needs to be done based on the caputed value.

If that does not work. you can always caputure the whole received buffer using one of the lrs funtions, save it to a string buffer and looks for the value using regular C funtions like strstr. This option will require some additonal coding, but it should work as well.

I can't give you the detailed scripting part; It's been a while since i worked with the winsock protocol. I just tried to give you some pointers into the right direction.

thanks

~hector
0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: scripting WinSock+HTTP/HTML??

So, as it turns out, I used the 'Protocol Advisor' and ran the app. It recommended using a dcom/com+WinSoc script. That did the trick and I had much success.

I was NOT able to add WEB in there with it, to move into the next step of the process.

Tripple protocol script? is it possible?

lrs_save_param("socket0", "buf1", "result", 127, 7);

was used to grab the info I wanted from the buffer, but I never could use it because I needed to attach it to the web_submit_data function that the script kept rejecting.

gave me: unresolved symbol : web_submit_data
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: scripting WinSock+HTTP/HTML??

To my understanding, you only need web and winsock. All you needed to do is correlation or capture a dynamic value coming from the server via the winsock protocol. the Winsock protocol should caputure everything not captured by the web protocol.

Try this. go to your web/winsock script and place the
lrs_save_param("socket0", "buf1", "result", 127, 7); in the other script.

Then just use the Result value and do what needs to be done based on the captured value.

hope that helped

`Hector
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.