This will do it:
#!/bin/bash
for i in `cat ${1}`
do echo -ne ${i:0:1}
if [[ ${i: -1} = "." ]]
then echo .
fi
done
Hi,
i am doing some research on password lists for a security tutorial. now i am with psychology of passwords for a quite while now. What came to my attention lately is the idea to automatically create a passphrase list from a huge text file with an ebook for example. Now to be clear, lets take an example. I need a little ruby magic or shell magic which does THIS: I want to input a text file and want the script to output the list of the passphrases from within this text. When a "." appears it should include the dot in the current passphrase, do a CR and let the next passphrase begin. Example:
Text Input Textfile:
The quick brown fox jumps over the lazy dog. Always look on the bright side of life. Hello World. Blablabla. This is a test.
Now the output file must look like this:
Tqbfjotld.
Alotbsol.
HW.
B.
Tiat.
I guess that is pretty easy - but as i am not quite familiar with that stuff - please can anyone take five minutes to figure that out? Would be highly appreciated.
best regards,
Joerg
This will do it:
#!/bin/bash
for i in `cat ${1}`
do echo -ne ${i:0:1}
if [[ ${i: -1} = "." ]]
then echo .
fi
done
Don't reinvent the wheel. wyd.pl was made on that purpose! (you can find it on /pentest/passwords/wyd/)
Thank you both so much - i will first check the shellscript and then have a look at wyd.pl
best regards,
Joerg
Maybe I am blind but i can´t locate wyd.pl at the location you pointed me to earlier. In Addition i read the wyd.pl specs on Max´s Site and can´t find a way which will do what i want. It simply extracts the words and allows some slick nice modifications but as i see it it can´t do what i asked for.
best regards,
Joerg
sed 's/\([a-zA-Z]\)[a-zA-Z]*/\1/g; s/ //g; s/\([^a-zA-Z]\)/\1\n/g' <input
holy....that is great, whitelisted. Could you point me a way which will include the comma sign "," in the passphrase? To clarify:
Input example: "The quick brown fox eats, poops and sleeps! Then he runs to the house."
Should result in Output example:
"
Tqbfe,pas!
Thrtth.
"
best regards,
Joerg
In your example, the first passphrase ends at an exclamation mark, not a period. How am I supposed to know which symbols mark the end of a passphrase and which ones should be embedded?
Assuming that every passphrase ends with a non-alpha character and begins with an uppercase character, you could try this:
sed 's/\([a-zA-Z]\)[a-zA-Z]*/\1/g; s/ //g; s/\([^a-zA-Z]\)\([A-Z]\)/\1\n\2/g' <input
yeah i could have pointed that out - sorry my fault.
thank you so much. never thought you could use sed for stuff like that. great!
No, thank you.
It's easy to get jaded about linux and to want to chuck it in and go back to a system that "just works" (tm). It's nice every now and again to solve a complex real-world problem in 30 seconds or less and using standard, out of the box tools, and to know you never could have done that in a windows environment.
Your problem made my day: it reminds me why I love open systems.