Jump to content

Recommended Posts

Posted

Hello AutoIt Community!

I'd like to ask for some help in spoofing the User Agent string so website('s) recognize it and act on what User agent they see.

Currently I'm developing a website that's about a Radio Stream.

I'd like to add a desktop client for it which loads the website.

For that I want the website to recognize the client and load another theme for that. The only way I know to script this is by checking the useragent and loading another theme for that.

I'm already that far that it loads up a Mobile theme if you browse with a Mobile Device

Now I'd like to spoof the User Agent that the website can see and load the designated theme for it.

I found some scripts via Google that redirects me to the autoit forums. But my knowledge about AutoIt is not at a certain point that allows me to embed this myself.

So therefor I'd like to ask the Auto It community for support!

Thank you all in advance!

Skorm

Posted (edited)

I tried that, But somehow the user agent checkers still recognize IE7.

Or I'm doing something really wrong here.

Piece of the current code:

#include  ;~ Files to be
#include  ;~ Included
#include  ;~
#include  ;~
Global $OBJexists[10], $OBJbank[10] ,$OBJ[10] ,$page[10] , $link[7][3] ,$loads = 1 ,$x = 0 ,$tab = 0 ; Declared Variables
HttpSetUserAgent("Testagent")
$link[0][0] = IniRead(@scriptdir&"\config.ini","home","use","1") ;
$link[0][1] = IniRead(@scriptdir&"\config.ini","home","tag","Home") ; Customise Hompage
$link[0][2] = IniRead(@scriptdir&"\config.ini","home","url","http://www.google.com") ;
Edited by Skorm
Posted (edited)

This works fine for me:

HttpSetUserAgent("UserAgent Test 1.0")
MsgBox(0, "", BinaryToString(InetRead("http://counter.yadro.ru/cgi/user-agent")))

Edit:

InetRead <> IniRead, use InetRead() to download to binary string (transform as shown above) & InetGet to download to file.

Edited by KaFu
Posted

I touched on this literally a couple of days ago >>

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted (edited)

I'm still unable to get it working,

If i set the string to:

Opera/12.02 (Android 4.1; Linux; Opera Mobi/ADR-1111101157; U; en-US) Presto/2.9.201 Version/12.0

Then the website it still loaded perfectly normal..

My current code to test it:

#include
#include
HttpSetUserAgent("Opera/12.02 (Android 4.1; Linux; Opera Mobi/ADR-1111101157; U; en-US) Presto/2.9.201 Version/12.02")
Opt('MustDeclareVars', 1)

Example()

; Simple example: Embedding an Internet Explorer Object inside an AutoIt GUI
;
; See also: http://msdn.microsoft.com/workshop/browser/webbrowser/reference/objects/internetexplorer.asp
Func Example()
Local $oIE, $GUIActiveX, $GUI_Button_Back, $GUI_Button_Forward
Local $GUI_Button_Home, $GUI_Button_Stop, $msg

$oIE = ObjCreate("Shell.Explorer.2")

; Create a simple GUI for our output
GUICreate("Embedded Web control Test", 640, 580, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
$GUIActiveX = GUICtrlCreateObj ($oIE, 10, 40, 600, 360)
$GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30)
$GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30)
$GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30)
$GUI_Button_Stop = GUICtrlCreateButton("Stop", 330, 420, 100, 30)

GUISetState() ;Show GUI

$oIE.navigate("http://www.realhardstyleradio.nl")

; Waiting for user to close the window
While 1
$msg = GUIGetMsg()

Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $GUI_Button_Home
$oIE.navigate("http://www.realhardstyleradio.nl")
Case $msg = $GUI_Button_Back
$oIE.GoBack
Case $msg = $GUI_Button_Forward
$oIE.GoForward
Case $msg = $GUI_Button_Stop
$oIE.Stop
EndSelect

WEnd

GUIDelete()
EndFunc ;==>Example
Edited by Skorm

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...