Jump to content

Proxy Formater?


Recommended Posts

How would i make something to format proxies from something such as this:

ip port
219.149.54.34 80 Proxy CN
202.56.253.183 8080 Proxy IN
206.240.24.20 3128 Proxy US
61.99.21.20 50050 Socks5 KR
61.99.22.59 50050 Socks5 KR
128.208.4.199   3127
84.16.238.92    3128    transparent     Germany     2006-03-28  Whois

To something like this

219.149.54.34:80
202.56.253.183:8080
206.240.24.20:3128
61.99.21.20:50050
61.99.22.59:50050
128.208.4.199:3127
84.16.238.92:3128

I wanna have it load a list of unformated proxies, format them to that form, and output them into another file.

Anyone have any ideas?

Link to comment
Share on other sites

HI,

maybe something like this. (You have to build the read and write funcs :) )

I would prefer reading the file into an array, then you could use the for loop I made.

#include<Array.au3>
Dim $avArray[8] 
$avArray[0] = "219.149.54.34 80 Proxy CN"
$avArray[1] = "202.56.253.183 8080 Proxy IN"
$avArray[2] = "206.240.24.20 3128 Proxy US"
$avArray[3] = "61.99.21.20 50050 Socks5 KR"
$avArray[4] = "61.99.22.59 50050 Socks5 KR"
$avArray[5] = "61.99.22.59 50050 Socks5 KR"
$avArray[6] = "128.208.4.199    3127"
$avArray[7] = "84.16.238.92  3128    transparent     Germany     2006-03-28  Whois"

for $i = 0 To UBound($avArray)-1 
MsgBox(0, $i & " Proxy", formatProxy($avArray[$i]))
Next

Func formatProxy($s)
    Dim $s2 = StringSplit(StringReplace(StringStripWS($s,4), " ", ":", 1)," ")
    return $s2[1]
EndFunc

Hope that helps.

So long,

Mega

Edited by th.meger

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Thanks for your help :) Worked great!!

Heres what i did:

#include<Array.au3>
#include<File.au3>

$filename = InputBox("Proxy Formater", "Please enter the filename of your proxy list to be formated." & @CRLF & @CRLF & "Note: Must be in the same directory as the program", "list.txt")
$open = FileOpen($filename, 0)
$file = FileReadLine($open)
$prArray = _ArrayCreate($file)
For $p = 0 To _FileCountLines($filename)
    $proxy = FileReadLine($open, $p)
    _ArrayAdd($prArray, $proxy)
Next
FileClose($open)

For $i = 1 To UBound($prArray) - 1
    If Not FileExists("ProxyList.html") Then
        _FileCreate("ProxyList.html")
    EndIf
    $list = FileOpen("ProxyList.html", 1)
    FileWrite("ProxyList.html", FormatProxy($prArray[$i]) & "<br>")
    FileClose($list)
Next

Func FormatProxy($s)
    Dim $s2 = StringSplit(StringReplace(StringStripWS($s, 4), " ", ":", 1), " ")
    Return $s2[1]
EndFunc ;==>FormatProxy

Incase anyone else wants to format some proxies hehe

It takes a long time on very large lists, but it gets them done :mellow:

I just formated a list of proxies from non-standard form to standard form.. The list contained 39,000 proxies :)

Edited by jackyyll
Link to comment
Share on other sites

Hmmm (sory for the triple post) but i just noticed a problem (didnt notice it before since the list is so large, but it didnt convert some of them into standard form. :mellow:

The string function doesnt seem to work on the proxies that look like this:

194.154.214.173 80
193.63.75.18    3127
193.63.75.18    3128
150.165.15.18   3128
140.109.17.181  3128
221.62.52.181   8080
171.66.3.182    3127
171.66.3.182    3128
69.143.219.172  2301
140.109.17.180  3127
140.109.17.180  3128
211.194.223.187 22286
199.77.128.193  3128
132.252.152.193 3128
171.66.3.181    3124
140.109.17.181  3124
193.63.75.19    3127
62.213.85.19    3128
193.63.75.19    3128
150.165.15.19   3128

It will display this:

194.154.214.173 80
194.154.214.173 80
193.63.75.18 3127
193.63.75.18 3128
150.165.15.18 3128
140.109.17.181 3128
221.62.52.181 8080
171.66.3.182 3127
171.66.3.182 3128
69.143.219.172 2301
140.109.17.180 3127
140.109.17.180 3128
211.194.223.187 22286
199.77.128.193 3128
132.252.152.193 3128
171.66.3.181 3124
140.109.17.181 3124
193.63.75.19 3127
62.213.85.19 3128
193.63.75.19 3128
150.165.15.19 3128

Other than that, it seems to work fine (as far as i can see since hte files is huge :))

Edited by jackyyll
Link to comment
Share on other sites

Hi,

where is the prob?

Works just fine for me. Check this.

#include<Array.au3>
Dim $avArray= StringSplit("219.149.54.34 80 Proxy CN,202.56.253.183 8080 Proxy IN,206.240.24.20 3128 Proxy US,61.99.21.20 50050 Socks5 KR,61.99.22.59 50050 Socks5 KR,194.154.214.173   80,193.63.75.18 3128,84.16.238.92    3128    transparent     Germany     2006-03-28  Whois,194.154.214.173  80,193.63.75.18 3127,193.63.75.18   3128,150.165.15.18  3128,140.109.17.181 3128,221.62.52.181  8080,171.66.3.182   3127,171.66.3.182   3128,69.143.219.172 2301,140.109.17.180 3127,140.109.17.180 3128",",")
_ArrayDisplay($avArray,"UnFormatted Array - Proxies")
for $i = 0 To UBound($avArray)-1 
$avArray[$i] = formatProxy($avArray[$i])
Next

_ArrayDisplay($avArray,"Formatted Array - Proxies")

Func formatProxy($s)
    Dim $s2 = StringSplit(StringReplace(StringStripWS($s,4), " ", ":", 1)," ")
    return $s2[1]
EndFunc

So long,

Mega

Edited by th.meger

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hi,

where is the prob?

Works just fine for me. Check this.

#include<Array.au3>
Dim $avArray= StringSplit("219.149.54.34 80 Proxy CN,202.56.253.183 8080 Proxy IN,206.240.24.20 3128 Proxy US,61.99.21.20 50050 Socks5 KR,61.99.22.59 50050 Socks5 KR,194.154.214.173   80,193.63.75.18 3128,84.16.238.92    3128    transparent     Germany     2006-03-28  Whois,194.154.214.173  80,193.63.75.18 3127,193.63.75.18   3128,150.165.15.18  3128,140.109.17.181 3128,221.62.52.181  8080,171.66.3.182   3127,171.66.3.182   3128,69.143.219.172 2301,140.109.17.180 3127,140.109.17.180 3128",",")
_ArrayDisplay($avArray,"UnFormatted Array - Proxies")
for $i = 0 To UBound($avArray)-1 
$avArray[$i] = formatProxy($avArray[$i])
Next

_ArrayDisplay($avArray,"Formatted Array - Proxies")

Func formatProxy($s)
    Dim $s2 = StringSplit(StringReplace(StringStripWS($s,4), " ", ":", 1)," ")
    return $s2[1]
EndFunc

So long,

Mega

Like i said, there seems to be a problem with the:

StringSplit(StringReplace(StringStripWS($s, 4), " ", ":", 1), " ")

Line... When it formats the things with a TAB (i beleive it's a tab altleast) it leaves one white space and doesnt replace it with a ":" like it should... Dont know why :)

Link to comment
Share on other sites

Ah I see, the magic word is TAB. For me it works great because there are spaces and no TAB. :)

I´ll have a look at it.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Ah I see, the magic word is TAB. For me it works great because there are spaces and no TAB. :)

I´ll have a look at it.

So long,

Mega

Hi,

next try.

Does that work?

Func formatProxy($s)
    Dim $s2= StringReplace($s, Chr(9), " ", 0,0)
    $s2 = StringSplit(StringReplace(StringStripWS($s2,4), " ", ":", 1)," ")
    return $s2[1]
EndFunc

or short way:

Func formatProxy($s)
    Dim $s2 = StringSplit(StringReplace(StringStripWS(StringReplace($s, Chr(9), " ", 0,0),4), " ", ":", 1)," ")
    return $s2[1]
EndFunc

Edit: The short way

So long,

Mega

Edited by th.meger

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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...