Jump to content

Recommended Posts

Posted

Hello masters, i really need your help, i tried to made one script, but i can't do it.

So please if someone find time to help me - thank you ;)

What i need? :

I had .txt file, here is example :

accounts.txt - and this look inside like that :

login1:password1
login2:password2
abcdefgh:12345
123323:11212121
blablablabla:1234567
1212122:1212121212
xxx123:milk123

What i need to do with that? i need get $login and $password, $login is word before ":" and $password is word behind ":"

I tried to made this with

$login[$i] = _StringBetween($line, "", ":")
                $password[$i] = _StringBetween($line, ":", "")

But that doesn't work ;)

Sorry for my bad englisch :)

Peace !

Posted

Hello masters, i really need your help, i tried to made one script, but i can't do it.

So please if someone find time to help me - thank you ;)

What i need? :

I had .txt file, here is example :

accounts.txt - and this look inside like that :

login1:password1
login2:password2
abcdefgh:12345
123323:11212121
blablablabla:1234567
1212122:1212121212
xxx123:milk123

What i need to do with that? i need get $login and $password, $login is word before ":" and $password is word behind ":"

I tried to made this with

$login[$i] = _StringBetween($line, "", ":")
                $password[$i] = _StringBetween($line, ":", "")

But that doesn't work ;)

Sorry for my bad englisch :)

Peace !

Try using this:

$in = "password:hello"
$out = StringSplit($in, ":")
For $i = 1 To $out[0]
    MsgBox(262144, "", $out[$i], 2)
Next

AutoIt Stuff:

 

UDFs: {Grow}

Posted (edited)

Sounds....like a job for StringRegExp() ...example on the way

So I forgot I'm not good at these so someone else would have to help refine or replace the entire RegEx but it could be something like this:

#include <Array.au3>

$string = "login1:password1" & @CRLF & "login2:password2" & @CRLF & "abcdefgh:12345" & @CRLF & "123323:11212121"
ConsoleWrite($string)

$aLoginPass = StringRegExp($string, "([^\v\h]*):([^\v\h]*)", 3)
_ArrayDisplay($aLoginPass)

;Even index is the login and the odd index + 1 is the password, _ArrayDisplay helps make sense of it
Edited by MrMitchell
Posted (edited)

Didnt say how you need them....

change c:\test.txt to your file name, naturally.

#include <array.au3>
#Include <File.au3>
Dim $array

_FileReadToArray ("C:\test.txt", $array)
;~ _arraydisplay ($array)
_arraydelete ($array , 0)
$string = _ArrayToString ($array, ":")
;~ msgbox (0, '' , $string)
$Barray = stringsplit ($string , ":" , 1)
_arraydelete ($Barray , 0)
;~ _arraydisplay ($Barray)

for $i = 0 to ubound($Barray) - 1
    msgbox (0, '' , "Password for " & $Barray[$i] & " is " & $Barray[$i + 1])
    $i = $i + 1
Next
exit
Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Posted (edited)

Thanks for so much reply, i will test now thank you, if need more help i will msg ;) thanks guys

Edit : "iamtheky" THANK YOU :) work perfect

Take care

Edited by xdp22
Posted

$sStr = FileRead("C:\path\somefile.txt")
$aStr = StringRegExp($sStr, "(?m:^|\n)(.+):(.+)(?:\v|$)+", 3)
For $1 = 0 To UBound($aStr) -1 Step 2
    MsgBox(4096, "Result " & $i+1, "UserName : " & $aStr[$i] & @CRLF & "Password: " & $aStr[$i+1])
Next

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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