Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Sun, 19 Apr 2015 20:49:32 +0200
From: "Alberto P. R." <alberto00715@...il.com>
To: john-dev@...ts.openwall.com
Subject: Contribution to John The Ripper

Hello,

I am trying to develop some helpful part of "John The Ripper", i was
looking for some easy cryptographic algorithms that "John" did not support
yet, but i do not find anything. So now i am trying to improve the
Office/Libreoffice/pdf/
whatever cracking. But i did not find good documentation. So i am writing
directly in john.c file a new option, -D (Direct option) that allow to pass
directly a file.doc/file.odt/whatever:

John -D file.doc [wordlist]

and this should give the password for the file.

I wish to do in the correct way to add in the project and I do not want
waste time developing something that never it will be used or added. So
maybe i can write in john.c file and you could move to the correct way? or
what is the easiest way to do this?.

A direct option to call all this stuff type. But i am having problems
trying to understand how "John" works internally, like how execute things,
how save options, etc. The problem is i am writing directly in john.c file,
that i think is not the best way to do it. I can copy a snippet of code so
you understand better :

if (!strcasecmp(argv[1],"-D"))
    {
        if (argv[2] == NULL){
            puts("Usage: john -D <file.ext(doc,dot,...)> [wordlist]");
            exit(1);
        }
        regex_t regex;
        char msgbuf[100];
        /* Detect file for LibreOffice Writer, Impress, Draw and Calc */
        /* Compile a regular expression in     to a form that is suitable
for subsequent regexec() searches */
        int libreoffice = regcomp(&regex, "([[:alnum:]|[:punct:]])*((\.
odt|\.ods|\.odp|\.odg))$", REG_EXTENDED);
        if ((libreoffice == REG_BADRPT)|(libreoffice == REG_ESPACE)) {
            puts("Regcomp Error");
        }
        libreoffice = regexec(&regex, argv[2], 0, NULL, 0) ;
        if (!(libreoffice)) //Return 0 if accept the regex
        {
            char cmd1[6] = "python";
            char cmd2[20] = " ../run/odf2john.py ";
            char* cmd3; /* File + extesion must be less than 50 characters
*/
            cmd3 = (char*)malloc((strlen(argv[2])+1) *  sizeof(char));
         strncpy(cmd3, argv[2], strlen(argv[2]));
            char cmd4[14] = " > temp.txt \n";
            char cmd[100] = ""; /* Max command 100 characters */
            strcat(cmd, cmd1); //
            strcat(cmd, cmd2); //    Build
            strcat(cmd, cmd3); //    system call
            strcat(cmd, cmd4); //
            system(cmd); //execute call
            if (argv[3] == NULL){
                 execl("./john", "./john", "--format=ODF", "temp.txt",
NULL);
            }
            else {
                execl("./john", "./john", "-w=", argv[3], "--format=ODF",
"temp.txt", NULL);
            }
            system("rm temp.txt");
        }
        /*else if (libreoffice == REG_NOMATCH){
            puts("No match");
        }
        else {
            regerror(libreoffice, &regex_libreoffice, msgbuf,
sizeof(msgbuf));
            fprintf(stderr, "Regex match failed: %s\n", msgbuf);
            exit(1);
        }*/
        // Free compiled regular expression if you want to use the regex_t
again
        regfree(&regex);
}


I know that execute directly john is bad, but i do not know how do the same
actions with the internal structure of john. I do not know if i explained
correctly i do not please tell me.


Thanks you very much in advanced.

Best Regards,

Alberto.

Content of type "text/html" skipped

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.