Jump to content
Sign in to follow this  
drego

My Amazing Proxy Set Function - Need a Bit of Help

Recommended Posts

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

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.


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.

Share this post


Link to post
Share on other sites

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.


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.

Share this post


Link to post
Share on other sites

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

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

Share this post


Link to post
Share on other sites

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

It is :) but members don't get threads deleted on demand in GHAS, because many other users are following them, that's why myself and others reacted as we did.

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.


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.

Share this post


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

  • Similar Content

    • By Stormgrade
      Hello.
      I'm french, sorry for my english.
      I release my project, a password manager : Password Keeper
      First I would like to thanks Guinness and Melba23 for their help, and I'm very sorry for those I forget, please remind me to add you.
      Well my program manage and crypt passwords, first I understand if you don't trust me for this kind of sensible software, but I remember you that all the the source files are at your disposal, fell free to explore them.
      The login is : admin and you can change it later
      How it work ? see Methode de cryptage en BDD.pdf in french
      login

       
      The main interface
      You can obviously add,modify and delete your entry, also you can search with keywords

      A password generator is included

      I won't update it anymore.
      It's a BSD license.
      Autoit version : 3.3.14.5
      Have a good day.
      Methode de cryptage en BDD.pdf Passwordkeeper.7z
    • By Simpel
      Hi,
      I wanted to use _GetLogonTime() by guinness (https://www.autoitscript.com/forum/topic/19370-autoit-wrappers/?do=findComment&comment=942069).
      #include <Date.au3> #include <Array.au3> ConsoleWrite(_GetLogonTime() & @LF) Func _GetLogonTime($sUserName = @UserName, $sComputerName = @ComputerName) ; Idea by trancexx: http://www.autoitscript.com/forum/topic/113611-if-isadmin-not-detected-as-admin/ Local $aRet = DllCall("netapi32.dll", "long", "NetUserGetInfo", "wstr", $sComputerName, "wstr", $sUserName, "dword", 11, "ptr*", 0) _ArrayDisplay($aRet) If @error Or $aRet[0] Then Return SetError(1, 0, False) Local $sHours = DllStructGetData(DllStructCreate("ptr;ptr;ptr;ptr;dword;dword;dword;ptr;ptr;dword;dword;dword;dword;ptr;dword;ptr;dword;dword;byte;dword", $aRet[4]), 18) DllCall("netapi32.dll", "long", "NetApiBufferFree", "ptr", $aRet[4]) Return _DateAdd("h", "-" & $sHours, _NowCalc()) EndFunc ;==>_GetLogonTime It always returns false.
      I displayed $aRet:
      [0]|2221
      [1]|mycomputer
      [2]|myuser
      [3]|11
      [4]|0x0000000000000000
      $aRet[4] shouldn't be 0x0000000000000000 right? Any help?
      Regards, Conrad
       
    • By Lourens
      Hi,
      I am looking for a way to automate login to a Internet Banking website (https://bank.tymedigital.co.za/) and all of the examples that I could found still do not solve my issue with this website.
      In order to Login, the user need to enter their Identity Number and Password the click the Login button.
      Inspecting the Elements in Chrome are as follow;
      Identity Number
      <input autocomplete="username" placeholder="Please enter your South African ID number" maxlength="13" type="tel" class="form-control" value=""> Password
      <input autocomplete="current-password" placeholder="Enter password" type="password" class="form-control" value=""> Button
      <button type="button" class="btn btn-yellow btn-block">Login</button> Any assistance or directing me to a solution will be appreciated.
      Thank you,
      Lourens
    • By nacerbaaziz
      hello all, and welcome to this tool
      the NB-Password_generator is a small tool which allow you to create a strong passwords
      with this tool you can create a random passwords using :
      1. capital letters
      2. small letters
      3. numbers
      4. symbols
      be sure that you can check any option that  you want and uncheck what you don't want to use
      this tool allow you to create a password from 6 letters to 150 lettersNB-Password_generator.zip
      at the end please accept my greetings
      am waiting for your commants
    • By Gowrisankar
      Dear members of the forum,
      I need to open excel files that may or may not need a password and finally move the files that needs password to manual queue.
      Is there a fastest way to do this?
       
      PS: I have a huge respect for the rules of this forum. I am not asking assistance to override any security measure. I just need to segregate the files that needs passwords.
×
×
  • Create New...