Sign in to follow this  
Followers 0
drego

My Amazing Proxy Set Function - Need a Bit of Help

15 posts in this topic

#1 ·  Posted (edited)

This problem has been figured out. Was very easy and no need for this thread anymore.

Edited by drego

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

This problem has been figured out. Was very easy and no need for this thread anymore.

Edited by drego

Share this post


Link to post
Share on other sites

Well, just comparing the function to msdn, I know that the dwBufferLength (3rd param in dllcall()) is wrong.  It shouldn't be DllStructGetSize, it should be StringLen.

I'm still reading up on your issue though, I am in need of something like this soon myself.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

This problem has been figured out. Was very easy and no need for this thread anymore.

Edited by drego

Share this post


Link to post
Share on other sites

It's not a solution that's been found easily it seems around the net for that particular urlmon.dll function.  I haven't found anyone that has gotten it working as of yet with username/password.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

This problem has been figured out. Was very easy and no need for this thread anymore.

Edited by drego

Share this post


Link to post
Share on other sites

Still others may would have benefited from this thread, dont just edit out the questions, and your progress when you find your solution, noone else can use it then.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

For the record, here's the thread from yesterday from my cache.

 

I currently have a function I put together with the help of some users from a long time ago. It uses urlmon.dll to set a proxy for the active program meaning that you don't have to change the global IE proxy setting, you can have a different proxy for each autoit program you have running simultaniously. It's been a long time and I remember a bit of how to use it but I do remember that I never had to login to the proxies I was using. Now I do so I could use some help with how to make an authenticated HTTP proxy connection. Here's the function and how I would normally call it to set a SOCKS5 proxy. Note that now I need to use HTTP proxies with authentication:
Func SetProxy($proxy, $proxybypass = "")


    Local $INTERNET_OPTION_PROXY = 38


    Local $INTERNET_OPEN_TYPE_PROXY = 3


    Local $tBuff = DllStructCreate("dword;ptr;ptr")


    DllStructSetData($tBuff, 1, $INTERNET_OPEN_TYPE_PROXY)


    Local $pproxy = DllStructCreate("char[" & (StringLen($proxy) + 1) & "]")


    DllStructSetData($pproxy, 1, $proxy)


    DllStructSetData($tBuff, 2, DllStructGetPtr($pproxy))


    Local $pproxybypass = DllStructCreate("char[" & (StringLen($proxybypass) + 1) & "]")


    DllStructSetData($pproxybypass, 1, $proxybypass)


    DllStructSetData($tBuff, 3, DllStructGetPtr($pproxybypass))


    $chk_UrlMkSetSessionOption = DllCall("urlmon.dll", "long", "UrlMkSetSessionOption", "dword", $INTERNET_OPTION_PROXY, "ptr", DllStructGetPtr($tBuff), "dword", DllStructGetSize($tbuff), "dword", 0)


EndFunc






SetProxy('socks=127.0.0.1:8080')


So there's that which is pretty impressive for an autoit app as far as embedded browser proxies go. I just dug all this up because I need to use it like I said so any suggestions for how to specify http and username/password would be great. The first thing I'm obviously going to try is http=ip:port:username:pass but of course things don't always turn out so easy. I doubt that will work but I'm about to try and in the meantime if anyone knows the exact answers to this or can improve it in any way please feel free to post.


Thanks everyone.


Edited by drego, Today, 08:57 PM.
Like This
Quote
MultiQuote
Report
#2  My Amazing Proxy Set Function - Need a Bit of Help: post #2 drego
Seeker


Active Members
35 posts
Posted Today, 09:52 PM
Now I can't get it to work again at all. There are no errors but the proxy doesn't get set. I used
SetProxy('mypoxyip:64954:username:pass123')


And it didn't do anything. The embedded browser's IP didn't change at all. I was expecting it to show me an error in the browser control but it just navigated to the site using my normal public IP. It used to work. Not sure what's going on.


Like This
Quote
MultiQuote
Report
#3  My Amazing Proxy Set Function - Need a Bit of Help: post #3 SmOke_N
It's not what you know ... It's what you can prove!


Moderators


16,247 posts
Posted Today, 10:23 PM
Well, just comparing the function to msdn, I know that the dwBufferLength (3rd param in dllcall()) is wrong.  It shouldn't be DllStructGetSize, it should be StringLen.


I'm still reading up on your issue though, I am in need of something like this soon myself.


Like This
Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Quote
MultiQuote
Report
#4  My Amazing Proxy Set Function - Need a Bit of Help: post #4 drego
Seeker


Active Members
35 posts
Posted 44 minutes ago
That's the 9th parameter in the call. Can you show me what you mean? If you can help me get this function working again it would help a lot. I'm not sure how I wound up with a messed up version of it. This is the page I'm sure you're referring to: http://msdn.microsoft.com/en-us/library/ms775125(VS.85).aspx


This is the original thread years ago where the code started: http://www.autoitscript.com/forum/topic/122933-need-help-using-urlmondll-please/?hl=%2Burlmon+%2Bproxy#entry854193


In that thread it is used for the user agent and proxy. Please post any modifications you can think of so we can fix it. It's the only way to set a proxy for your program.


Like This
Quote
MultiQuote
Report
#5  My Amazing Proxy Set Function - Need a Bit of Help: post #5 SmOke_N
It's not what you know ... It's what you can prove!


Moderators


16,247 posts
Posted 41 minutes ago
It's not a solution that's been found easily it seems around the net for that particular urlmon.dll function.  I haven't found anyone that has gotten it working as of yet with username/password.


Like This
Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Quote
MultiQuote
Report
#6  My Amazing Proxy Set Function - Need a Bit of Help: post #6 drego
Seeker


Active Members
35 posts
Posted A minute ago
SmOke_N, on 18 Jan 2015 - 10:47 PM, said:
It's not a solution that's been found easily it seems around the net for that particular urlmon.dll function.  I haven't found anyone that has gotten it working as of yet with username/password.


I just got it to work with TOR (Tor doesn't use username/password) using the exact function I posted. You said there was an error in my function? If something is wrong can you post the modified function?


About logins: Do you think it's possible that a new option needs to be set when calling the DLL?

EDIT:

drego "figured out" that his proxy was broke, and the function by Electon in >this post was the solution.

 

Here it is formatted.

Func _SetProxy($proxy, $proxybypass = "")
    Local $INTERNET_OPTION_PROXY = 38
    Local $INTERNET_OPEN_TYPE_PROXY = 3
    Local $tBuff = DllStructCreate("dword;ptr;ptr")
    DllStructSetData($tBuff, 1, $INTERNET_OPEN_TYPE_PROXY)
    Local $pproxy = DllStructCreate("char[" & (StringLen($proxy) + 1) & "]")
    DllStructSetData($pproxy, 1, $proxy)
    DllStructSetData($tBuff, 2, DllStructGetPtr($pproxy))
    Local $pproxybypass = DllStructCreate("char[" & (StringLen($proxybypass) + 1) & "]")
    DllStructSetData($pproxybypass, 1, $proxybypass)
    DllStructSetData($tBuff, 3, DllStructGetPtr($pproxybypass))
    $chk_UrlMkSetSessionOption = _
            DllCall("urlmon.dll", "long", "UrlMkSetSessionOption", _
            "dword", $INTERNET_OPTION_PROXY, _
            "ptr", DllStructGetPtr($tBuff), _
            "dword", DllStructGetSize($tBuff), _
            "dword", 0)
EndFunc   ;==>_SetProxy
Richard Robertson showed drego how to use it.

I'm not familiar with the code at all. I merely translated it from MSDN. I'll look around and see what I can find on SOCKS proxy.

Ok, pass the parameter like "socks=127.0.0.1:12345" And replace the IP and port with whatever you have.

Edited by JohnOne
2 people like this

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Uhm... SmOke_N will back me up on this. From the moment I requested the thread be deleted I was in private communication with him on how to improve it and create a UDF. We've been going back and forth about it since yesterday. Here's the thread: '?do=embed' frameborder='0' data-embedContent>>

There's no need for this thread anymore because we were coming up with something better. If you read my UDF thread (which has user-agent switching as well) you'll see why.

lol way to jump to conclusions guys.

This thread can be removed as it is redundant.

Edited by drego

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

And BTW I am Electron. ~YOUR MIND BLOWN~

Edited by drego

Share this post


Link to post
Share on other sites

This issue has been addressed.  Multiple accounts is against the forum rules, no need to ask me anything, I agree that posts should not be removed, and you should not have multiple accounts.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0

  • Similar Content

    • VIP
      By VIP
      I can not do anything with any user in the "Local Users Group"
      I tried from my account but I could not change my password (ie set new password)!
      But I was able to activate the Administrator account and I logged into the Administrator account and still could not do anything with my account! But I can set the password and disable the Administrator account from my account or Administrator.
      Any ideas? (Ignore the click on the Sign-in option in the Change Accout settings.)
       

    • kawliga751
      By kawliga751
      I am trying to script the opening of multiple tabs in IE with each tab having a separate login/password. I have been able to make a successful script that will open 3 separate IE sessions with the correct webpage and login or a script that will open 3 tabs in one session (which I want) but will not login. I have tried _IECreate, IEAttach etc. This is the script I am currently using . 
      #include <IE.au3> Const $navOpenInNewTab = 0x0800 Dim $oIE = _IECreate('http://asag.xxxxxxx.com/AAAA/index.htm') ;$o_IE.Navigate2('http://asag.xxxxxxx.com/apps/yyyyyyy/LogInSAG/login.asp', $navOpenInNewTab) ;$o_IE.Navigate2('http://asag.xxxxxxx.com/apps/yyyyyyy/LogInSAG/login.asp', $navOpenInNewTab) Call ("YYYYYYYSignIn") Func YYYYYYYSignIn () Local $username = _IEGetObjByName ($oIE,"uname") Local $password = _IEGetObjByName ($oIE,"pword") $oIE.Navigate2('http://asag.xxxxxxx.com/apps/xxxxxxx/LogInSAG/login.asp',2048) _IEFormElementSetValue ($username, "xxxxxxx") _IEFormElementSetValue ($password, "xxxxxxx") Send('{Enter}') EndFunc Call ("xxxxxxxSignIn") Func xxxxxxxSignIn () __IENavigate($oIE, "https://soa1gui.xxxxxxx.biz/gateway/NFServlet;jsessionid=1E3B8F6520DE0A1EC914A8ABB7E86341?NFH_MessageId=&NFH_Page=%2fpages%2fsearch%2fsearch.jsp", 1, 0x800) Local $domain = _IEGetObjByName ($oIE,"NF_CustomerID") Local $User_Name = _IEGetObjByName ($oIE,"NF_UserName") Local $Password = _IEGetObjByName ($oIE,"NF_Password") _IEFormElementSetValue ($domain, xxxxxxx") _IEFormElementSetValue ($User_Name, "xxxxxxx") _IEFormElementSetValue ($Password, "xxxxxxx") ;Send('{Enter}') EndFunc  
    • Fhelipe
      By Fhelipe
      Nothing More
    • CarlD
      By CarlD
      I'm a command-line kind of guy, and I write scripts primarily for myself.  Since many websites nowadays require strong passwords, I thought I'd write a simple password generator in AutoIt. I know that AutoIt mavens have written more elaborate pw generators; I offer mine for what it's worth. The compiled script, GenPass.exe, can be downloaded here. See below for Help text and source. Enjoy!
      Updates:
      2017-05-06: Default password changed to variable length of 13-22 characters; argument "1" no longer supported
                            When compiled as GenPW.exe, password is sent directly to the clipboard, no message box unless password generation fails.
      2017-05-05: Correction to bypass password generation if argument is ?|H|h
      2017-05-03: Added special argument 1 to generate a password of variable length (10-18 characters) including two (2) separator characters
      2017-05-02: Added option /S to set a (persistent) randomization seed
      Help:
      GenPass.exe|GenPW.exe -- CLD rev. 2017-05-06
      Generate a strong password and save it to the Windows clipboard
      Note: GenPW.exe has the same functionality as GenPass.exe, but
            sends the generated password directly to the clipboard.
            No message box is displayed (unless password generation fails).
        
      "Strong" means that the password contains random combinations of
      alphnumeric characters, including at least one uppercase letter
      (A-N,P-Z), one lowercase letter (a-k,m-z), and one number (0-9).
      (Generated passwords do not use uppercase O or lowercase l as
      these characters are easily confused with the numbers 0 and 1.)
      The length of the password is up to you (see Usage, below),
      but needless to say, the longer, the stronger.
      By default, GenPass generates a strong password of between 13
      and 22 characters that includes two of the following separator
      characters: $%&()*+,-./:;@[]_. Alternatively, you can supply a
      command-line argument in which any number n from 1 to 9 stands
      for a random sequence of alphanumeric characters of length
      n, and any other character stands for itself. Thus, you can
      include fixed words and other characters, such as separators,
      in the generated password. Spaces in the argument are converted
      to underscores. Here are some examples:
      Usage             Sample output
      -----             -------------
      GenPass           MqU26A*6dS-53r8
      GenPass 9         frdhPYDs9
      GenPass 58        weoXYHKxDI1uQ
      GenPass 5.5       UfA6j.43VBB
      GenPass 3-4-3     0I0-6gq4-njc
      GenPass 5,3.7     I2FSR,tRZ.fjeIsFy
      GenPass 3)5(3     UMf)m8513(CBq
      GenPass 3[haha]3  yLa[haha]P3y
      GenPass Yes way5  Yes_way1BsUh
      Seed Option (/S)
      ----------------
      Adding switch /S to the command-line argument causes GenPass to
      set a seed for the random generation of password characters. A
      bare /S sets a randomized seed which is written to disk in a file
      named GenPass.rnd; this seed is used for all subsequent launches
      of GenPass with the bare /S option. Alternatively, you can specify
      a seed (range -2^31 to 2^31-1) on the command line with /S [seed].
      Here are some examples:
      GenPass /S
      GenPass /S 33.3333
      GenPass 5,5,5 /S
      GenPass 5,5,5 /S 33.3333
      Note that any subsequent launch of GenPass without the /S option
      will cause GenPass.rnd to be deleted.
      Source:
      #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=GenPass.exe #AutoIt3Wrapper_UseUpx=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs GENPASS.AU3 -- AutoIt v3 CLD rev.2017-05-05 ------------------ Generate a strong password and save it to the clipboard >> Command GenPass ? for detailed help << ------------------------------------------------------- #ce #include <Clipboard.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <StringConstants.au3> AutoItSetOption("WinTitleMatchMode", -4) FileInstall ("d:\path\GenPass.htm", @ScriptDir & "\GenPass.htm", $FC_OVERWRITE) ; Template/Seed Local $sTemp = "" Local $bSeed = False, $fSeed=False If $CmdLine[0] Then $sTemp = $CmdLineRaw If $CmdLine[$CmdLine[0]] = "/s" Then $bSeed = True $sTemp = StringTrimRight($sTemp, 2) $sTemp = StringStripWS($sTemp, $STR_STRIPTRAILING) EndIf If $CmdLine[$CmdLine[0] - 1] = "/s" Then $bSeed = True $fSeed = $CmdLine[$CmdLine[0]] $sTemp = StringTrimRight($sTemp, 3 + StringLen($fSeed)) $sTemp = StringStripWS($sTemp, $STR_STRIPTRAILING) EndIf EndIf If Not $sTemp Then $sTemp = "8" If $sTemp = "1" Then $aSeps = StringSplit("#$%&()*+,-./:;@[]_", "") $sTemp = String(Random(3,6,1)) & $aSeps[Random(1,$aSeps[0],1)] & _ String(Random(2,4,1)) & $aSeps[Random(1,$aSeps[0],1)] & _ String(Random(3,6,1)) EndIf $sFn = @ScriptDir&"\GenPass.rnd" If $bSeed Then If Not $fSeed Then If Not FileExists($sFn) Then $fSeed = Random(-1.999^31,1.999^31,0) $h=FileOpen($sFn,2) If $h > -1 Then FileWrite($h,$fSeed) FileClose($h) Else Exit MsgBox($MB_ICONWARNING, @ScriptName, "Error opening " & $sFn) EndIf Else $h=FileOpen($sFn) If $h > -1 Then $fSeed=FileRead($h) FileClose($h) Else Exit MsgBox($MB_ICONWARNING, @ScriptName, "Error opening " & $sFn) EndIf EndIf EndIf SRandom($fSeed) Else If FileExists($sFn) Then FileDelete($sFn) EndIf ; Show help If StringInStr("?Hh", $sTemp) Then If WinExists("[REGEXPTITLE:GenPass.exe:.*]") Then WinActivate("[REGEXPTITLE:GenPass.exe:.*]") Else ShellExecute(@ScriptDir & "\GenPass.htm") EndIf Exit EndIf ; Main $sTemp = StringReplace($sTemp, " ", "_") $iC = 1 While $iC < 10001 $sPW = GenPW($sTemp) If $sPW Then ClipPut($sPW) If Not StringInStr (@ScriptName, "GenPW") Then _ MsgBox($MB_ICONINFORMATION, @ScriptName, $sPW & _ " saved to clipboard" & @CRLF & @CRLF & _ @ScriptName & " ? shows detailed help") Exit Else $iC += 1 EndIf WEnd Exit MsgBox($MB_ICONWARNING, @ScriptName, "Password generation failed!") ;------------------------------- Func GenPw($sTemplate) Local $aIn = StringSplit($sTemplate,"") Local $sOut = "" Local $sABC = _ "0123456789ABCDEFGHIJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz0123456789" Local $aAB = StringSplit($sABC, "") Local $bUC = 0, $bLC = 0, $bNR = 0 For $i = 1 To $aIn[0] If Int($aIn[$i]) Then $iK = $aIn[$i] For $j = 1 To $iK $iR = Random(1, $aAB[0],1) Select Case StringInStr("0123456789", $aAB[$iR]) $bNR = 1 Case StringInStr("ABCDEFGHIJKLMNPQRSTUVWXYZ", _ $aAB[$iR], $STR_CASESENSE) $bUC = 1 Case StringInStr("abcdefghijklmnpqrstuvwxyz", _ $aAB[$iR], $STR_CASESENSE) $bLC = 1 EndSelect $sOut &= $aAB[$iR] Next Else $sOut &= $aIn[$i] EndIf Next If ($bUC And $bLC And $bNR) Then Return $sOut Else Return 0 EndIf EndFunc  
    • Fenzik
      By Fenzik
      ; Title .........: Password
      ; AutoIt Version : 3.3.14.2
      ; Description ...: UDF to work with passwords. Mostly ported from Javascript at http:rumkin.com/tools/password/passchk.php and improved a bit
      ; Author(s) .....: Fenzik + Team Adaptech
      ; #CURRENT# =====================================================================================================================
      ;_Password_Generate
      ;_Password_GetcharsetSize
      ;_Password_GetEntropy
      ;_Password_IsCommonWord
      ;_Password_Startup
      ; ===============================================================================================================================
       
      It's my first UDF so please be nice.:)
       
      If somebody have better idea how to store common dictionary and frequency table please post here...
       
      Have fun!
       
      Fenzik
       
      Password.zip