http_request ["t3079"]
"POST /pkmslogin.form HTTP/1.1/r/n"
"Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, applicat"
"ion/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, ap"
"plication/x-shockwave-flash, */*/r/n"
"Referer: " + SgenURI_009 + "/r/n"
/* "Referer: http://gclgtod.cn.ibm.com/wps/myportal?lang=en_US" */
"Accept-Language: en-us,zh-cn;q=0.5/r/n"
"Content-Type: application/x-www-form-urlencoded/r/n"
"Accept-Encoding: gzip, deflate/r/n"
"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)/r/n"
"Host: gclgtod.cn.ibm.com/r/n"
"Content-Length: 55/r/n"
"Connection: Keep-Alive/r/n"
"Cache-Control: no-cache/r/n"
"Cookie: w3sauid=d002000000001363710753854620000923482.0009B551AB; PBC_N LSP"
"=en_US; msp=alreadyOffered; JSESSIONID=0000fRBw1aq9nolhnP9ZMKhaw2B:- 1; "
"PD-H-SESSION-ID=4_oxjUZgfvY4ToFOhh9cFnnAg54o4sndHOA6rRkqpxbT2NAAAA/r"
"/n"
"/r/n"
"username=admin&password=admin&login-form-type="
+ http_url_encode(SgenRes_005[0]) + "";
|
|
…
<form action="/search" name="frmSearch" method="GET">
<input type="hidden" name="mode" value="simple">
<input maxLength="256" size="55" name="keyword" value=""><br>
<input type="submit" value="Search" name="btnSearch">
</form>
…
|
…
{
string SgenRes_001[];
SgenRes_001 = http_find_values("mode", HTTP_FORM_DATA, 1);
CHECK_FIND_RESULT(SgenRes_001,"mode","simpe")
}
…
|
string[] http_find_values(name, type, tag[, name, type, tag ... ]),
|
string func getURLByText(source, text)
string source, text;
{
int startText, startA, startHref;
string remainingText, beforeText, aOpenText, hrefText, url;
string pattern;
pattern = "([ //t//n//r]*/"(([^/"]*)$0)/")|";
pattern += "([ //t//n//r]*//'(([^//']*)$0)//')|";
pattern += "([ //t//n//r]*(([^ //t//n//r]*)$0)[ //t//n//r>])";
remainingText = source;
while (1) {
startText = strstr(remainingText, text);
if (0 == startText) {
break;
} else {
beforeText = substr(remainingText, 1, startText - 1);
startA = 0;
// Find the position of the last occurrence of "<a" or "<A".
while (match('(<[aA][ /t/n/r]+)$0', beforeText, &aOpenText)) {
startA = strstr(beforeText, aOpenText);
beforeText = substr(beforeText, startA + 2, strlen(beforeText));
}
if (0 < startA) {
if (!match('</[aA][ /t/n/r]*>', beforeText)) {
// The anchor does enclose specified text.
if (match(
'([Hh][Rr][Ee][Ff][ /t/n/r]*=)$0',
beforeText,
&hrefText)) {
// Check the location of the found "href".
startHref = strstr(beforeText, hrefText);
if (startHref < strstr(beforeText, ">")) {
// Now try to extract the URL
if (match(
pattern,
substr(
beforeText,
startHref + strlen(hrefText),
strlen(beforeText)),
&url)) {
return url;
}
}
}
}
}
}
remainingText =
substr(
remainingText,
startText + strlen(text),
strlen(remainingText));
}
return "";
}
|
string func getURLByTextEx(source2, expression2)
string source2, expression2;
{
int startText2, startA2, startHref2;
string text2, remainingText2, beforeText2, aOpenText2, hrefText2, url2;
string newExpression2, pattern2;
pattern2 = "([ //t//n//r]*/"(([^/"]*)$0)/")|";
pattern2 += "([ //t//n//r]*//'(([^//']*)$0)//')|";
pattern2 += "([ //t//n//r]*(([^ //t//n//r]*)$0)[ //t//n//r>])";
newExpression2 = "(" + expression2 + ")$0";
remainingText2 = source2;
while (1) {
if (!match(newExpression2, remainingText2, &text2)) {
break;
} else {
startText2 = strstr(remainingText2, text2);
beforeText2 = substr(remainingText2, 1, startText2 - 1);
startA2 = 0;
// Find the position of the last occurrence of "<a" or "<A".
while (match('(<[aA][ /t/n/r]+)$0', beforeText2, &aOpenText2)) {
startA2 = strstr(beforeText2, aOpenText2);
beforeText2 = substr(beforeText2, startA2 + 2, strlen(beforeText2));
}
if (0 < startA2) {
if (!match('</[aA][ /t/n/r]*>', beforeText2)) {
// The anchor does enclose specified text.
if (match(
'([Hh][Rr][Ee][Ff][ /t/n/r]*=)$0',
beforeText2,
&hrefText2)) {
// Check the location of the found "href".
startHref2 = strstr(beforeText2, hrefText2);
if (startHref2 < strstr(beforeText2, ">")) {
// Now try to extract the URL
if (match(
pattern2,
substr(
beforeText2,
startHref2 + strlen(hrefText2),
strlen(beforeText2)),
&url2)) {
return url2;
}
}
}
}
}
}
remainingText2 =
substr(
remainingText2,
startText2 + strlen(text2),
strlen(remainingText2));
}
return "";
}
|
string func getStringByBoundaries(source3, b1, b2)
string source3, b1, b2;
{
int startPos, endPos;
startPos = strstr(source3, b1);
if (0 == startPos) {
return "";
}
startPos += strlen(b1);
endPos = strstr(substr(source3, startPos, strlen(source3)), b2);
if (0 == endPos) {
return "";
}
return substr(source3, startPos, endPos - 1);
}
string func getStringByPrefixAndBoundary(source4, prefix, b3)
string source4, prefix, b3;
{
int startPos2, endPos2;
startPos2 = strstr(source4, prefix);
if (0 == startPos2) {
return "";
}
endPos2 = strstr(
substr(source4, startPos2 + strlen(prefix), strlen(source4)), b3);
if (0 == endPos2) {
return "";
}
return
substr(source4, startPos2, strlen(prefix) + endPos2 - 1);
}
string func getStringByBoundaryAndPostfix(source5, b4, postfix)
string source5, b4, postfix;
{
int startPos3, endPos3;
startPos3 = strstr(source5, b4);
if (0 == startPos3) {
return "";
}
startPos3 += strlen(b4);
endPos3 = strstr(
substr(source5, startPos3, strlen(source5)), postfix);
if (0 == endPos3) {
return "";
}
return
substr(source5, startPos3, strlen(postfix) + endPos3 - 1);
}
string func getStringByPrefixAndPostfix(source6, prefix2, postfix2)
string source6, prefix2, postfix2;
{
int startPos4, endPos4;
startPos4 = strstr(source6, prefix2);
if (0 == startPos4) {
return "";
}
endPos4 = strstr(
substr(source6, startPos4 + strlen(prefix2), strlen(source6)),
postfix2);
if (0 == endPos4) {
return "";
}
return substr(source6, startPos4,
strlen(prefix2) + strlen(postfix2) + endPos4 - 1);
}
|
#include “newscript.s”
|
{
string formData;
formData = "username=admin&password=admin&login-form-type="
+ http_url_encode(SgenRes_005[0]) + "";
}
http_request ["t3079"]
"POST /pkmslogin.form HTTP/1.1/r/n"
"Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, applicat"
"ion/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, ap"
"plication/x-shockwave-flash, */*/r/n"
"Referer: " + SgenURI_009 + "/r/n"
/* "Referer: http://gclgtod.cn.ibm.com/wps/myportal?lang=en_US" */
"Accept-Language: en-us,zh-cn;q=0.5/r/n"
"Content-Type: application/x-www-form-urlencoded/r/n"
"Accept-Encoding: gzip, deflate/r/n"
"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)/r/n"
"Host: gclgtod.cn.ibm.com/r/n"
"Content-Length: " + itoa(strlen(formData)) + "/r/n"
"Connection: Keep-Alive/r/n"
"Cache-Control: no-cache/r/n"
"Cookie: w3sauid=d002000000001363710753854620000923482.0009B551AB; PBC_N LSP"
"=en_US; msp=alreadyOffered; JSESSIONID=0000fRBw1aq9nolhnP9ZMKhaw2B:- 1; "
"PD-H-SESSION-ID=4_oxjUZgfvY4ToFOhh9cFnnAg54o4sndHOA6rRkqpxbT2NAAAA/r"
"/n"
"/r/n"
"" + formData + "";
|
…
<script language="JavaScript">
<!--
function URLEncode(aURL) {
// Encode a URL.
…
}
function gotoPage(employeeName) {
employeeName += ".htm";
employeeName = URLEncode(employeeName);
document.location.href = employeeName;
}
//-->
</script>
Jack Lee
<input type="button" onClick="javascript:gotoPage('Jack Lee')"
value="View profile" /><br>
Rose Smith
<input type="button" onClick="javascript:gotoPage('Rose Smith')"
value="View profile" /><br>
…
|
…
#include "routines.s"
…
{
string employeeName;
employeeName = getStringByBoundaries(_response, "javascript:gotoPage('", "'");
employeeName += ".htm";
employeeName = http_url_encode(employeeName);
}
…
|