Jump to content

How to strip a formated string from a txt file

Recommended Posts


I am attempting to write a script that pulls a formated string and throws it into a txt file....

The objective is to:

prompt the user for a url. (one that contains ip's and port numbers, i.e.

Download the source to a rawsource file (rawsource.txt)

search the text file for the format (please excuse wildcards) *.*.*.*:port (i.e. 80)

enumerate the results in another txt file (iplist.txt)

problems to overcome:

search the text file for the string in the format of *.*.*.*:port

how to return JUST the string (ex: 69.124.678.123:80)

i have considered some array voodoo including arrays seperated by "." and " " to sort through the results... but this seems rediculous... there must be a better way that i have not yet considered... I look forward to any help/education anyone can offer me.... (Thanks in advance) anyone that helps me with this will get some great high-anon proxies to play with :)

Edited by MadSc13ntist
Link to post
Share on other sites

Well that page is actually quite easy. Due to <pre></pre>

grr messed up first trying my advise, so here ya go, learn from examining the code.

URLDownloadToFile ("http://www.samair.ru/proxy/",$file) 



for $i=1 to $fileline[0]


edit, I meant not to do all your work, but that you can disassemble this to know how to do it in the future. It just sounded wrong when I looked at it.

Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to post
Share on other sites

Thank you all very very very much!


Larry: I can't beleive you've already helped me so much this morning, i work in IT and if we get ANY job postings that allow for Tele-commute i will PM it to you before we release it! Your Code Example is the shaz! i will enjoy it with your name in the source...

Trids: Very cool to know, i hope to work with it soon.. Hail AutoIt! The Windows-Based Response to Opensource! (screw WSH!)

ScriptKitty: Thanks for the code sample.... i can see what you mean. didn't see that before.. props.

High Anon Proxies:

---------------------- HTTP elite HTTP elite HTTP elite HTTP elite HTTP elite, SSL HTTP elite, SSL HTTP elite HTTP elite HTTP elite, SSL HTTP elite, SSL HTTP elite, SSL HTTP elite, SSL

If you are without proxy chaining software i can throw you some info that i'm sure will help you avoid detection..... :)

:) Again.... You all Rock...

Have Fun!

Link to post
Share on other sites

Just an example of using a lot of StringLeft, StringTrimleft, and StringInstr to do the job.

URLDownloadToFile ("http://www.samair.ru/proxy/",$file) 



for $i=1 to $fileline[0]

$portnum=StringTrimleft(Stringleft($fileline[$i],StringInstr($fileline[$i]," ")-1),StringInstr($fileline[$i],":"))

msgbox(0,"IP and port "&$i&" of "&$fileline[0],"port="&$portnum & @CRLF &"IP="& $ip)


AutoIt3, the MACGYVER Pocket Knife for computers.

Link to post
Share on other sites

here is the finished script (MUCH PROPS to Larry and everyone else that helped me!!!!)

This creates a proxy database text file that can be imported into "Proxy Checker v7.1" (from hell labs)... it allows one to enter the url of a site with daily proxies to a text-file listing of proxy servers to test.....

Import rawproxies.txt (created in the same directory that the program/script is stored/executed from) into Proxy checker v7.1.... and by checking "remove invalid proxies" let this run and it will give you a fresh list of active proxies...

You can then use these proxies to connect to the internet anonymously (in that the ip address you display will be that of the proxy server)... one step further now... by "chaining proxies", meaning connect through "proxy 2" by way of "proxy 1"... your level of anonymity grows exponentially with each proxy in the chain (and their level of anonymity)... think about it... if a hacker or the federal government decide they want to trace where you are they need to communicate with the owners of the proxy to figure out what IP is asigned to the one they traced back... (which is the IP the proxy asigned you)...

This also means that if the person tracerouting (tracing) you is using VisualRoute then you will appear to be traced just like in the movies.... He's in China sir! No... Russia!... Peru!..... still tracing sir.... we're still trying to contact someone at the server in Brazil sir! uh oh... he disconnected sir...... and most of those proxies don't keep logs or firewalls sir....

The Gift of anonymity.... and now... you can take the table scraps and turn them into the main course by sorting the proxies that have been swatted... and the proxies waiting to serve your personal protection...

here's the script:

;Proxy Info Stripper v1.0

;Created: 11.01.2004

;By: Larry (AutoIt Mod), personalized (barely) by MadSc13ntist

;Strips Proxy Info from a web page and into a txt file ready to import into Proxy Checker!

$url = InputBox("Please enter URL of raw list", "Please indicate the url where the list is posted:", "http://www.samair.ru/proxy")

InetGet( $url, "file.txt" )

$szBuffer = FileRead( "file.txt",FileGetSize( "file.txt" ) )

$aRRAY_of_Addresses = ParseStringForAddresses( $szBuffer )

MsgBox( 4096, "", "We have " & $aRRAY_of_Addresses[0]& " addresses." )

FileOpen(@ScriptDir & "\rawproxies.txt", 1)

For $n = 1 to $aRRAY_of_Addresses[0]


FileWriteLine(@ScriptDir & "\rawproxies.txt", $aRRAY_of_Addresses[$n])



Func ParseStringForAddresses( ByRef $szBuff )

  Dim $aRET[1]

  $aRET[0] = 0

  $i = StringInStr($szBuff,".")

  While $i

    ;LOOK FOR NUMBER ON BOTH SIDES OF "." and ":" in the next 12 characters

    If StringIsDigit(StringMid($szBuff,$i-1,1)) And StringIsDigit(StringMid($szBuff,$i+1,1)) And _

          StringInStr(StringMid($szBuff,$i,12),":") Then

        While StringIsDigit(StringMid($szBuff,$i-1,1))

          $i = $i - 1


        $szBuff = StringTrimLeft($szBuff,$i-1)

        $i = StringInStr($szBuff,":")

        While StringIsDigit(StringMid($szBuff,$i+1,1))

          $i = $i + 1


        ReDim $aRET[uBound($aRET)+1]

        $aRET[0] = UBound($aRET)-1


        $szBuff = StringTrimLeft($szBuff,$i)


        $szBuff = StringTrimLeft($szBuff,$i)


    $i = StringInStr($szBuff,".")


  Return $aRET


FileDelete(@ScriptDir & '\file.txt')

Props to all.... enjoy clean functional proxies! keep the Internet anonymous!

:) Mad Sc13ntist :)

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...