I created a simple password program which takes a string when its invoked, and prints thank you if its correct. Now I want to write a brute forcer. The password is a 4 blocks 4 digit password ( example 1234 5678 9012 3456, so its called like this C:>pass 1234 5678 9012 3456 ). The problem is how to pass the output of brute_force.exe as the argument of pass.exe. I tried piping but its not working.

I tried this C:>brute_force | pass > ans.txt

So that the " Thank you" will be printed in ans.txt.

Would you post the program? I'd have to see how the program is set up to receive input. Also, I want to be sure you actually wrote the password program. I want to avoid even the appearance of helping someone crack a password.

commented: This is getting a little to "picky" in my opinion -3

I don't know about windows cmd.exe doing this, but the bash scripting language does it just fine:

pass `brute_force` >output.txt

The back-quotes execute the brute_force command inside them, and then insert the output at that location in the argument list to the pass command. You can get a bash shell by installing the cygwin tool set in Windows - that will give you a pretty decent unix/linux environment, and still be able to run Windows programs from the bash command line.

This is my pass.c program.

# include <stdio.h>

char pass1[4] = {"15"}, pass2[4] = {"18"} ;
char pass3[4] = {"89"}, pass4[4] = {"68"} ;

int main ( int argc, char *argv[] )
{
    if ( argc != 5 )
    {
        printf ("usage : pass <num> <num> <num> <num>") ;
        return 1 ;
    }

    if ( strcmp ( pass1, argv[1]) == 0 )
        if ( strcmp ( pass2, argv[2]) == 0 )
            if ( strcmp ( pass3, argv[3]) == 0 )
                if ( strcmp ( pass4, argv[4]) == 0 )
                    printf ( "Congratulation. Thank You" ) ;
    return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.