Results 1 to 9 of 9

Thread: Can I mix the contains of two wordlist files together?

  1. #1
    Just burned his ISO
    Join Date
    Jun 2009
    Posts
    14

    Default Can I mix the contains of two wordlist files together?

    I am using crunch to generate wordlists, but I want to mix the contains of two of my wordlist files, can I do that using some kind of program? You know that no one want to do that manually......

  2. #2
    Very good friend of the forum Gitsnik's Avatar
    Join Date
    Jan 2010
    Location
    The Crystal Wind
    Posts
    851

    Default

    Try a combination of "cat" and "sort -u" (others will tell you "sort | uniq").

    If you seriously can't work it out from there come back to us.
    Still not underestimating the power...

    There is no such thing as bad information - There is truth in the data, so you sift it all, even the crap stuff.

  3. #3
    Just burned his ISO
    Join Date
    Jun 2009
    Posts
    14

    Default

    Quote Originally Posted by Gitsnik View Post
    Try a combination of "cat" and "sort -u" (others will tell you "sort | uniq").

    If you seriously can't work it out from there come back to us.
    Thank you Gitsnik, But the combination I mean is for example, there are dict A and dict B. Dict A got "a b c" in it, and dict B got "1 2 3" in it. after mix I got a dict C, which is contain "a1 a2 a3 b1 b2 b3 c1 c2 c3 1a 2a 3a...................." can "cat" and "sort -u" achieve this?

  4. #4
    Very good friend of the forum Gitsnik's Avatar
    Join Date
    Jan 2010
    Location
    The Crystal Wind
    Posts
    851

    Default

    Quote Originally Posted by voochee View Post
    can "cat" and "sort -u" achieve this?
    Strictly no, but then you're not necessarily doing something many people would elect to do.

    The following code I literally just hacked up in this reply panel, I haven't tested it nor will I provide support on it. It contains only very basic perl code, so if you can not read it I suggest you do one of those "learn perl in 24 hours" courses and then figure it out from there.

    The essence of the code is: read a line from file 1, read a line from file 2, as you read each character from file 1, insert the same character (position) from file 2 and print it out.

    Assuming no typo's and that I understood you properly this time around, it should do what you wish, again - no willingness to provide support.

    Code:
    #!/usr/bin/perl
    
    open(FILE_ONE, "fileone.txt");
    open(FILE_TWO, "filetwo.txt");
    while($f1l = <FILE_ONE>) {
      $f2l = <FILE_TWO>;
      chomp($f1l);
      chomp($f2l);
      my @f1a = split //, $f1l;
      my @f2a = split //, $f2l;
      my $i = 0;
      foreach my $char (@f1a) {
        print $char, $f2a[$i];
        $i += 1;
      }
      print "\n";
    }
    close(FILE_ONE);
    close(FILE_TWO);
    Still not underestimating the power...

    There is no such thing as bad information - There is truth in the data, so you sift it all, even the crap stuff.

  5. #5
    Just burned his ISO
    Join Date
    Jun 2009
    Posts
    14

    Default

    Quote Originally Posted by Gitsnik View Post
    Strictly no, but then you're not necessarily doing something many people would elect to do.

    The following code I literally just hacked up in this reply panel, I haven't tested it nor will I provide support on it. It contains only very basic perl code, so if you can not read it I suggest you do one of those "learn perl in 24 hours" courses and then figure it out from there.

    The essence of the code is: read a line from file 1, read a line from file 2, as you read each character from file 1, insert the same character (position) from file 2 and print it out.

    Assuming no typo's and that I understood you properly this time around, it should do what you wish, again - no willingness to provide support.

    Code:
    #!/usr/bin/perl
    
    open(FILE_ONE, "fileone.txt");
    open(FILE_TWO, "filetwo.txt");
    while($f1l = <FILE_ONE>) {
      $f2l = <FILE_TWO>;
      chomp($f1l);
      chomp($f2l);
      my @f1a = split //, $f1l;
      my @f2a = split //, $f2l;
      my $i = 0;
      foreach my $char (@f1a) {
        print $char, $f2a[$i];
        $i += 1;
      }
      print "\n";
    }
    close(FILE_ONE);
    close(FILE_TWO);
    Thank you very much, I will learn perl in the next 24 hours

  6. #6
    Very good friend of the forum Virchanza's Avatar
    Join Date
    Jan 2010
    Posts
    863

    Default

    This looks like fun, I'm gonna give it a go in C++:

    Code:
    #include <iostream>    /* cout, endl */
    #include <fstream>     /* ifstream */
    #include <string>      /* string */
    using std::cout;
    using std::endl;
    using std::ifstream;
    using std::string;
    
    int main(int argc, char **argv)
    {
        if ( 3 != argc )
        {
            cout << "Usage: " << argv[0] << " in1.txt in2.txt > out.txt" << endl;
            return 0;
        }
    
        ifstream a( argv[1] ); /* Open the first file */
    
        if ( !a.is_open() )
        {
            cout << "Could not open " << argv[1] << endl;
            return 0;
        }
    
        string str_a;
    
        while ( a >> str_a )
        {
            string str_b;
    
            ifstream b( argv[2] );
    
            if ( !b.is_open() )
            {
                cout << "Could not open " << argv[2] << endl;
                return 0;
            }
    
            while ( b >> str_b )
            {
                cout << str_a << str_b << endl;
            }
        }
    }
    Compile as follows:

    Code:
    g++ concat.cpp -D NDEBUG -s -O3 -o concat
    And run as follows:

    Code:
    ./concat in1.txt in2.txt > out.txt
    Ask questions on the open forums, that way everybody benefits from the solution, and everybody can be corrected when they make mistakes. Don't send me private messages asking questions that should be asked on the open forums, I won't respond. I decline all "Friend Requests".

  7. #7
    Very good friend of the forum Gitsnik's Avatar
    Join Date
    Jan 2010
    Location
    The Crystal Wind
    Posts
    851

    Default

    Virchanza I think your method produces a different output to mine (It has been a while since I read << notation in C++ though so I could be wrong).

    Mine should produce:

    f1: abc
    f2: 123
    out: a1b2c3

    But yours produces:

    abc123 from the same input (at least on my FreeBSD test box).

    A good chance for you to have a play with arrays. You might even notice that if you have only two characters in the second line, but 3 in the first you may run into some buffering issues when you do it.

    Edit: Oh yes, and I intentionally didn't blow out the lines properly to be a1 b1 c1 a2 b2 c2, but the basic premise is there - you just need to add an extra loop somewhere and shift the choice of i.
    Still not underestimating the power...

    There is no such thing as bad information - There is truth in the data, so you sift it all, even the crap stuff.

  8. #8
    Very good friend of the forum Virchanza's Avatar
    Join Date
    Jan 2010
    Posts
    863

    Default

    Quote Originally Posted by Gitsnik View Post
    Virchanza I think your method produces a different output to mine (It has been a while since I read << notation in C++ though so I could be wrong).

    Mine should produce:

    f1: abc
    f2: 123
    out: a1b2c3

    But yours produces:

    abc123 from the same input (at least on my FreeBSD test box)

    Your FreeBSD box is right (the code I posted is fully-portable so it will work on any machine).

    I'm pretty sure that the OP meant the following...

    in1.txt as follows:

    Code:
    a
    b
    c
    in2.txt as follows:

    Code:
    1
    2
    3
    So if you append every word of the second file to every word of the first file, you get:

    Code:
    a1
    a2
    a3
    b1
    b2
    b3
    c1
    c2
    c3
    That's what my little program does.
    Ask questions on the open forums, that way everybody benefits from the solution, and everybody can be corrected when they make mistakes. Don't send me private messages asking questions that should be asked on the open forums, I won't respond. I decline all "Friend Requests".

  9. #9
    Very good friend of the forum Gitsnik's Avatar
    Join Date
    Jan 2010
    Location
    The Crystal Wind
    Posts
    851

    Default

    Quote Originally Posted by Virchanza View Post
    That's what my little program does.
    You are probably correct then, I may have lost it in translation again.
    Still not underestimating the power...

    There is no such thing as bad information - There is truth in the data, so you sift it all, even the crap stuff.

Posting Permissions

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