File: ntlm.h

package info (click to toggle)
proxytunnel 1.9.0%2Bsvn250-6
  • links: PTS
  • area: main
  • in suites: buster, stretch
  • size: 452 kB
  • ctags: 368
  • sloc: ansic: 2,082; makefile: 79; pascal: 18
file content (107 lines) | stat: -rw-r--r-- 2,804 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/* Proxytunnel - (C) 2001-2008 Jos Visser / Mark Janssen    */
/* Contact:                  josv@osp.nl / maniac@maniac.nl */

/*
 * 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
 */

/* ntlm.h */
void build_type1();
int parse_type2(unsigned char *buf);
void build_type3_response();

void build_ntlm2_response();

extern int ntlm_challenge;

char ntlm_type1_buf[160];
char ntlm_type3_buf[4096];


// Below are the flag definitions.
#define NEG_UNICODE		0x00000001
#define NEG_OEM			0x00000002
#define REQ_TARGET		0x00000004
#define NEG_NTLM		0x00000200
#define NEG_DOMAIN		0x00001000
#define NEG_WORK		0x00002000
#define NEG_LOCAL		0x00004000
#define NEG_ASIGN		0x00008000
#define TAR_DOMAIN		0x00010000
#define TAR_SERVER		0x00020000
#define TAR_SHARE		0x00040000
#define NEG_NTLM2		0x00080000
#define NEG_TARINFO		0x00800000
#define	IE_SETSTHIS		0x02000000
#define NEG_128			0x20000000
#define NEG_56			0x80000000

// Below are the NTLM Message Types
#define NTLM_TYPE_1		0x00000001
#define NTLM_TYPE_2		0x00000002
#define NTLM_TYPE_3		0x00000003


typedef struct {
	unsigned short	length;
	unsigned short	space;
	unsigned long	offset;
} security_buf_t;

typedef struct {
	unsigned char	signature[8];
	unsigned long	message_type;
	unsigned long	flags;
	security_buf_t	domain;
	security_buf_t	workstation;
} ntlm_type1;

typedef struct {
	unsigned char	signature[8];
	unsigned long	message_type;
	security_buf_t	target_name;
	unsigned long	flags;
	unsigned char	challenge[8];
	unsigned long	context1;
	unsigned long	context2;
	security_buf_t	target_info;
	unsigned char	data_start;
} ntlm_type2;

typedef struct {
	unsigned char	signature[8];
	unsigned long	message_type;
	security_buf_t	LM_response;
	security_buf_t	NTLM_response;
	security_buf_t	domain;
	security_buf_t	user;
	security_buf_t	workstation;
	unsigned char	session[8];
	unsigned long	flags;
	unsigned char	pad[8];

} ntlm_type3;

typedef struct {
	unsigned char	digest[16];
	unsigned long	signature;
	unsigned long	reserved;
	unsigned long long	timestamp;
	unsigned char	client_challenge[8];
	unsigned long	unknown;
	unsigned long	data_start;
} blob;

// vim:noexpandtab:ts=4