Use HTA to inject remote web pages locally to solve the problem that HTA does not share the IE session and some permissions.

Source: Internet
Author: User

Provides ideas; allows you to easily inject edited functions into remote pages with one click.

 

 

 

 

<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> easy to inject operation code to a remote webpage Program </title>
</Head>
<Body>

Window name: <input id = Winn size = 10 value = "win" onchange = "window. win = NULL; showtext ('the webpage will open a new window. '); "> (Win window object name. If this window already exists, the window URL will be replaced .) <br>
Network Parameter link: <input id = WVS size = 10 value = "? "> (URL link parameter string characters, such ?) <Br>
Parameter link: <input id = VVS size = 10 value = "&"> (the character of the parameter Link parameter. For example, &) <br>
Parameter Value Link: <input id = vas size = 10 value = "="> (for example, =) <br>

<! -- // Note that the parameter ID is always varid, And the name is the ID passed to the server. // -->
X _____ ID: <input id = varid value = 0db1 size = 10 Sn = "x_id"> <br>
Item _ ID: <input id = varid size = 35 Sn = "item_id" value = "0a2f26d13eddf8f142d64cc71bf3abbc">
<Br> SKU ___ ID: <input id = varid size = 10 Sn = "sku_id" value =>
<Br> target price: <input id = varid value = 1.00 size = 10 Sn = "mbjg" value = "1.00">
<Br> receiver name: <input id = varid size = 10 Sn = "_ FMA. B. _ 0.de" value =" Lin Weijun ">
<Br> shipping address: <input id = varid size = 50 Sn = "_ FMA. B. _ 0.d" value =" No. 706 Zhongshan street ">
<Br> mobile phone number: <input id = varid size = 13 Sn = "_ FMA. B. _ 0. Deli" value = "13005609114">
<Br> zip code: <input id = varid size = 10 Sn = "_ FMA. B. _ 0.po" value = 515000>
<Br> my message: <input id = varid value = Please send Shentong express or yuantong or EMS. Thank you! Size = 50 Sn = "_ FMA. B. _ 0.w">
<Br> shipping method: <select id = varid Sn = "_ FMA. B. _ 0.s">
<Option selected value = 4> template delivery </option>
<Option value = 0> free shipping </option>
<Option value = 2> express delivery </option>
<Option value = 1> Ping you </option>
<Option value = 7 selected> EMS </option>
</SELECT>
<! -- // Parameter end // -->

<Br> <input id = joinvarb onclick = joinvar (); value = Link parameter type = button style = "width: 10%;" Title = "put the linked string in the buyurl. in vars; ">
<Input id = buyurl name = buyurl value = "http://ebay.com" vars = "" style = "width: 65%;" Title = "Enter URL">
<Input type = button value = "create Win window/change URL" style = "width: 20%;" onclick = "createw (); "Title =" use this URL + parameter string to open it in a new window. If you do not need a parameter string, clear it and open it again. ">
<Br>
<Input style = "border-bottom: 0px; border-left: 0px; border-top: 0px; border-Right: 0px; width: 70px; "id = Nt value = 00:00:00 type = button name = Nt>
Time: <input id = HH maxlength = 2 size = 1 name = HH style = "border: 0px;"> hour
<Input id = mm maxlength = 2 size = 1 name = mm style = "border: 0px;"> minute
<Input id = SS maxlength = 2 size = 1 name = SS style = "border: 0px;"> seconds
<Input id = ss2 maxlength = 3 size = 2 name = ss2 style = "border: 0px;"> millisecond <br>

<Input type = button value = loading JS onclick = "eval (JS. Value); showtext ('all Han numbers are loaded successfully, you can use all the functions');">
<Input onclick = insertweb (); value = inject remote page type = button>
<Input id = ksqp onclick = sjsjtosubmit (); value = stop taking type = button name = ksqp>
<Input onclick = '$ E ("MSG"). innerhtml = ""; 'value = clear message type = button>
<A href = "#0" onclick = "This. Children [0]. Click ();">
Message scrolling <input id = autoroll type = checkbox checked = true name = autoroll> </a>
<A href = "#0" onclick = "This. Children [0]. Click ();">
Automatic Recording <input id = autopai type = checkbox checked = true> </a>
<Br> <Div id = MSG style = "border: 1px solid black; width: 100%; Height: 350px; overflow-Y: auto; overflow-X: hidden; word-wrap: Break-word; "> </div>
<Textarea style = "width: 100%; Height: 50px; Word-break: Keep-all; overflow: Scroll;" onkeypress = "If (event. keycode = 10) {eval (this. value)} "> </textarea>
<Div id = formd style = "width: 100%; Height: 100px;"> </div>

 

<Textarea id = JS style = "display: none;">

Window. errfun = function (smessage, Surl, Sline)
{
VaR STR = "";

STR + = "error message:" + smessage + "<br> ";

STR + = "Number of error rows:" + Sline + "<br> ";

STR + = "<========= call stack ========>< br> ";

VaR func = Window. onerror. Caller;

VaR Index = 0;

While (func! = NULL ){

STR + = "Number" + index + "function:" + func. tostring (). Split ("{") [0] + "<br> ";

STR + = "Number" + index + "function: parameter table :"

For (VAR I = 0; I <func. Arguments. length; I ++ ){

STR + = func. Arguments [I] + ",";

}

STR + = "<br >==============================< br> ";

Func = func. Caller;

Index ++;

}

Showtext (STR );

Return true;
}

Window. showin32 = function ()
{// Current time
VaR d = new date ();
$ E ('nt '). value = D. gethours () + ":" + D. getminutes () + ":" + D. getseconds ();
}

Window. showtext = function (text)
{// Text: the input string;
$ E ("MSG"). insertadjacenthtml ("beforeend", new date (). tolocalestring () + "" + TEXT + '<HR width = 100%> ');
If ($ E ("autoroll"). Checked) $ E ("MSG"). scrolltop = $ E ("MSG"). scrollheight;
// $ E ("MSG"). insertadjacenthtml ("afterbegin", text + '<HR width = 100%> ');
// $ E ("MSG"). scrolltop = 0;
}

Window. Openurl = function (URL, fun)
{
Cleartimeout (window. winer );

If (URL! = "")
{
Try
{
Window.win.doc ument;
Window. Win. Location = URL;
Showtext ("replace win object URL .");
} Catch (E)
{
Showtext ("Win object does not exist, create .");
Window. Win = open (URL, $ E ("Winn"). value );
}

If (window. Win = NULL)
{
Showtext ("An error occurred while creating the window. Does the browser block the pop-up window? Please allow this webpage to pop up .");
Return 0;
}

Try
{
Showtext ("new window webpage domain name:" + window. Win. Location. HOST );
} Catch (E)
{
Showtext ("NOTE: An error occurred while obtaining the domain name of the new window. The action is aborted! <Br>"
+ "The Domain Name of the webpage in the new window [" + gethost (URL) + "] is different from that of the webpage domain [" + location. Host + ,"
+ "If the content in the new window (different domain names) is obtained on this page (not HTA), access is forbidden because of no permission ."
+ "If the server returns the page to the same domain name, it can still be accessed .");
Return 0;
}

Showtext ("Open URL:" + URL + "<br> Please do not perform other operations .... <br> loading webpage... ");
Url = "";
} Else if (window.win.doc ument. readystate = 'complete ')
{
// Alert (fun );
Eval (fun );
Showtext ("webpage Loading completed ");
Return 0;
}

Window. winer = setTimeout ("Openurl ('', '"+ fun +"') ", 1000 );
}

Window. gethost = function (URL)
{
Showtext ("Get a domain name (only supports international domain name resolution, that is, HTTP (s): // english or decimal point or number or-character composition ;");
If (url = undefined) | (typeof (URL )! = "String") | (! /^ * HTTPS? /: // ([. A-z0-9/-] *)/Gi. Test (URL) Return "";
Else return Regexp. $1;
}

Window. insertweb = function ()
{
Showtext ("we recommend that you load the webpage before performing this operation! "
+ "<Br> make sure that the website you inject is the same as you need to perform operations. Otherwise, access will be denied due to permission issues ."
+ "<Br> if you want to operate the web site is http://www.google.com/ss.htm ,"
+ "Then you need to open the win object URL in front of the http://www.google.com /....");

If (window. Win = undefined) | (window. Win. Closed ))
{
Return showtext ("the remote webpage is not opened or closed. Open it again .");
} Else
{
Try
{
Export export win.doc ument. Body. innerhtml = Document. Body. outerhtml;
Showtext ("the remote page is successfully written. Switch to the remote page to View Details .");
} Catch (E)
{
Showtext ("injection error! Close the remote window, create a new one, and try again .! It may be caused by an XMLHTTP exception .");
}
}
}

Window. createw = function ()
{
Openurl ($ E ("buyurl"). Value + $ E ("buyurl"). vars, 'insertweb ();');
}

Window. $ WFE = function (thef, thee)
{
If (typeof (thee) = "undefined") return document. getelementbyid (thef );
Return document. getelementbyid (thef). elements [thee];
}

Window. $ e = function (thid)
{
Return document. getelementbyid (thid );
}

Window. Istime = function (Num)
{
If (isnan (Num) return false;
If (Num <0) return false;
Return ture;
}

Window. joinvar = function ()
{// Link Parameters
If ($ E ("joinvarb"). value = "Link parameter ")
{
$ E ("joinvarb"). value = "Clear parameter ";
$ E ("buyurl"). vars = $ E ("WVS"). value;
VaR vars = Document. getelementsbyname ("varid ");

For (VAR fori = 0; fori <vars. length; fori ++)
{
If (fori = 0)
{
$ E ("buyurl"). vars + = vars [fori]. Sn + $ E ("vas"). Value + (vars [fori]. value );
} Else
{
$ E ("buyurl "). vars + = $ E ("VVS "). value + vars [fori]. sn + $ E ("vas "). value + (vars [fori]. value );
}
}

Showtext ("parameter link <br>" + $ E ("buyurl"). vars );
} Else
{
$ E ("buyurl"). vars = "";
$ E ("joinvarb"). value = "Link parameter ";
Showtext ("parameter string cleared ");
}
}

Window. islogin = function ()
{
Try
{
Return (window.win.doc ument. Body. innertext. indexof ("standard Logon") <0 );
} Catch (E)
{
Showtext ("unable to detect logon, please check whether the webpage opened is normal .");
Return false;
}
}

Window. sjsjtosubmit = function ()
{// Keep taking snapshots

If ($ E ("ksqp"). value = "continuously seek ")
{
Showtext ("Note: it is best to perform this operation on the injected page, because HTA loses the login information once it changes the page after login, = is equivalent to not logging on ,"
+ "When XMLHTTP retrieves XX pages, the server returns blank information when it is redirected to the YY page .");
If ($ E ("buyurl"). vars = "") showtext ("NOTE: The parameter string is empty .");
If ($ E ("buyurl"). value. Length <10) return showtext ("Enter the URL, which generally cannot be less than 10 characters long, such as http://x.x .");
$ E ("ksqp"). value = "stop ";
Sendrequestget ();
} Else
{
$ E ("ksqp"). value = "stop bidding ";
Xmlabor ();
}

}

Window. sendrequestget = function ()
{
Window. XMLHTTP. onreadystatechange = getstatechange;
/*
If ($ E ("buyurl"). vars! = "")
URL + = "& t =" + math. Random ();
VaR url = $ E ('bucyurl'). Value + $ E ('bucyurl'). vars + "& t =" + math. Random ();


If (gethost (URL )! = Location. HOST)
{
Showtext ("NOTE: XMLHTTP reads the domain name [" + gethost (URL) + "] and the domain name on this page ["
+ Location. Host + "] Different, non-HTA pages prohibit cross-origin reading. Note the operation! ");
Return false;
}
Showtext ("start to use XMLHTTP to retrieve forms... URL: <br>" + URL );
*/
Window. XMLHTTP. open ("get", $ E ('bucyurl '). value + $ E ('bucyurl '). vars + "& t =" + math. random (), true );
// Showtext ("Get succeeded ");
// Window. XMLHTTP. setRequestHeader ("Content-Type", "text/html ");
// Window. XMLHTTP. setRequestHeader ("Accept-charset", "gb2312 ");
// Window. XMLHTTP. setRequestHeader ("Accept-language", "ZH-CN ");
Window. XMLHTTP. Send ();
// Showtext ("Send complete ");
}

Window. xmlabor = function ()
{
Cleartimeout (window. geter );
Clearinterval (window. Clicker );
Window. XMLHTTP. Abort ();
// Showtext ("XMLHTTP aborted ");
}

Window. getstatechange = function ()
{
// If ($ E ("ksqp"). value! = "Stop snatching") return xmlabor ();

Switch (window. XMLHTTP. readystate)
{// 4 = "loaded"
/* Cancel as needed
Case 0:
Showtext ("XMLHTTP object already exists ");
Break;
Case 1:
Showtext ("XMLHTTP object initialization ");
Break;
Case 2:
Showtext ("XMLHTTP object sent data ");
Break;
Case 3:
Showtext ("XMLHTTP object data transmission ");
Break;
*/
Case 4:
// Showtext ("XMLHTTP object data received ");

Switch (window. XMLHTTP. Status)
{
Case 200:
// Showtext (window. XMLHTTP. getAllResponseHeaders (); // open it when you need to view the Received Header
// Var gform =/<form. * "mainform" [/S] * </form>/I .exe C (window. XMLHTTP. responsetext );

Try
{
$ E ("formd "). innerhtml = '<form name = "mainform" class = "Trade: confirminfoform" id = "mainform" Action = "http://ebay.com" method = "Post" target = _ blank>'
+ Window. XMLHTTP. responsetext. split ('<form name = "mainform" class = "Trade: confirminfoform" id = "mainform" Action = "http://ebay.com" method = "Post">') [1]. split ('</form>') [0] + "</form> ";


Window. Clicker = setinterval (function (){
Try {
Document. getelementbyid ("receivmsubmit"). Click ();
Clearinterval (window. Clicker );
Sjsjtosubmit ();
} Catch (e ){}
}, 1 );
} Catch (E)
{
Xmlabor ();
Window. geter = setTimeout ("sendrequestget ();", 1 );
}


/*
VaR gform = Window. XMLHTTP. responsetext. indexof ('name = "mainform" '); // view the unique character in the source file. Determine
If (gform>-1)
{// Unique form character
// Showtext ("form appears ");
// Showtext ("generate Fun <br> write read content ...");
Window. Times = 0;
If ($ E ("autopai"). Checked)
Window. Clicker = setinterval (function (){
Try {
Document. Title = Window. Times ++;
Document. getelementbyid ("receivmsubmit"). Click ();
Document. Title = Window. Times ++;
Clearinterval (window. Clicker );
} Catch (e) {document. Status = Window. Times ++ ;}
}, 1 );
$ E ("formd"). innerhtml = Window. XMLHTTP. responsetext;
Sjsjtosubmit ();
} Else
{
// Showtext ("XMLHTTP returned non-conforming .");
Xmlabor ();
Window. geter = setTimeout ("sendrequestget ();", 1 );
}

*/
Break;
Case 0:
Showtext ("the page may have redirection... failed to get! Check whether the address returned on the page is the same as the address submitted. If you are not logged on, The address will be redirected to the logon page .");
Break;
Default:
Showtext ("XMLHTTP. Status :"
+ Window. XMLHTTP. Status
+ "[" + Window. XMLHTTP. statustext + "]"
+ "<Br>" + window. XMLHTTP. responsetext
);
// Sjsjtosubmit ();
}
Break;
}

}

Window. getxmlhttp = function ()
{
If (window. XMLHttpRequest)
{// Code for all new browsers
Window. XMLHTTP = new XMLHttpRequest ();
} Else if (window. activexobject)
{// Code for ie5 and IE6
Window. XMLHTTP = new activexobject ("Microsoft. XMLHTTP ");
}

If (window. XMLHTTP = NULL)
{
Showtext ("your browser does not support XMLHTTP, creation failed .");
Return false;
}

Showtext ("XMLHTTP created successfully .");
}

Window. sendbuy2 = function ()
{
Try
{
Window.swin.document.doc umentelement. outerhtml;
} Catch (E)
{
Showtext ("The swin object does not exist, create .");
Window. swin = open ("http: // http://ebay.com", "swin ");
}

If (window. swin = NULL)
{
Showtext ("An error occurred while creating the window. Does the browser block the pop-up window? Please allow this webpage to pop up .");
Return 0;
}

VaR temfun = '<SCRIPT' + '>/N'
+ 'Times = 1000; setinterval (/'try {If (document. getelementbyid ("checkcode") | (times -- = 0) Try {opener. sendrequestget ();} catch (e) {document. title = "An error occurred while re-executing the read operation. ";}; else document. getelementbyid ("receivmsubmit "). click (), setTimeout ("opener. sendrequestget (); ", 5000);} catch (e) {document. title = "An error occurred while executing click. ";}/', 10 );'
+ '</Script' +'>/N ';
Showtext ("generate Fun <br> write read content ...");
Response response swin.doc ument. Body. innerhtml = temfun + window. XMLHTTP. responsetext;
Showtext ("Write completed .");
}

//-------------
$ E ("MSG"). innerhtml = "";
Getxmlhttp ();
$ E ("buyurl"). value = "http://ebay.com ";
$ E ("Winn"). value = "win ";
$ E ("joinvarb"). value = "Link parameter ";
Joinvar ();
Window. onerror = Window. errfun;
Setinterval ('showin32 (); ', 1000 );
Showtext ("complete global function startup .");
// Start global
</Textarea>

</Body>
</Html>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.