Implementation method of VBS forged HTTP-REFERER _vbs

Source: Internet
Author: User
Tags set socket
In the test directory wrote a simple referer.php, the code is as follows
Copy Code code as follows:

<?php
if (!isset ($_server["Http_referer"]))
echo "No Referer";
Else
echo $_server["Http_referer"];
?>

If you click on the link above, the page will display a link to the Referer page.
Copy Code code as follows:

Set http = CreateObject ("Msxml2.xmlhttp")
Http.open "Get", "http://jb51.net/test/referer.php", False
Http.setrequestheader "Referer", "Http://jb51.net"
Http.send
WScript.Echo Http.responsetext

But if I use VBS to invoke the Msxml2.xmlhttp component to access this page, it returns no Referer. It's unbelievable, is my code wrong?

So Google a bit "VBS forged HTTP REFERER", found that most of the content and this article, do not see it is copied and pasted, you copy me, I copied you, copy to copy to do not know who is, and still wrong!
The first example of that article is the ASP's

Copy Code code as follows:

Dim http
Set Http=server.createobject ("MSXML2. XMLHTTP ")
Http.open "Get", Url,false
Http.setrequestheader "Referer", "http://www.fromdomain.cn/"
Http.send ()

I also thought that the ASP under the VBS and I directly double-click the operation of the VBS is not the same, ASP under the relatively cool, you can change referer. To this end I also installed a special IIS test, found that the return of the same is no Referer. Later, I see the following message, "Forgive me for the ASP is not familiar, give you what help, I check other information for reference to it", "This I did not play ASP, the code is only reference to, the ASP's not tested."

I really do not want to curse, not familiar you write also forget, at least test it, no test code you also have the nerve to post it? Later in the Qian Yi Network (the network looks good) to see a more reliable answer, referer in ASP and Ajax can not be set by the header to change.

Anger, since the XMLHTTP components can not, I use the socket to write the head of the bar! (Note: Not all computers are registered with the Winsock component)

Copy Code code as follows:

Set socket = WScript.CreateObject ("Mswinsock.winsock", "Winsock_")
Socket. RemoteHost = "Jb51.net"
Socket. RemotePort = 80
Socket. Connect
Todo
Wscript.Sleep 100
Loop
Sub Winsock_connect ()
data = "get/test/referer.php http/1.1" & VbCrLf &_
"Referer:http://jb51.net" & VbCrLf &_
"Host:jb51.net" & VbCrLf & VbCrLf
Socket. SendData data
End Sub
Sub Winsock_dataarrival (bytestotal)
Socket. GetData Str
WScript.Echo Utf8tounicode (str)
Wscript.Quit
End Sub

Utf8tounicode function is relatively long not posted, the previous article has been written. The test results are as follows:
Copy Code code as follows:

http/1.1 OK
Date:thu Nov 14:05:20 GMT
Server:apache
Transfer-encoding:chunked
Content-type:text/html
F
Http://jb51.net
0

It is certain that the forgery Referer succeeded, but the result of the return seems a little strange, what is the F and 0 of the Jb51.net front and the back line? (In fact, browser access is also the return, but the browser does not show to us) I guess f is the length of the Referer string, but the search for a half-day can not find an explanation. No matter, the forgery of success on the line, the result of ugly point is ugly.
Original: http://demon.tw/programming/vbs-http-referer.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.