Utility to decrypt stored passwords for the "Gadu-Gadu" Polish-language chat program.
9f2dfed7520e70d6af10fd7c6400092d3c95d885d27e8c23c210487c8196ea89
/*
** gg_crack.c by konewka <alek.ambrozkiewicz@gmail.com>
**
** This utility let you decrypt passwords from Gadu-Gadu config file.
*/
#include <stdio.h>
struct {
char *coded;
int decoded;
} codes[] = {
{ "AC", ' ' },
{ "BE", 'A' },
{ "CE", 'B' },
{ "DE", 'C' },
{ "EE", 'D' },
{ "FE", 'E' },
{ "GE", 'F' },
{ "HE", 'G' },
{ "IE", 'H' },
{ "JE", 'I' },
{ "KE", 'J' },
{ "LE", 'K' },
{ "ME", 'L' },
{ "NE", 'M' },
{ "OE", 'N' },
{ "PE", 'O' },
{ "AF", 'P' },
{ "BF", 'Q' },
{ "CF", 'R' },
{ "DF", 'S' },
{ "EF", 'T' },
{ "FF", 'U' },
{ "GF", 'V' },
{ "HF", 'W' },
{ "IF", 'X' },
{ "JF", 'Y' },
{ "KF", 'Z' },
{ "BG", 'a' },
{ "CG", 'b' },
{ "DG", 'c' },
{ "EG", 'd' },
{ "FG", 'e' },
{ "GG", 'f' },
{ "HG", 'g' },
{ "IG", 'h' },
{ "JG", 'i' },
{ "KG", 'j' },
{ "LG", 'k' },
{ "MG", 'l' },
{ "NG", 'm' },
{ "OG", 'n' },
{ "PG", 'o' },
{ "AH", 'p' },
{ "BH", 'q' },
{ "CH", 'r' },
{ "DH", 's' },
{ "EH", 't' },
{ "FH", 'u' },
{ "GH", 'v' },
{ "HH", 'w' },
{ "IH", 'x' },
{ "JH", 'y' },
{ "KH", 'z' },
{ "AD", '0' },
{ "BD", '1' },
{ "CD", '2' },
{ "DD", '3' },
{ "ED", '4' },
{ "FD", '5' },
{ "GD", '6' },
{ "HD", '7' },
{ "ID", '8' },
{ "JD", '9' },
{ NULL, 0 },
};
int main(int argc, char *argv[]) {
int i, j;
if (!argv[1]) {
printf("%s <password2>\n", argv[0]);
return 0;
}
for (i=0;i<strlen(argv[1]);i+=2) {
for (j=0;codes[j].coded;j++) {
if ((argv[1][i] == codes[j].coded[0]) && (argv[1][i+1] == codes[j].coded[1]))
putchar(codes[j].decoded);
}
}
putchar('\n');
return 0;
}