"Fossies" - the Fresh Open Source Software Archive 
Member "vpnc-0.5.3/cisco-decrypt.c" (19 Nov 2008, 1692 Bytes) of package /linux/privat/old/vpnc-0.5.3.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "cisco-decrypt.c" see the
Fossies "Dox" file reference documentation.
1 /* Decoder for password encoding of Cisco VPN client.
2 Copyright (C) 2005 Maurice Massar
3
4 Thanks to HAL-9000@evilscientists.de for decoding and posting the algorithm!
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21 #include "decrypt-utils.h"
22
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <gcrypt.h>
26 #include <errno.h>
27
28 int main(int argc, char *argv[])
29 {
30 int i, len, ret = 0;
31 char *bin, *pw = NULL;
32
33 gcry_check_version(NULL);
34
35 if (argc == 1 || *argv[1] == '-') {
36 fprintf(stderr,
37 "\nUsage: %s DEADBEEF...012345678 424242...7261\n"
38 " Print decoded result to stdout\n\n",
39 argv[0]);
40 exit(1);
41 }
42 /* Hack for use in pcf2vpnc */
43 if (*argv[1] == 'q') {
44 exit(1);
45 }
46
47 for (i = 1; i < argc; i++) {
48 ret = hex2bin(argv[i], &bin, &len);
49 if (ret != 0) {
50 perror("decoding input");
51 continue;
52 }
53 ret = deobfuscate(bin, len, (const char **)&pw, NULL);
54 free(bin);
55 if (ret != 0) {
56 perror("decrypting input");
57 continue;
58 }
59 printf("%s\n", pw);
60 free(pw);
61 }
62
63 exit(ret != 0);
64 }