par lucyfire » 05 Juin 2003 16:15
même si le DES est compliqué a casser pour le commun des mortels il y a pas mal de façon de le casser (6 d'apres ce que j'ai trouvé a droite et à gauche), c'est quand même un algo en fin de vie et sera/est déjà remplacé par l'AES advanced encrypted standard. voilà ce que j'ai trouvé sur <!-- BBCode auto-link start --><a href="http://blacksun.box.sk/format.php3?file=cisco-fr.html" target="_blank">http://blacksun.box.sk/format.php3?file=cisco-fr.html</a><!-- BBCode auto-link end -->
<BR>
<BR>"Section 4 : casse du mot de passe
<BR>
<BR>Maintenant que vous avez acquis le fichier de mot de passe, vous devez le casser, ainsi vous pourrez avoir accès au routeur de nouveau. Pour faire cela, vous pouvez utiliser un programme comme John le Ripper, ou un autre soft, sur le fichier de mot de passe et vous pouvez le casser.
<BR>
<BR>C'est la voie la plus facile et la voie que je recommanderais. Une autre solution serait d'essayer et de le décrypter. Pour cela vous aurez besoin d'un logiciel de décryptage, beaucoup une patience et une partie de la séquence de décryptage.
<BR>
<BR>Voici un logiciel pour décrypter un mot de passe cisco, vous devez le compiler dans linux :
<BR>
<BR>#include <stdio.h>
<BR>#include <ctype.h>
<BR>
<BR>char xlat[] = {
<BR> 0x64, 0x73, 0x66, 0x64, 0x3b, 0x6b, 0x66, 0x6f,
<BR> 0x41, 0x2c, 0x2e, 0x69, 0x79, 0x65, 0x77, 0x72,
<BR> 0x6b, 0x6c, 0x64, 0x4a, 0x4b, 0x44
<BR>};
<BR>
<BR>char pw_str1[] = "password 7 ";
<BR>char pw_str2[] = "enable-password 7 ";
<BR>
<BR>char *pname;
<BR>
<BR>cdecrypt(enc_pw, dec_pw)
<BR>char *enc_pw;
<BR>char *dec_pw;
<BR>{
<BR> unsigned int seed, i, val = 0;
<BR>
<BR> if(strlen(enc_pw) & 1)
<BR> return(-1);
<BR>
<BR> seed = (enc_pw[0] - '0') * 10 + enc_pw[1] - '0';
<BR>
<BR> if (seed > 15 || !isdigit(enc_pw[0]) || !isdigit(enc_pw[1]))
<BR> return(-1);
<BR>
<BR> for (i = 2 ; i <= strlen(enc_pw); i++) {
<BR> if(i !=2 && !(i & 1)) {
<BR> dec_pw[i / 2 - 2] = val ^ xlat[seed++];
<BR> val = 0;
<BR> }
<BR>
<BR> val *= 16;
<BR>
<BR> if(isdigit(enc_pw[i] = toupper(enc_pw[i]))) {
<BR> val += enc_pw[i] - '0';
<BR> continue;
<BR> }
<BR>
<BR> if(enc_pw[i] >= 'A' && enc_pw[i] <= 'F') {
<BR> val += enc_pw[i] - 'A' + 10;
<BR> continue;
<BR> }
<BR>
<BR> if(strlen(enc_pw) != i)
<BR> return(-1);
<BR> }
<BR>
<BR> dec_pw[++i / 2] = 0;
<BR>
<BR> return(0);
<BR>}
<BR>
<BR>usage()
<BR>{
<BR> fprintf(stdout, "Usage: %s -p <encrypted password>n", pname);
<BR> fprintf(stdout, " %s <router config file> <output file>n", pname);
<BR>
<BR> return(0);
<BR>}
<BR>
<BR>main(argc,argv)
<BR>int argc;
<BR>char **argv;
<BR>
<BR>{
<BR> FILE *in = stdin, *out = stdout;
<BR> char line[257];
<BR> char passwd[65];
<BR> unsigned int i, pw_pos;
<BR>
<BR> pname = argv[0];
<BR>
<BR> if(argc > 1)
<BR> {
<BR> if(argc > 3) {
<BR> usage();
<BR> exit(1);
<BR> }
<BR>
<BR> if(argv[1][0] == '-')
<BR> {
<BR> switch(argv[1][1]) {
<BR> case 'h':
<BR> usage();
<BR> break;
<BR>
<BR> case 'p':
<BR> if(cdecrypt(argv[2], passwd)) {
<BR> fprintf(stderr, "Error.n");
<BR> exit(1);
<BR> }
<BR> fprintf(stdout, "password: %sn", passwd);
<BR> break;
<BR>
<BR> default:
<BR> fprintf(stderr, "%s: unknow option.", pname);
<BR> }
<BR>
<BR> return(0);
<BR> }
<BR>
<BR> if((in = fopen(argv[1], "rt")) == NULL)
<BR> exit(1);
<BR> if(argc > 2)
<BR> if((out = fopen(argv[2], "wt")) == NULL)
<BR> exit(1);
<BR> }
<BR>
<BR> while(1) {
<BR> for(i = 0; i < 256; i++) {
<BR> if((line[i] = fgetc(in)) == EOF) {
<BR> if(i)
<BR> break;
<BR>
<BR> fclose(in);
<BR> fclose(out);
<BR> return(0);
<BR> }
<BR> if(line[i] == 'r')
<BR> i--;
<BR>
<BR> if(line[i] == 'n')
<BR> break;
<BR> }
<BR> pw_pos = 0;
<BR> line[i] = 0;
<BR>
<BR> if(!strncmp(line, pw_str1, strlen(pw_str1)))
<BR> pw_pos = strlen(pw_str1);
<BR>
<BR> if(!strncmp(line, pw_str2, strlen(pw_str2)))
<BR> pw_pos = strlen(pw_str2);
<BR>
<BR> if(!pw_pos) {
<BR> fprintf(stdout, "%sn", line);
<BR> continue;
<BR> }
<BR>
<BR> if(cdecrypt(&line[pw_pos], passwd)) {
<BR> fprintf(stderr, "Error.n");
<BR> exit(1);
<BR> }
<BR> else {
<BR> if(pw_pos == strlen(pw_str1))
<BR> fprintf(out, "%s", pw_str1);
<BR> else
<BR> fprintf(out, "%s", pw_str2);
<BR>
<BR> fprintf(out, "%sn", passwd);
<BR> }
<BR> }
<BR>}
<BR>"
<BR>
<BR>
"Les hommes déprécient ce qu'ils ne peuvent comprendre." [Goethe]