Skorm Posted April 8, 2013 Share Posted April 8, 2013 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 Link to comment Share on other sites More sharing options...
KaFu Posted April 8, 2013 Share Posted April 8, 2013 Take a look at the examples in the help-file for the functions HttpSetUserAgent(), InetGet() and InetRead(). OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Skorm Posted April 8, 2013 Author Share Posted April 8, 2013 (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 April 8, 2013 by Skorm Link to comment Share on other sites More sharing options...
KaFu Posted April 8, 2013 Share Posted April 8, 2013 (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 April 8, 2013 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
guinness Posted April 9, 2013 Share Posted April 9, 2013 I touched on this literally a couple of days ago >> UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Skorm Posted April 10, 2013 Author Share Posted April 10, 2013 (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.0Then the website it still loaded perfectly normal..My current code to test it:expandcollapse popup#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 April 10, 2013 by Skorm Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now