Page 1 of 1

what I need is if the password found save it to text file

Posted: 06 Sep 2011 20:52
by roro4465
I have this code (CMD bat file)


@echo
text -u text -w numeric1.txt

this code is for testing passwords

usually if it is find the password I get this 2 lines (I type it exactly)
[+] Password : [X]
[+] Status : Rasta!

X is the password that it is found

what I need is if the password found save it to text file ; and if the password not found then just close the bat file (the default thing happen is close when end if it find the password or not so I need code to change the default )

Can you please help me with that ?

Regards

Re: what I need is if the password found save it to text fil

Posted: 06 Sep 2011 21:02
by nitt
Your question confuses me. Please use proper grammar and restate a simple version of your question.

For writing files, you need to use Senders (not a technical term). Watch a summary of that here.

If you are trying to read a file and search for a specific line of text, you may want to look into the FOR loop, which my tutorial for that hasn't uploaded yet, but if you view the previous threads you can find some textual tutorials I have written out.

Re: what I need is if the password found save it to text fil

Posted: 06 Sep 2011 21:11
by roro4465
Hi again;
simple version of my question

I need code if the result of my bat file is "[+] Status : Rasta!" then it will save the line above it "[+] Password : [X]"
X is the password

Can you help me with that ?

Regards

Re: what I need is if the password found save it to text fil

Posted: 06 Sep 2011 21:25
by nitt
roro4465 wrote:Hi again;
simple version of my question

I need code if the result of my bat file is "[+] Status : Rasta!" then it will save the line above it "[+] Password : [X]"
X is the password

Can you help me with that ?

Regards


I have no clue what a "[+] Status : Rasta!" is. But if you are asking to compare strings, that's like

Code: Select all

if "%string1%" EQU "%string2%" (
dosomething
)


That's conditionals.

Maybe it's because I'm deadly tired, but I still don't really understand your question. I hear:

Code: Select all

If "%results%" EQU "[+] Status : Rasta!" (
echo %password% > test.txt
)


Or something like that...