Jump to content

Referrer set and user agent


Recommended Posts

Hi,

I researched a bit, but unfortunately I can not find how to set the correct parameter referrer.

How can i set http header referrer?

I made a simple interface, maybe someone could help me.

I found this parameters but not working good....

https://en.wikipedia.org/wiki/List_of_HTTP_header_fields
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#NoTrayIcon

Local $oIE = _IECreateEmbedded()
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 610, 542, 424, 114)
GUICtrlCreateObj($oIE, 8, 112, 596, 420)
$Label1 = GUICtrlCreateLabel("Referrer:", 8, 8, 65, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Input1 = GUICtrlCreateInput("http://en.wikipedia.org/wiki/Main_Page", 96, 8, 505, 21)
$Label2 = GUICtrlCreateLabel("User Agent: ", 8, 32, 89, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Input2 = GUICtrlCreateInput("Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20100101 Firefox/21.0", 96, 32, 505, 21)
$Button1 = GUICtrlCreateButton("Browsing...", 8, 80, 75, 25)
$Label3 = GUICtrlCreateLabel("Navigate:", 8, 56, 71, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Input3 = GUICtrlCreateInput("http://website.com", 96, 56, 505, 21)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $oIE.Navigate2(GUICtrlRead($Input3), Default, Default, Default, 'Referer: "http://website.com"')
    EndSwitch
WEnd

 

Thank you for your time!

Edited by incepator
Link to post
Share on other sites

I need this function for a personal project.
Exist a software, "Ubot Studio", which has this function predetermined and i want to do a software like this in autoit, but only for their own use.

I can do all other elements, except for the referrer and user agent functions.

I would be grateful if you could help me, if you do not make public the source code, I understand you, give me a private message.

Link to post
Share on other sites

OK, I give you a way, even if I don't know if this request is legitimate of not...

$oIE.Navigate2(GUICtrlRead($Input3), Default, Default, Default, 'User-Agent: ' & GUICtrlRead($Input2) & @CRLF & 'Referer: ' & GUICtrlRead($Input1) )
Link to post
Share on other sites

Hi again,

It seems to work ..and not..

Why not appear these data in IE, on the website http://whatsmyuseragent.com?
See also pictures with firefox, to understand the difference.

This is my code:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#include <File.au3>
#NoTrayIcon

_ClearCookies()
$oIE = _IECreate("")
Sleep(1000)
$oIE.Navigate2("http://whatsmyuseragent.com/", Default, Default, Default, @CRLF & _
        "Accept-Charset: utf-8" & @CRLF & _
        "Accept-Encoding: gzip, deflate" & @CRLF & _
        "Accept-Language: en-US" & @CRLF & _
        "Connection: keep-alive" & @CRLF & _
        "Cookie: $Version=1; Skin=new;" & @CRLF & _
        "Content-Type: application/x-www-form-urlencoded" & @CRLF & _
        "Date: Tue, 15 Nov 1994 08:12:31 GMT" & @CRLF & _
        "Referer: http://www.bing.com" & @CRLF & _
        "TE: trailers, deflate" & @CRLF & _
        "User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)" & @CRLF & _
        "X-Requested-With: XMLHttpRequest" & @CRLF & _
        "Front-End-Https: on" & @CRLF & _
        "Proxy-Connection: keep-alive" & @CRLF & _
        "Access-Control-Allow-Origin: *" & @CRLF & _
        "Accept-Patch: text/example;charset=utf-8" & @CRLF & _
        "Allow: GET, HEAD" & @CRLF & _
        "Status: 200 OK")

Func _ClearCookies()
    ShellExecute("RunDll32.exe", "InetCpl.cpl,ClearMyTracksByProcess 2", "", "open", @SW_HIDE)
    $cookieFolders = _FileListToArray(@AppDataDir & "\Macromedia\Flash Player\#SharedObjects", "*", 2)
    If @error Then
        Return False
    Else
        For $i = 1 To UBound($cookieFolders) - 1
            $siteFolders = _FileListToArray(@AppDataDir & "\Macromedia\Flash Player\#SharedObjects\" & $cookieFolders[$i], "*", 2)
            For $j = 1 To UBound($siteFolders) - 1
                DirRemove(@AppDataDir & "\Macromedia\Flash Player\#SharedObjects\" & $cookieFolders[$i] & "\" & $siteFolders[$j], 1)
            Next
        Next
    EndIf
    Return True
EndFunc   ;==>_ClearCookies

 

screen.png

screen2.png

Link to post
Share on other sites
  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...