1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Automate Proxyfier IP changes (profile creator & changer) [SourceCode]

Discussion in 'Proxies' started by GeezNotThatGuy, Apr 20, 2013.

  1. GeezNotThatGuy

    GeezNotThatGuy Newbie

    Joined:
    Feb 7, 2013
    Messages:
    24
    Likes Received:
    5
    I had some trouble with a browser based bot using proxys. So i got the tip from SPPChristian to use Proxyfier which worked great.
    So in order to work with my bot, i needed somekind of automization that changes the proxys in Proxyfier when it is needed.
    So I coded a little script that:
    1. receives the IP, Port, Username, Password via the commandline parameter
    2. creates an profile for Proxyfier (IP handling is managed by profiles)
    3. starts/loads Proxyfier with that profile

    How to use:
    Put the programm in the Proxyfier folder (where you can find the Proxifier.exe).
    Run the Programm with the following commandline params: 1 <proxyip> <proxyport> <proxyusename> <proxypass>

    Thats it. Now Proxyfier automatically loads the fresh created profile we just created.

    I give you here the sourcecode, so that you can tweak, fix and optimize the programm after your likings.

    Code:
    switch $CmdLine[0]
        Case 1 to 5
            $type=$CmdLine[1]
            $ip=$CmdLine[2]
            $port=$CmdLine[3]
            $proxyXML='<Address>'&$ip&'</Address>'&(at)CRLF& _
          '<Port>'&$port&'</Port>'&(at)CRLF& _
          '<Options>48</Options>'&(at)CRLF
        case 4 to 5
            $user=$CmdLine[4]
            $pass=$CmdLine[5]
            $proxyXML=$proxyXML&'<Authentication enabled="true">'&(at)CRLF& _
            '<Username>'&$user&'</Username>'&(at)CRLF& _
            '<Password>'&$pass&'</Password>'&(at)CRLF& _
          '</Authentication>'&(at)CRLF
    EndSwitch
    
    if NOT IsDeclared ( "proxyXML" ) Then Exit
    
    ; Prepare Proxyfier XML
    $proxyfierXML='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'&(at)CRLF& _
    '<ProxifierProfile version="101" platform="Windows" product_id="1" product_minver="310">'&(at)CRLF& _
      '<Options>'&(at)CRLF& _
        '<Resolve>'&(at)CRLF& _
         ' <AutoModeDetection enabled="true" />'&(at)CRLF& _
          '<ViaProxy enabled="false">'&(at)CRLF& _
            '<TryLocalDnsFirst enabled="false" />'&(at)CRLF& _
          '</ViaProxy>'&(at)CRLF& _
         '<ExclusionList>%ComputerName%; localhost; *.local</ExclusionList>'&(at)CRLF& _
        '</Resolve>'&(at)CRLF& _
       '<ProxificationPortableEngine subsystem="32">'&(at)CRLF& _
          '<Location>BaseProvider</Location>'&(at)CRLF& _
          '<Type hotpatch="false">Modcopy</Type>'&(at)CRLF& _
        '</ProxificationPortableEngine>'&(at)CRLF& _
        '<ProxificationPortableEngine subsystem="64">'&(at)CRLF& _
          '<Location>Winsock</Location>'&(at)CRLF& _
          '<Type hotpatch="false">Prologue</Type>'&(at)CRLF& _
       ' </ProxificationPortableEngine>'&(at)CRLF& _
        '<Encryption mode="disabled" />'&(at)CRLF& _
        '<HttpProxiesSupport enabled="false" />'&(at)CRLF& _
        '<HandleDirectConnections enabled="false" />'&(at)CRLF& _
       ' <ConnectionLoopDetection enabled="true" />'&(at)CRLF& _
        '<ProcessServices enabled="false" />'&(at)CRLF& _
        '<ProcessOtherUsers enabled="false" />'&(at)CRLF& _
      '</Options>'&(at)CRLF& _
      '<ProxyList>'&(at)CRLF& _
        '<Proxy id="100" type="HTTPS">'&(at)CRLF& _
          $proxyXML&(at)CRLF& _
        '</Proxy>'&(at)CRLF& _
      '</ProxyList>'&(at)CRLF& _
      '<ChainList />'&(at)CRLF& _
      '<RuleList>'&(at)CRLF& _
        '<Rule enabled="true">'&(at)CRLF& _
          '<Name>Localhost</Name>'&(at)CRLF& _
          '<Targets>localhost; 127.0.0.1; %ComputerName%</Targets>'&(at)CRLF& _
          '<Action type="Direct" />'&(at)CRLF& _
        '</Rule>'&(at)CRLF& _
       ' <Rule enabled="true">'&(at)CRLF& _
          '<Name>Default</Name>'&(at)CRLF& _
          '<Action type="Proxy">100</Action>'&(at)CRLF& _
        '</Rule>'&(at)CRLF& _
      '</RuleList>'&(at)CRLF& _
    '</ProxifierProfile>'
    
    $proxyfierProfileFile=FileOpen("Profiles/IPswitchProfile"&$ip&".ppx",10)
    FileWrite($proxyfierProfileFile,$proxyfierXML)
    FileClose($proxyfierProfileFile)
    
    ;run Proxyfier
    ShellExecute((at)ScriptDir&"\Proxifier.exe","Profiles\IPswitchProfile"&$ip&".ppx silent-load",(at)ScriptDir)
    
    Do
    Sleep(500)
    until WinExists("IPswitchProfile")
    
    
    
    And yeah, it´s AutoIt code... I had to change the at-symbol to (at) because it triggers the "BHW New User not allowed to post Emailaddresses" spam protection.

    It´s very basic, but hopefully It saves someone out there some time and headaches :)

    In case you wonder where to get Proxyfier. Download the 30 Day trail from the official website or search for it here on BHW. I know that a free version is offered here somewhere.
     
    • Thanks Thanks x 1
  2. SPPChristian

    SPPChristian Jr. VIP Jr. VIP Premium Member

    Joined:
    Oct 20, 2012
    Messages:
    1,221
    Likes Received:
    239
    Location:
    United States
    Home Page: