I don't download illegal programs, so I need a helping hand here lol. In order to rar with a password, you need to have RAR payed for and registered. So I need help from someone that does have the registered version (because I don't have the ability).
Why? Because, honestly, I'm trying to create an uber n00b brute force password program that checks one password per 30 seconds! It's REALLY fast!!! Because I am that good!
So I need a RAR with a password to verify if the program is actually doing its stuff. And this probably isn't the best place to ask! So I'm throwin' the dice! Be sure the password is BARDOT And some text file in it, this is a great learning activity! I'll even share the source:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define FALSE 0
#define TRUE 1
int successRaring(void);
char *getDictWord(void);
void cError(char *msg);
FILE* dictList;
int main(void) {
char Password[20];
char Exec[150];
// Get dictionary word
dictList = fopen("dict.txt", "r");
char *Word = getDictWord();
// Test all dictionary words for password
while(Word != NULL) {
// Run RAR with password
strcpy(Password, Word);
strcpy(Exec, "rar t -ierr -p");
strcat(Exec, Password);
strcat(Exec, " /home/kleid/Programming/Laboratory/test.rar");
printf("Testing: %s\n", Exec);
int success;
success = system(Exec);
if(successRaring()) // Good password?
printf("Good password: %s\n", Password); // YES
else
printf("Bad password: %s\n", Password); // NO
// Clear stderr.log so the output isn't appended
freopen("stderr.log", "w+", stderr);
// Get another word
Word = getDictWord();
}
return 0;
}
char *getDictWord(void) {
static char Word[40];
static int c;
int i;
for(i=0; i<sizeof(Word); ++i)
Word[i]='\0';
int location = 0;
while((c=getc(dictList)) != '\n' && c != EOF) {
if(c >= '0' && c <= '9' || c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z')
Word[location] = c;
++location;
}
if( c == EOF )
return NULL;
return Word;
}
int successRaring(void) {
static FILE* errorLog;
errorLog = fopen("stderr.log", "r");
if(errorLog == NULL)
cError("Error opening error log file.");
int c;
while((c=getc(errorLog)) != EOF) {
if(c != 'e')
continue;
c = getc(errorLog);
if(c != 'r')
continue;
c = getc(errorLog);
if(c != 'r')
continue;
c = getc(errorLog);
if(c != 'o')
continue;
c = getc(errorLog);
if(c != 'r')
continue;
c = getc(errorLog);
if(c != 's')
continue;
c = getc(errorLog);
if(c != ':')
continue;
c = getc(errorLog);
if(c != ' ')
continue;
c = getc(errorLog);
if(c == '1' && (c=getc(errorLog)) == '9') {
fclose(errorLog);
return FALSE;
}
else {
fclose(errorLog);
return TRUE;
}
}
fclose(errorLog);
return FALSE;
}
void cError(char *msg) {
printf("ERROR: %s\n", msg);
exit(1);
}
I would upload dict.txt, but it's ~590 KB. If you can't notice, this is in C/C++ language and if anyone has ANY suggestions as far as the code goes, please say them to help me out on my code creation.
Start the program like this:
Code:
./a.out >stdout.log 2>stderr.log
^^^ That's required...
In Unix/Linux. This sends >stdout.log (regular output) to a file called stdout.log. The 2>stderr.log sends the standard error output to the file stderr.log.
And please, if you have any suggestions on my code at all, please tell me how I should code differently.