Thread: Could someone create a passworded RAR for me?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    UT2004 Addict Kleid-0's Avatar
    Join Date
    Dec 2004
    Posts
    656
    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.
    Last edited by Kleid-0; 12-30-2004 at 05:41 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can't create child windows
    By OnionKnight in forum Windows Programming
    Replies: 4
    Last Post: 04-10-2011, 04:13 PM
  2. Create instance on class programatically
    By deviousdexter in forum C# Programming
    Replies: 6
    Last Post: 12-10-2008, 06:02 PM
  3. Cannot create shared memory
    By Phoenix_Rebirth in forum C Programming
    Replies: 3
    Last Post: 11-07-2008, 11:32 AM
  4. Create new combo boxes based on items selected in preview combo box
    By RealityFusion in forum Windows Programming
    Replies: 2
    Last Post: 01-10-2007, 09:50 AM
  5. Create a file from c++ program
    By Dan17 in forum C++ Programming
    Replies: 2
    Last Post: 05-08-2006, 04:25 PM