Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Sun, 19 Apr 2015 20:49:32 +0200
From: "Alberto P. R." <>
Subject: Contribution to John The Ripper


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
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]");
        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/ ";
            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",
            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,
            fprintf(stderr, "Regex match failed: %s\n", msgbuf);
        // Free compiled regular expression if you want to use the regex_t

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,



Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ