Sign in to follow this  
Followers 0
d4rkdz

iexplorer useragent

17 posts in this topic

hello guys , sorry for always troubling you , i've got a problem with internet explorer user agent , to put it simply i want a way to change,i found a piece of code that change the useragent but it only works on embedded ie , because it only affects the running process AFAIK

i would've settled for this if not for the popup blocker not working when ie is embedded.

i've also tried the __IENavigate() function , but it only works for one request it doesn't even affect iframes

__IENavigate ($oIE,$url, 1, 0, "", "", "User-Agent:"&$agent & @CRLF)

Share this post


Link to post
Share on other sites



Use IEAttach first

can you please provide further explanation for i am still a noob

Share this post


Link to post
Share on other sites

d4rkdz,

Click on the function name to view the online documentation which is also in the help file included with the installation of AutoIt3.

_IEAttach()

Anonymous


Spoiler

censored.jpg

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

d4rkdz,

Click on the function name to view the online documentation which is also in the help file included with the installation of AutoIt3.

_IEAttach()

Anonymous

i did and i ended up with this code which still doesn't do the job

#include
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
_SetUserAgent("agent")


$t= _IEAttach("google")
MsgBox(0, "The URL", _IEPropertyGet($t, "locationurl"))

_IENavigate($t, "http://whatsmyuseragent.com")
Edited by d4rkdz

Share this post


Link to post
Share on other sites

d4rkdz,

Try this code and report any errors.

#include <IE.au3>

Local $oIE = _IEAttach("Google", "embedded")
If @error Then
    ConsoleWrite("Could not get a handle to the IE object. Error: " & @error & @CRLF)
EndIf
MsgBox(0, "The URL", _IEPropertyGet($oIE, "locationurl"))
_IENavigate($oIE, "https://ww.google.com", 1) ; Wait for the page to load before returning
If @error Then
    ConsoleWrite("Failed to navigate to specified window. Error: " & @error & @CRLF)
EndIf

Anonymous


Spoiler

censored.jpg

 

Share this post


Link to post
Share on other sites

Using internal functions in a UDF is a massive no no! The reason being is if a Dev or MVP decides to change the internal function, then there is no obligation to report the change compared to a UDF (documented) function.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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: 04/09/2015

Share this post


Link to post
Share on other sites

d4rkdz,

Please refrain from using racist remarks/hints in your posts. You may have found it humorous but other may not.

Anonymous


Spoiler

censored.jpg

 

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I personally can't see anything wrong with their posts.

Edit: OK, now I saw what could have been perceived with bad intentiona, but it didn't cross my mind like that.

Edited by guinness

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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: 04/09/2015

Share this post


Link to post
Share on other sites

d4rkdz,

Please refrain from using racist remarks/hints in your posts. You may have found it humorous but other may not.

Anonymous

oh i did not mean it in such a way at all sir , let me edit it

Share this post


Link to post
Share on other sites

d4rkdz,

That is more appropiate. Thank You

Anonymous


Spoiler

censored.jpg

 

Share this post


Link to post
Share on other sites

d4rkdz,

Try this code and report any errors.

#include <IE.au3>

Local $oIE = _IEAttach("Google", "embedded")
If @error Then
ConsoleWrite("Could not get a handle to the IE object. Error: " & @error & @CRLF)
EndIf
MsgBox(0, "The URL", _IEPropertyGet($oIE, "locationurl"))
_IENavigate($oIE, "https://ww.google.com", 1) ; Wait for the page to load before returning
If @error Then
ConsoleWrite("Failed to navigate to specified window. Error: " & @error & @CRLF)
EndIf

Anonymous

still what i want is to change the user agent and not to use an existing window to navigate so i don't see how does this help .

Share this post


Link to post
Share on other sites

d4rkdz,

There is a registry setting for that.

Would you mind installing an addon? http://www.howtogeek.com/howto/18450/change-the-user-agent-string-in-internet-explorer-8/

Anonymous

i thought that ie(8 and above) user-agent can't be changed from the registry anymore

as for the addon , UAPick crossed my mind already , however i couldn't operate it using autoit , i got to set it up , still i couldn't change the user agent using autoit , all i found was some registry keys

RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\InternetRegistry\REGISTRY\USER\S-1-5-21-1285864041-2306270481-2997880768-1000\Software\Bayden Systems\UAPick","OverrideEnabled","REG_DWORD",1)
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\InternetRegistry\REGISTRY\USER\S-1-5-21-1285864041-2306270481-2997880768-1000\Software\Bayden Systems\UAPick","OverrideUA","REG_SZ","agent")

Share this post


Link to post
Share on other sites

bump for help please

Share this post


Link to post
Share on other sites

#16 ·  Posted

I can't seem to find anything to helpful other than registry related stuff.

Read http://www.enhanceie.com/ua.aspx

Allegedly IE8+ will send a short version of the UA string stored in the registry.

Read http://msdn.microsoft.com/en-us/library/ms537503%28v=VS.85%29.aspx?ppud=4#UARegistry

If an IE process is running when you write the registry changes that will not take effect immediately and once the process finishes the registry settings will be overwritten with the ones currently being stored in memory. Ensure that there aren't any IE processes running before attempting to modify the registry configuration. I have read reports where users running IE8 and have changed the UA string VIA registry successfully however in some cases the changes are undone after a reboot. If you have problems than write the appropiate keys in HKLM, HKCU and if Mozilla Firefox isn't an option for you which it should be then create a startup script to reset the configuration. I would put a script of that time in HKLMSoftwareMicrosoftWindowsCurrent VerstionRun <- I'm really calling that path from memory so don't quote me but its not to hard to find.

This are the keys that need to be changed.

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent]
"Version"="MSIE 8.0"
"Platform"="Windows NT 6.0"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Internet Settings\User Agent\Post Platform]
"SV1"=-
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Version Vector]
"IE"="8.0000"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent]
"Version"="MSIE 8.0"
"Platform"="Windows NT 6.0"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\User Agent\Post Platform]
"SV1"=-
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Version Vector]
"IE"="8.0000"

Here is another example of what can be written in the first location in reg script above.

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent
    default:  Mozilla/5.0
    Compatible:  Windows; U
    Version:  Windows NT 5.1
    Platform:  en-US; rv:1.7.12

If you can't utilize this information than I'm going to advise you look at the IE object which has a member function to set the UA string but I'm thinking thats per session wise.


Spoiler

censored.jpg

 

Share this post


Link to post
Share on other sites

#17 ·  Posted

Im just wondering, are you using this to download files? If so, you could use HTTPSETUSERAGENT with Inetget

Share this post


Link to post
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
Sign in to follow this  
Followers 0