Linux crypt

From Teknologisk videncenter
Revision as of 17:07, 28 September 2019 by Heth (talk | contribs) (Created page with "<source lang=c> #include <stdio.h> #define _XOPEN_SOURCE See feature_test_macros(7): #include <unistd.h> //#define _GNU_SOURCE #include <crypt.h> int main( void )...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
#include <stdio.h>
#define _XOPEN_SOURCE       /* See feature_test_macros(7) */
#include <unistd.h>
//#define _GNU_SOURCE
#include <crypt.h>

int main( void ) {
        char *tp;
        //tp = crypt("cisco","$mOdp$");
        tp = crypt("cisco","$1$uUpN");
        if ( tp == 0 ) {
                perror("Av: ");
                return(0);
        }
        printf("%s\n",tp);

        return(0);
}

When run:

a:~/bin$ gcc crypt.c -o crypt -lcrypt
a:~/bin$ ./crypt
$1$uUpN$JSmJL9.bdbLHahGFx.BLe/

Running config from a Cisco router with password cisco:

enable secret 5 $1$uUpN$JSmJL9.bdbLHahGFx.BLe/