资源简介
openswan-2.6.50.tar.gz
代码片段和文件信息
/* IPSec VPN client compatible with Cisco equipment.
Copyright (C) 2004-2005 Maurice Massar
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License or
(at your option) any later version.
This program is distributed in the hope that it will be useful
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not write to the Free Software
Foundation Inc. 59 Temple Place Suite 330 Boston MA 02111-1307 USA
$Id: config.c 242 2007-09-09 07:55:21Z Joerg Mayer $
*/
#define _GNU_SOURCE
#include
#include
#include
#include
#include
#include
#include
#include
static int hex2bin_c(unsigned int c)
{
if ((c >= ‘0‘)&&(c <= ‘9‘))
return c - ‘0‘;
if ((c >= ‘A‘)&&(c <= ‘F‘))
return c - ‘A‘ + 10;
if ((c >= ‘a‘)&&(c <= ‘f‘))
return c - ‘a‘ + 10;
return -1;
}
int hex2bin(const char *str char **bin int *len)
{
char *p;
int i l;
if (!bin)
return EINVAL;
for (i = 0; str[i] != ‘\0‘; i++)
if (hex2bin_c(str[i]) == -1)
return EINVAL;
l = i;
if ((l & 1) != 0)
return EINVAL;
l /= 2;
p = malloc(l);
if (p == NULL)
return ENOMEM;
for (i = 0; i < l; i++)
p[i] = hex2bin_c(str[i*2]) << 4 | hex2bin_c(str[i*2+1]);
*bin = p;
if (len)
*len = l;
return 0;
}
int deobfuscate(char *ct int len const char **resp char *reslenp)
{
const char *h1 = ct;
const char *h4 = ct + 20;
const char *enc = ct + 40;
char ht[20] h2[20] h3[20] key[24];
const char *iv = h1;
char *res;
gcry_cipher_hd_t ctx;
int reslen;
if (len < 48)
return -1;
len -= 40;
memcpy(ht h1 20);
ht[19]++;
gcry_md_hash_buffer(GCRY_MD_SHA1 h2 ht 20);
ht[19] += 2;
gcry_md_hash_buffer(GCRY_MD_SHA1 h3 ht 20);
memcpy(key h2 20);
memcpy(key+20 h3 4);
/* who cares about parity anyway? */
gcry_md_hash_buffer(GCRY_MD_SHA1 ht enc len);
if (memcmp(h4 ht 20) != 0)
return -1;
res = malloc(len);
if (res == NULL)
return -1;
gcry_cipher_open(&ctx GCRY_CIPHER_3DES GCRY_CIPHER_MODE_CBC 0);
gcry_cipher_setkey(ctx key 24);
gcry_cipher_setiv(ctx iv 8);
gcry_cipher_decrypt(ctx (unsigned char *)res len (unsigned char *)enc len);
gcry_cipher_close(ctx);
reslen = len - res[len-1];
res[reslen] = ‘\0‘;
if (resp)
*resp = res;
if (reslenp)
*reslenp = reslen;
return 0;
}
/* Decoder for password encoding of Cisco VPN client.
Copyright (C) 2005 Maurice Massar
Thanks to HAL-9000@evilscientists.de for decoding and posting the algorithm!
This program is free software; you can redistribute it and/or mod
相关资源
- JSBSim运行文件仿真结果画图脚本.zip
-
ob
jective-C编程全解(第3版).pdf - NDwww.net
- 6.55开发和运行无限点破解.rar
- liaoning.zip
- 精准扶贫大数据平台建设方案V1.0.do
- 起点设备管理软件单机版7.35Reg注册版
- 校园跑腿.zip
- wenku_GUI.exe
- 书签第2版阳宪惠2008[1].10x.pdf
- 11506176电子电气设备的电磁兼容设计、
- 软件测试的艺术原书第3版.pdf
- 新书《无线传感器网络技术》.rar
- BaiduYun3.9.11.rar
- PRML中文版.zip
- 321browser.zip
- 发那科机器人与康耐视视觉的应用.
-
CSS与xm
l的综合运用 - CSS与其他技术 - ReinforcementLearning.pdf
- 银行流水打印软件v2015绿色免费版.r
- anyconnect-win-4.5.03040-core-vpn-predeploy-k9
- 《信息论——基础理论与应用》(傅
- 线性代数及其应用.zip
- 实变函数与泛函分析概要第二版第二
- 交通规划原理(邵春福).pdf
- 云视通授权破解版cancancan.rar
- 百度云管家5.4.4.rar
- SublimeText3Build3103x64PortableCracked(2016
- 豆丁当当V2.3.zip
- 拍卖系统.zip
评论
共有 条评论