Results 1 to 10 of 10

Thread: ruby or shell magic needed

Hybrid View

  1. #1
    Just burned his ISO joerg's Avatar
    Join Date
    Jan 2010
    Location
    germany
    Posts
    9

    Default ruby or shell magic needed

    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

  2. #2
    Just burned his ISO
    Join Date
    Jun 2011
    Posts
    3

    Default Re: ruby or shell magic needed

    This will do it:
    #!/bin/bash

    for i in `cat ${1}`
    do echo -ne ${i:0:1}
    if [[ ${i: -1} = "." ]]
    then echo .
    fi
    done

  3. #3
    Just burned his ISO
    Join Date
    Jan 2010
    Posts
    8

    Default Re: ruby or shell magic needed

    Don't reinvent the wheel. wyd.pl was made on that purpose! (you can find it on /pentest/passwords/wyd/)

  4. #4
    Just burned his ISO joerg's Avatar
    Join Date
    Jan 2010
    Location
    germany
    Posts
    9

    Default AW: Re: ruby or shell magic needed

    Thank you both so much - i will first check the shellscript and then have a look at wyd.pl

    best regards,
    Joerg

  5. #5
    Just burned his ISO joerg's Avatar
    Join Date
    Jan 2010
    Location
    germany
    Posts
    9

    Default Re: AW: Re: ruby or shell magic needed

    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

  6. #6
    Member whitelisted's Avatar
    Join Date
    Feb 2010
    Posts
    72

    Default Re: ruby or shell magic needed

    sed 's/\([a-zA-Z]\)[a-zA-Z]*/\1/g; s/ //g; s/\([^a-zA-Z]\)/\1\n/g' <input

  7. #7
    Just burned his ISO joerg's Avatar
    Join Date
    Jan 2010
    Location
    germany
    Posts
    9

    Default AW: Re: ruby or shell magic needed

    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

  8. #8
    Member whitelisted's Avatar
    Join Date
    Feb 2010
    Posts
    72

    Default Re: ruby or shell magic needed

    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

  9. #9
    Just burned his ISO joerg's Avatar
    Join Date
    Jan 2010
    Location
    germany
    Posts
    9

    Default AW: ruby or shell magic needed

    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!

  10. #10
    Member whitelisted's Avatar
    Join Date
    Feb 2010
    Posts
    72

    Default Re: ruby or shell magic needed

    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.

Similar Threads

  1. Scripting a shell inside a shell?
    By MAD Industries in forum Beginners Forum
    Replies: 1
    Last Post: 04-03-2010, 09:11 AM
  2. The magic touch of VLC Player
    By rakzhodekams in forum OLD BackTrack 4 Howto
    Replies: 2
    Last Post: 12-20-2009, 08:28 AM
  3. how to update to ruby 1.9?
    By b3r00tb4ck in forum OLD Newbie Area
    Replies: 1
    Last Post: 11-22-2009, 05:23 PM
  4. Learning ruby... My first ruby backdoor...
    By BigMac in forum OLD Programming
    Replies: 9
    Last Post: 06-03-2009, 11:32 PM
  5. Wake On-Lan / Magic Packet
    By DeadWolf in forum OLD BackTrack 3 Final
    Replies: 3
    Last Post: 08-07-2008, 08:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •