⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vendor.c

📁 This a good VPN source
💻 C
📖 第 1 页 / 共 2 页
字号:
/* Openswan ISAKMP VendorID Handling * Copyright (C) 2002-2003 Mathieu Lafon - Arkoon Network Security * Copyright (C) 2004 Xelerance Corporation * * 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.  See <http://www.fsf.org/copyleft/gpl.txt>. * * 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. * * RCSID $Id: vendor.c,v 1.34 2004/11/30 02:29:07 mcr Exp $ */#include <stdlib.h>#include <string.h>#include <ctype.h>#include <sys/queue.h>#include <openswan.h>#include "constants.h"#include "defs.h"#include "log.h"#include "md5.h"#include "id.h"#include "x509.h"#include "pgp.h"#include "certs.h"#include "smartcard.h"#ifdef XAUTH_USEPAM#include <security/pam_appl.h>#endif#include "connections.h"#include "packet.h"#include "demux.h"#include "whack.h"#include "vendor.h"#include "quirks.h"#include "kernel.h"#include "state.h"#ifdef NAT_TRAVERSAL#include "nat_traversal.h"#endif/** * Listing of interesting but details unknown Vendor IDs: * * SafeNet SoftRemote 8.0.0: *  47bbe7c993f1fc13b4e6d0db565c68e5010201010201010310382e302e3020284275696c6420313029000000 *  >> 382e302e3020284275696c6420313029 = '8.0.0 (Build 10)' *  da8e937880010000 * * SafeNet SoftRemote 9.0.1 *  47bbe7c993f1fc13b4e6d0db565c68e5010201010201010310392e302e3120284275696c6420313229000000 *  >> 392e302e3120284275696c6420313229 = '9.0.1 (Build 12)' *  da8e937880010000 * * Netscreen: *  d6b45f82f24bacb288af59a978830ab7 *  cf49908791073fb46439790fdeb6aeed981101ab0000000500000300 * * Cisco: *  1f07f70eaa6514d3b0fa96542a500300 (VPN 3000 version 3.0.0) *  1f07f70eaa6514d3b0fa96542a500301 (VPN 3000 version 3.0.1) *  1f07f70eaa6514d3b0fa96542a500305 (VPN 3000 version 3.0.5) *  1f07f70eaa6514d3b0fa96542a500407 (VPN 3000 version 4.0.7) *  (Can you see the pattern?) *  afcad71368a1f1c96b8696fc77570100 (Non-RFC Dead Peer Detection ?) *  c32364b3b4f447eb17c488ab2a480a57 *  6d761ddc26aceca1b0ed11fabbb860c4 *  5946c258f99a1a57b03eb9d1759e0f24 (From a Cisco VPN 3k) *  ebbc5b00141d0c895e11bd395902d690 (From a Cisco VPN 3k) * * Microsoft L2TP (???): *  47bbe7c993f1fc13b4e6d0db565c68e5010201010201010310382e312e3020284275696c6420313029000000 *  >> 382e312e3020284275696c6420313029 = '8.1.0 (Build 10)' *  3025dbd21062b9e53dc441c6aab5293600000000 *  da8e937880010000 * * 3COM-superstack *    da8e937880010000 *    404bf439522ca3f6 * */#define MAX_LOG_VID_LEN            32#define VID_KEEP                   0x0000#define VID_MD5HASH                0x0001#define VID_STRING                 0x0002#define VID_FSWAN_HASH             0x0004#define VID_SUBSTRING_DUMPHEXA     0x0100#define VID_SUBSTRING_DUMPASCII    0x0200#define VID_SUBSTRING_MATCH        0x0400#define VID_SUBSTRING  (VID_SUBSTRING_DUMPHEXA | VID_SUBSTRING_DUMPASCII | VID_SUBSTRING_MATCH)struct vid_struct {	enum known_vendorid id;	unsigned short flags;	const char *data;	const char *descr;	const char *vid;	unsigned int vid_len;};#define DEC_MD5_VID_D(id,str,descr) \	{ VID_##id, VID_MD5HASH, str, descr, NULL, 0 },#define DEC_MD5_VID(id,str) \	{ VID_##id, VID_MD5HASH, str, NULL, NULL, 0 },#define DEC_FSWAN_VID(id,str,descr) \	{ VID_##id, VID_FSWAN_HASH, str, descr, NULL, 0 },static struct vid_struct _vid_tab[] = {	/* Implementation names */	{ VID_OPENPGP, VID_STRING, "OpenPGP10171", "OpenPGP", NULL, 0 },	DEC_MD5_VID(KAME_RACOON, "KAME/racoon")	{ VID_MS_NT5, VID_MD5HASH | VID_SUBSTRING_DUMPHEXA,		"MS NT5 ISAKMPOAKLEY", NULL, NULL, 0 },	DEC_MD5_VID(SSH_SENTINEL, "SSH Sentinel")	DEC_MD5_VID(SSH_SENTINEL_1_1, "SSH Sentinel 1.1")	DEC_MD5_VID(SSH_SENTINEL_1_2, "SSH Sentinel 1.2")	DEC_MD5_VID(SSH_SENTINEL_1_3, "SSH Sentinel 1.3")	DEC_MD5_VID(SSH_SENTINEL_1_4, "SSH Sentinel 1.4")	DEC_MD5_VID(SSH_SENTINEL_1_4_1, "SSH Sentinel 1.4.1")	/* These ones come from SSH vendors.txt */	DEC_MD5_VID(SSH_IPSEC_1_1_0,		"Ssh Communications Security IPSEC Express version 1.1.0")	DEC_MD5_VID(SSH_IPSEC_1_1_1,		"Ssh Communications Security IPSEC Express version 1.1.1")	DEC_MD5_VID(SSH_IPSEC_1_1_2,		"Ssh Communications Security IPSEC Express version 1.1.2")	DEC_MD5_VID(SSH_IPSEC_1_2_1,		"Ssh Communications Security IPSEC Express version 1.2.1")	DEC_MD5_VID(SSH_IPSEC_1_2_2,		"Ssh Communications Security IPSEC Express version 1.2.2")	DEC_MD5_VID(SSH_IPSEC_2_0_0,		"SSH Communications Security IPSEC Express version 2.0.0")	DEC_MD5_VID(SSH_IPSEC_2_1_0,		"SSH Communications Security IPSEC Express version 2.1.0")	DEC_MD5_VID(SSH_IPSEC_2_1_1,		"SSH Communications Security IPSEC Express version 2.1.1")	DEC_MD5_VID(SSH_IPSEC_2_1_2,		"SSH Communications Security IPSEC Express version 2.1.2")	DEC_MD5_VID(SSH_IPSEC_3_0_0,		"SSH Communications Security IPSEC Express version 3.0.0")	DEC_MD5_VID(SSH_IPSEC_3_0_1,		"SSH Communications Security IPSEC Express version 3.0.1")	DEC_MD5_VID(SSH_IPSEC_4_0_0,		"SSH Communications Security IPSEC Express version 4.0.0")	DEC_MD5_VID(SSH_IPSEC_4_0_1,		"SSH Communications Security IPSEC Express version 4.0.1")	DEC_MD5_VID(SSH_IPSEC_4_1_0,		"SSH Communications Security IPSEC Express version 4.1.0")	DEC_MD5_VID(SSH_IPSEC_4_2_0,		"SSH Communications Security IPSEC Express version 4.2.0")	/* note: md5('CISCO-UNITY') = 12f5f28c457168a9702d9fe274cc02d4 */	{ VID_CISCO_UNITY, VID_KEEP, NULL, "Cisco-Unity",		"\x12\xf5\xf2\x8c\x45\x71\x68\xa9\x70\x2d\x9f\xe2\x74\xcc\x01\x00",		16 },	{ VID_CISCO3K, VID_KEEP | VID_SUBSTRING_MATCH,           NULL, "Cisco VPN 3000 Series" , "\x1f\x07\xf7\x0e\xaa\x65\x14\xd3\xb0\xfa\x96\x54\x2a\x50", 14},	/**	 * Timestep VID seen:	 *   - 54494d455354455020312053475720313532302033313520322e303145303133	 *     = 'TIMESTEP 1 SGW 1520 315 2.01E013'	 */	{ VID_TIMESTEP, VID_STRING | VID_SUBSTRING_DUMPASCII, "TIMESTEP",		NULL, NULL, 0 },	DEC_FSWAN_VID(FSWAN_2_00_VID,		"Linux FreeS/WAN 2.00 PLUTO_SENDS_VENDORID",		"FreeS/WAN 2.00")	DEC_FSWAN_VID(FSWAN_2_00_X509_1_3_1_VID,		"Linux FreeS/WAN 2.00 X.509-1.3.1 PLUTO_SENDS_VENDORID",		"FreeS/WAN 2.00 (X.509-1.3.1)")	DEC_FSWAN_VID(FSWAN_2_00_X509_1_3_1_LDAP_VID,		"Linux FreeS/WAN 2.00 X.509-1.3.1 LDAP PLUTO_SENDS_VENDORID",		"FreeS/WAN 2.00 (X.509-1.3.1 + LDAP)")	DEC_FSWAN_VID(OPENSWAN2,		"Openswan 2.2.0",		"Openswan 2.2.0")	/* NAT-Traversal */	DEC_MD5_VID(NATT_STENBERG_01, "draft-stenberg-ipsec-nat-traversal-01")	DEC_MD5_VID(NATT_STENBERG_02, "draft-stenberg-ipsec-nat-traversal-02")	DEC_MD5_VID(NATT_HUTTUNEN, "ESPThruNAT")	DEC_MD5_VID(NATT_HUTTUNEN_ESPINUDP, "draft-huttunen-ipsec-esp-in-udp-00.txt")	DEC_MD5_VID(NATT_IETF_00, "draft-ietf-ipsec-nat-t-ike-00")	DEC_MD5_VID(NATT_IETF_02, "draft-ietf-ipsec-nat-t-ike-02")	/* hash in draft-ietf-ipsec-nat-t-ike-02 contains '\n'... Accept both */	DEC_MD5_VID_D(NATT_IETF_02_N, "draft-ietf-ipsec-nat-t-ike-02\n", "draft-ietf-ipsec-nat-t-ike-02_n")	DEC_MD5_VID(NATT_IETF_03, "draft-ietf-ipsec-nat-t-ike-03")	DEC_MD5_VID(NATT_RFC, "Testing NAT-T RFC")	DEC_MD5_VID(NATT_DRAFT_IETF_IPSEC_NAT_T_IKE,"draft-ietf-ipsec-nat-t-ike")	/* misc */		{ VID_MISC_XAUTH, VID_KEEP, NULL, "XAUTH",		"\x09\x00\x26\x89\xdf\xd6\xb7\x12", 8 },	{ VID_MISC_DPD, VID_KEEP, NULL, "Dead Peer Detection",		"\xaf\xca\xd7\x13\x68\xa1\xf1\xc9\x6b\x86\x96\xfc\x77\x57\x01\x00",		16 },	/**	 * Netscreen:	 * 4865617274426561745f4e6f74696679386b0100  (HeartBeat_Notify + 386b0100)	 */	{ VID_MISC_HEARTBEAT_NOTIFY, VID_STRING | VID_SUBSTRING_DUMPHEXA,		"HeartBeat_Notify", "HeartBeat Notify", NULL, 0 },	/**	 * MacOS X	 */	{ VID_MACOSX, VID_STRING|VID_SUBSTRING_DUMPHEXA, "Mac OSX 10.x",	  "\x4d\xf3\x79\x28\xe9\xfc\x4f\xd1\xb3\x26\x21\x70\xd5\x15\xc6\x62", NULL, 0},	DEC_MD5_VID(MISC_FRAGMENTATION, "FRAGMENTATION")	DEC_MD5_VID(INITIAL_CONTACT, "Vid-Initial-Contact")	/* -- */	{ 0, 0, NULL, NULL, NULL, 0 }};static const char _hexdig[] = "0123456789abcdef";static int _vid_struct_init = 0;/**  * Setup VendorID structs, and populate them * */void init_vendorid(void){	struct vid_struct *vid;	MD5_CTX ctx;	int i;	for (vid = _vid_tab; vid->id; vid++) {		if (vid->flags & VID_STRING) {			/** VendorID is a string **/			vid->vid = strdup(vid->data);			vid->vid_len = strlen(vid->data);		}		else if (vid->flags & VID_MD5HASH) {			/** VendorID is a string to hash with MD5 **/			char *vidm =  malloc(MD5_DIGEST_SIZE);			vid->vid = vidm;			if (vidm) {			        unsigned const char *d = vid->data;				osMD5Init(&ctx);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -