Jump to content

How to fully change user agent?


Recommended Posts

Long ago I tried to make program where I could fastly change user agent for IE embedded object in GUI.

Now when I need to change it again I found that my user agent string is full of unneeded strings:

Mozilla/4.0 (c; MSIE 7.0; cx; Trident/4.0; BTRS123646; GTB7.4; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SIE-ME75/22 UP.Browser/7.0.2.2.d.7(GUI) MMP/2.0 Profile/MIDP-2.0 Configuration/CLDC-1.1)

With this method: http://www.door2windows.com/how-to-change-internet-explorer-user-agent-string-in-all-versions-of-internet-explorer-without-any-tool/ I added '; SIE-ME75/22 UP.Browser/7.0.2.2.d.7(GUI) MMP/2.0 Profile/MIDP-2.0 Configuration/CLDC-1.1)" but now cant delete leaving blank in custom string imputbox.

 

Also tried:

http://www.zytrax.com/tech/web/change-ua.html

Both ways wont work.

 

Ie addon http://www.iegallery.com/Addons/Details/2040  works how I want but it wont change UA in embedded object.

 

Any ideas? How I can restore my UA to default if that 2 ways dont work?

(Check your UA here http://www.useragentstring.com/)

Edited by SherminatoR
Link to comment
Share on other sites

HttpSetUserAgent.

Search the Forum as I've documented a bit about the correct usage.

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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

HttpSetUserAgent.

Search the Forum as I've documented a bit about the correct usage.

"Sets the user-agent string sent with InetGet() and InetRead() requests."

Can I make it to work with _IECreateEmbedded() in direct browsing? not only for inet funcs?

 

Can't you also just remove the additional information from the registry?

HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionInternet Settings5.0User AgentPost Platform

 

Its empty

Edited by SherminatoR
Link to comment
Share on other sites

How about something like this:

Global Const $sLink = "http://whatsmyuseragent.com/"

Global $oObj = ObjCreate("Shell.Explorer.2")

GUICreate("Test User-Agent String", 700, 500)
GUICtrlCreateObj($oObj, 10, 10, 680, 480)

GUISetState()

$oObj.Navigate2($sLink, Default, Default, Default, 'User-Agent: "My super special user agent string."')

While GUIGetMsg() <> -3
WEnd

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

 

How about something like this:

Global Const $sLink = "http://whatsmyuseragent.com/"

Global $oObj = ObjCreate("Shell.Explorer.2")

GUICreate("Test User-Agent String", 700, 500)
GUICtrlCreateObj($oObj, 10, 10, 680, 480)

GUISetState()

$oObj.Navigate2($sLink, Default, Default, Default, 'User-Agent: "My super special user agent string."')
sleep(1500)
_IENavigate($oIE,"http://www.useragentstring.com/")
While GUIGetMsg() <> -3
WEnd

 

I need my user agent changed all time. 

#include <IE.au3>

Global Const $sLink = "http://useragentstring.com/"

GUICreate("Test User-Agent String", 700, 500)
_IEErrorHandlerRegister()
$oIE = _IECreateEmbedded()
GUICtrlCreateObj($oIE, 10, 10, 680, 480)
_IENavigate($oIE,"http://www.useragentstring.com/")
sleep(1000)
GUISetState()

$oIE.Navigate2($sLink,Default, Default, Default, 'User-Agent: My super special user agent string.')

While GUIGetMsg() <> -3
WEnd

If I refresh page then I see my old ua..

Edited by SherminatoR
Link to comment
Share on other sites

This should work

#include <IE.au3>

GUICreate("Test User-Agent String", 700, 500)
_IEErrorHandlerRegister()
$oIE = _IECreateEmbedded()
GUICtrlCreateObj($oIE, 10, 10, 680, 480)
_SetUserAgent('User-Agent: My super special user agent string.')
_IENavigate($oIE,"http://www.useragentstring.com/")
sleep(1000)
GUISetState()

While GUIGetMsg() <> -3
WEnd

Func _SetUserAgent($agent)
    $agentLen = StringLen($agent)
    Dim $tBuff = DllStructCreate("char["&$agentLen&"]")
    DllStructSetData($tBuff, 1, $agent)
    $chk_UrlMkSetSessionOption = DllCall("urlmon.dll", "long", "UrlMkSetSessionOption", "dword", 0x10000001, "ptr", DllStructGetPtr($tBuff), "dword", $agentLen, "dword", 0)
EndFunc
Link to comment
Share on other sites

 

This should work

#include <IE.au3>

GUICreate("Test User-Agent String", 700, 500)
_IEErrorHandlerRegister()
$oIE = _IECreateEmbedded()
GUICtrlCreateObj($oIE, 10, 10, 680, 480)
_SetUserAgent('User-Agent: My super special user agent string.')
_IENavigate($oIE,"http://www.useragentstring.com/")
sleep(1000)
GUISetState()

While GUIGetMsg() <> -3
WEnd

Func _SetUserAgent($agent)
    $agentLen = StringLen($agent)
    Dim $tBuff = DllStructCreate("char["&$agentLen&"]")
    DllStructSetData($tBuff, 1, $agent)
    $chk_UrlMkSetSessionOption = DllCall("urlmon.dll", "long", "UrlMkSetSessionOption", "dword", 0x10000001, "ptr", DllStructGetPtr($tBuff), "dword", $agentLen, "dword", 0)
EndFunc

It works! Thanks

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...