#include "ntlm.h"
#include "misc.h"
#include <openssl/md4.h>
#include <openssl/des.h>
Go to the source code of this file.
Defines | |
#define | _CRT_SECURE_NO_DEPRECATE |
#define | WORD unsigned short |
#define | RW_PCVAL(read, inbuf, outbuf, len) |
#define | RW_PIVAL(read, big_endian, inbuf, outbuf, len) |
#define | RW_PSVAL(read, big_endian, inbuf, outbuf, len) |
#define | RW_CVAL(read, inbuf, outbuf, offset) |
#define | RW_IVAL(read, big_endian, inbuf, outbuf, offset) |
#define | RW_SVAL(read, big_endian, inbuf, outbuf, offset) |
#define | CAREFUL_ALIGNMENT 1 |
#define | CVAL(buf, pos) (((unsigned char *)(buf))[pos]) |
#define | PVAL(buf, pos) ((unsigned)CVAL(buf,pos)) |
#define | SCVAL(buf, pos, val) (CVAL(buf,pos) = (val)) |
#define | SVAL(buf, pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8) |
#define | IVAL(buf, pos) (SVAL(buf,pos)|SVAL(buf,(pos)+2)<<16) |
#define | SSVALX(buf, pos, val) (CVAL(buf,pos)=(val)&0xFF,CVAL(buf,pos+1)=(val)>>8) |
#define | SIVALX(buf, pos, val) (SSVALX(buf,pos,val&0xFFFF),SSVALX(buf,pos+2,val>>16)) |
#define | SVALS(buf, pos) ((int16)SVAL(buf,pos)) |
#define | IVALS(buf, pos) ((int32)IVAL(buf,pos)) |
#define | SSVAL(buf, pos, val) SSVALX((buf),(pos),((uint16)(val))) |
#define | SIVAL(buf, pos, val) SIVALX((buf),(pos),((uint32)(val))) |
#define | SSVALS(buf, pos, val) SSVALX((buf),(pos),((int16)(val))) |
#define | SIVALS(buf, pos, val) SIVALX((buf),(pos),((int32)(val))) |
#define | SMBMACRO(macro, buf, pos, val, len, size) { int l; for (l = 0; l < (len); l++) (val)[l] = macro((buf), (pos) + (size)*l); } |
#define | SSMBMACRO(macro, buf, pos, val, len, size) { int l; for (l = 0; l < (len); l++) macro((buf), (pos) + (size)*l, (val)[l]); } |
#define | PCVAL(buf, pos, val, len) SMBMACRO(CVAL,buf,pos,val,len,1) |
#define | PSVAL(buf, pos, val, len) SMBMACRO(SVAL,buf,pos,val,len,2) |
#define | PIVAL(buf, pos, val, len) SMBMACRO(IVAL,buf,pos,val,len,4) |
#define | PCVALS(buf, pos, val, len) SMBMACRO(CVALS,buf,pos,val,len,1) |
#define | PSVALS(buf, pos, val, len) SMBMACRO(SVALS,buf,pos,val,len,2) |
#define | PIVALS(buf, pos, val, len) SMBMACRO(IVALS,buf,pos,val,len,4) |
#define | PSCVAL(buf, pos, val, len) SSMBMACRO(SCVAL,buf,pos,val,len,1) |
#define | PSSVAL(buf, pos, val, len) SSMBMACRO(SSVAL,buf,pos,val,len,2) |
#define | PSIVAL(buf, pos, val, len) SSMBMACRO(SIVAL,buf,pos,val,len,4) |
#define | PSCVALS(buf, pos, val, len) SSMBMACRO(SCVALS,buf,pos,val,len,1) |
#define | PSSVALS(buf, pos, val, len) SSMBMACRO(SSVALS,buf,pos,val,len,2) |
#define | PSIVALS(buf, pos, val, len) SSMBMACRO(SIVALS,buf,pos,val,len,4) |
#define | SREV(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF)) |
#define | IREV(x) ((SREV(x)<<16) | (SREV((x)>>16))) |
#define | RSVAL(buf, pos) SREV(SVAL(buf,pos)) |
#define | RSVALS(buf, pos) SREV(SVALS(buf,pos)) |
#define | RIVAL(buf, pos) IREV(IVAL(buf,pos)) |
#define | RIVALS(buf, pos) IREV(IVALS(buf,pos)) |
#define | RSSVAL(buf, pos, val) SSVAL(buf,pos,SREV(val)) |
#define | RSSVALS(buf, pos, val) SSVALS(buf,pos,SREV(val)) |
#define | RSIVAL(buf, pos, val) SIVAL(buf,pos,IREV(val)) |
#define | RSIVALS(buf, pos, val) SIVALS(buf,pos,IREV(val)) |
#define | RPSVAL(buf, pos, val, len) SMBMACRO(RSVAL,buf,pos,val,len,2) |
#define | RPIVAL(buf, pos, val, len) SMBMACRO(RIVAL,buf,pos,val,len,4) |
#define | RPSVALS(buf, pos, val, len) SMBMACRO(RSVALS,buf,pos,val,len,2) |
#define | RPIVALS(buf, pos, val, len) SMBMACRO(RIVALS,buf,pos,val,len,4) |
#define | RPSSVAL(buf, pos, val, len) SSMBMACRO(RSSVAL,buf,pos,val,len,2) |
#define | RPSIVAL(buf, pos, val, len) SSMBMACRO(RSIVAL,buf,pos,val,len,4) |
#define | RPSSVALS(buf, pos, val, len) SSMBMACRO(RSSVALS,buf,pos,val,len,2) |
#define | RPSIVALS(buf, pos, val, len) SSMBMACRO(RSIVALS,buf,pos,val,len,4) |
#define | DBG_RW_PCVAL(charmode, string, depth, base, read, inbuf, outbuf, len) |
#define | DBG_RW_PSVAL(charmode, string, depth, base, read, big_endian, inbuf, outbuf, len) |
#define | DBG_RW_PIVAL(charmode, string, depth, base, read, big_endian, inbuf, outbuf, len) |
#define | DBG_RW_CVAL(string, depth, base, read, inbuf, outbuf) |
#define | DBG_RW_SVAL(string, depth, base, read, big_endian, inbuf, outbuf) |
#define | DBG_RW_IVAL(string, depth, base, read, big_endian, inbuf, outbuf) |
#define | ROUND1(a, b, c, d, k, s) a = lshift(a + F(b,c,d) + X[k], s) |
#define | ROUND2(a, b, c, d, k, s) a = lshift(a + G(b,c,d) + X[k] + (uint32)0x5A827999,s) |
#define | ROUND3(a, b, c, d, k, s) a = lshift(a + H(b,c,d) + X[k] + (uint32)0x6ED9EBA1,s) |
#define | uchar unsigned char |
#define | int16 signed short |
#define | False 0 |
#define | True 1 |
#define | DEBUG(a, b) ; |
#define | AddBytes(ptr, header, buf, count) |
#define | AddString(ptr, header, string) |
#define | AddUnicodeString(ptr, header, string) |
#define | GetUnicodeString(structPtr, header) unicodeToString(((char*)structPtr) + IVAL(&structPtr->header.offset,0) , SVAL(&structPtr->header.len,0)/2) |
#define | GetString(structPtr, header) toString((((char *)structPtr) + IVAL(&structPtr->header.offset,0)), SVAL(&structPtr->header.len,0)) |
#define | DumpBuffer(fp, structPtr, header) dumpRaw(fp,((unsigned char*)structPtr)+IVAL(&structPtr->header.offset,0),SVAL(&structPtr->header.len,0)) |
#define | ChallengeHash(structPtr, header) ((unsigned char*)structPtr)+IVAL(&structPtr->header.offset,0) |
#define | BAD -1 |
#define | DECODE64(c) (isascii(c) ? base64val[c] : BAD) |
Typedefs | |
typedef int | BOOL |
Functions | |
static uint32 | F (uint32 X, uint32 Y, uint32 Z) |
static uint32 | G (uint32 X, uint32 Y, uint32 Z) |
static uint32 | H (uint32 X, uint32 Y, uint32 Z) |
static uint32 | lshift (uint32 x, int s) |
static void | mdfour64 (uint32 *M) |
static void | copy64 (uint32 *M, unsigned char *in) |
static void | copy4 (unsigned char *out, uint32 x) |
void | mdfour (unsigned char *out, unsigned char *in, int n) |
static void | permute (char *out, char *in, uchar *p, int n) |
static void | l_shift (char *d, int count, int n) |
static void | concat (char *out, char *in1, char *in2, int l1, int l2) |
static void | xorFunction (char *out, char *in1, char *in2, int n) |
static void | dohash (char *out, char *in, char *key, int forw) |
static void | str_to_key (unsigned char *str, unsigned char *key) |
static void | smbhash (unsigned char *out, unsigned char *in, unsigned char *key, int forw) |
void | E_P16 (unsigned char *p14, unsigned char *p16) |
void | E_P24 (unsigned char *p21, unsigned char *c8, unsigned char *p24) |
void | D_P16 (unsigned char *p14, unsigned char *in, unsigned char *out) |
void | E_old_pw_hash (unsigned char *p14, unsigned char *in, unsigned char *out) |
void | cred_hash1 (unsigned char *out, unsigned char *in, unsigned char *key) |
void | cred_hash2 (unsigned char *out, unsigned char *in, unsigned char *key) |
void | cred_hash3 (unsigned char *out, unsigned char *in, unsigned char *key, int forw) |
void | SamOEMhash (unsigned char *data, unsigned char *key, int val) |
char * | StrnCpy (char *dest, const char *src, size_t n) |
size_t | skip_multibyte_char (char c) |
char * | safe_strcpy (char *dest, const char *src, size_t maxlength) |
void | strupper (char *s) |
void | SMBOWFencrypt (uchar passwd[16], uchar *c8, uchar p24[24]) |
void | SMBencrypt (uchar *passwd, uchar *c8, uchar *p24) |
static int | _my_wcslen (int16 *str) |
static int | _my_mbstowcs (int16 *dst, uchar *src, int len) |
void | E_md4hash (uchar *passwd, uchar *p16) |
void | nt_lm_owf_gen (char *pwd, uchar nt_p16[16], uchar p16[16]) |
void | NTLMSSPOWFencrypt (uchar passwd[8], uchar *ntlmchalresp, uchar p24[24]) |
void | SMBNTencrypt (uchar *passwd, uchar *c8, uchar *p24) |
static void | dumpRaw (FILE *fp, unsigned char *buf, size_t len) |
static char * | unicodeToString (char *p, size_t len) |
static unsigned char * | strToUnicode (char *p) |
static unsigned char * | toString (char *p, size_t len) |
void | BuildAuthRequest (tSmbNtlmAuthRequest *request, long flags, char *host, char *domain) |
void | setup_des_key (unsigned char key_56[], des_key_schedule ksch) |
void | calc_resp (unsigned char *keys, unsigned char *plaintext, unsigned char *results) |
void | buildAuthResponse (tSmbNtlmAuthChallenge *challenge, tSmbNtlmAuthResponse *response, long flags, char *user, char *password, char *domainname, char *host, tSmbNtlmAuthResponse *OptionalNtlmPacket3) |
void | dumpAuthRequest (FILE *fp, tSmbNtlmAuthRequest *request) |
void | Widetochar (char *destination, char *source, int len) |
void | chartoWide (char *destination, char *source, int len) |
__inline void | SetChallengeKey (tSmbNtlmAuthChallenge *challenge, uint8 *SpoofedChallenge) |
void | BuildAuthChallenge (tSmbNtlmAuthChallenge *pChallenge, char *DomainName, char *ServerName, char *DNS, char *FQDN, uint8 flags, uint8 *SpoofedChallenge) |
void | dumpAuthChallenge (FILE *fp, tSmbNtlmAuthChallenge *challenge) |
void | dumpAuthResponse (FILE *fp, tSmbNtlmAuthResponse *response) |
void | GetNTLMPacketInfo (tSmbNtlmAuthResponse *NtlmAuthResponse, char *UserName, char *DomainName, char *WorkstationName, int verbose) |
void | to64frombits (unsigned char *out, const unsigned char *in, int inlen) |
int | from64tobits (char *out, const char *in) |
Variables | |
static uint32 | A |
static uint32 | B |
static uint32 | C |
static uint32 | D |
static uchar | perm1 [56] |
static uchar | perm2 [48] |
static uchar | perm3 [64] |
static uchar | perm4 [48] |
static uchar | perm5 [32] |
static uchar | perm6 [64] |
static uchar | sc [16] = {1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1} |
static uchar | sbox [8][4][16] |
static const char | base64digits [] |
static const char | base64val [] |
#define AddBytes | ( | ptr, | |||
header, | |||||
buf, | |||||
count | ) |
Value:
{ \ if (buf && count) \ { \ SSVAL(&ptr->header.len,0,count); \ SSVAL(&ptr->header.maxlen,0,count); \ SIVAL(&ptr->header.offset,0,((ptr->buffer - ((uint8*)ptr)) + ptr->bufIndex)); \ memcpy(ptr->buffer+ptr->bufIndex, buf, count); \ ptr->bufIndex += count; \ } \ else \ { \ ptr->header.len = \ ptr->header.maxlen = 0; \ SIVAL(&ptr->header.offset,0,ptr->bufIndex); \ } \ }
#define AddString | ( | ptr, | |||
header, | |||||
string | ) |
#define AddUnicodeString | ( | ptr, | |||
header, | |||||
string | ) |
Value:
{ \ char *p = string; \ unsigned char *b = NULL; \ int len = 0; \ if (p) \ { \ len = strlen(p); \ b = strToUnicode(p); \ } \ AddBytes(ptr, header, b, len*2); \ }
#define ChallengeHash | ( | structPtr, | |||
header | ) | ((unsigned char*)structPtr)+IVAL(&structPtr->header.offset,0) |
#define DBG_RW_CVAL | ( | string, | |||
depth, | |||||
base, | |||||
read, | |||||
inbuf, | |||||
outbuf | ) |
#define DBG_RW_IVAL | ( | string, | |||
depth, | |||||
base, | |||||
read, | |||||
big_endian, | |||||
inbuf, | |||||
outbuf | ) |
#define DBG_RW_PCVAL | ( | charmode, | |||
string, | |||||
depth, | |||||
base, | |||||
read, | |||||
inbuf, | |||||
outbuf, | |||||
len | ) |
#define DBG_RW_PIVAL | ( | charmode, | |||
string, | |||||
depth, | |||||
base, | |||||
read, | |||||
big_endian, | |||||
inbuf, | |||||
outbuf, | |||||
len | ) |
#define DBG_RW_PSVAL | ( | charmode, | |||
string, | |||||
depth, | |||||
base, | |||||
read, | |||||
big_endian, | |||||
inbuf, | |||||
outbuf, | |||||
len | ) |
#define DBG_RW_SVAL | ( | string, | |||
depth, | |||||
base, | |||||
read, | |||||
big_endian, | |||||
inbuf, | |||||
outbuf | ) |
#define DEBUG | ( | a, | |||
b | ) | ; |
#define DumpBuffer | ( | fp, | |||
structPtr, | |||||
header | ) | dumpRaw(fp,((unsigned char*)structPtr)+IVAL(&structPtr->header.offset,0),SVAL(&structPtr->header.len,0)) |
#define GetString | ( | structPtr, | |||
header | ) | toString((((char *)structPtr) + IVAL(&structPtr->header.offset,0)), SVAL(&structPtr->header.len,0)) |
#define GetUnicodeString | ( | structPtr, | |||
header | ) | unicodeToString(((char*)structPtr) + IVAL(&structPtr->header.offset,0) , SVAL(&structPtr->header.len,0)/2) |
#define int16 signed short |
#define IVAL | ( | buf, | |||
pos | ) | (SVAL(buf,pos)|SVAL(buf,(pos)+2)<<16) |
#define PCVAL | ( | buf, | |||
pos, | |||||
val, | |||||
len | ) | SMBMACRO(CVAL,buf,pos,val,len,1) |
#define PCVALS | ( | buf, | |||
pos, | |||||
val, | |||||
len | ) | SMBMACRO(CVALS,buf,pos,val,len,1) |
#define PIVAL | ( | buf, | |||
pos, | |||||
val, | |||||
len | ) | SMBMACRO(IVAL,buf,pos,val,len,4) |
#define PIVALS | ( | buf, | |||
pos, | |||||
val, | |||||
len | ) | SMBMACRO(IVALS,buf,pos,val,len,4) |
#define PSCVAL | ( | buf, | |||
pos, | |||||
val, | |||||
len | ) | SSMBMACRO(SCVAL,buf,pos,val,len,1) |
#define PSCVALS | ( | buf, | |||
pos, | |||||
val, | |||||
len | ) | SSMBMACRO(SCVALS,buf,pos,val,len,1) |
#define PSIVAL | ( | buf, | |||
pos, | |||||
val, | |||||
len | ) | SSMBMACRO(SIVAL,buf,pos,val,len,4) |
#define PSIVALS | ( | buf, | |||
pos, | |||||
val, | |||||
len | ) | SSMBMACRO(SIVALS,buf,pos,val,len,4) |
#define PSSVAL | ( | buf, | |||
pos, | |||||
val, | |||||
len | ) | SSMBMACRO(SSVAL,buf,pos,val,len,2) |
#define PSSVALS | ( | buf, | |||
pos, | |||||
val, | |||||
len | ) | SSMBMACRO(SSVALS,buf,pos,val,len,2) |
#define PSVAL | ( | buf, | |||
pos, | |||||
val, | |||||
len | ) | SMBMACRO(SVAL,buf,pos,val,len,2) |
#define PSVALS | ( | buf, | |||
pos, | |||||
val, | |||||
len | ) | SMBMACRO(SVALS,buf,pos,val,len,2) |
#define ROUND1 | ( | a, | |||
b, | |||||
c, | |||||
d, | |||||
k, | |||||
s | ) | a = lshift(a + F(b,c,d) + X[k], s) |
#define ROUND2 | ( | a, | |||
b, | |||||
c, | |||||
d, | |||||
k, | |||||
s | ) | a = lshift(a + G(b,c,d) + X[k] + (uint32)0x5A827999,s) |
#define ROUND3 | ( | a, | |||
b, | |||||
c, | |||||
d, | |||||
k, | |||||
s | ) | a = lshift(a + H(b,c,d) + X[k] + (uint32)0x6ED9EBA1,s) |
#define RPIVAL | ( | buf, | |||
pos, | |||||
val, | |||||
len | ) | SMBMACRO(RIVAL,buf,pos,val,len,4) |
#define RPIVALS | ( | buf, | |||
pos, | |||||
val, | |||||
len | ) | SMBMACRO(RIVALS,buf,pos,val,len,4) |
#define RPSIVAL | ( | buf, | |||
pos, | |||||
val, | |||||
len | ) | SSMBMACRO(RSIVAL,buf,pos,val,len,4) |
#define RPSIVALS | ( | buf, | |||
pos, | |||||
val, | |||||
len | ) | SSMBMACRO(RSIVALS,buf,pos,val,len,4) |
#define RPSSVAL | ( | buf, | |||
pos, | |||||
val, | |||||
len | ) | SSMBMACRO(RSSVAL,buf,pos,val,len,2) |
#define RPSSVALS | ( | buf, | |||
pos, | |||||
val, | |||||
len | ) | SSMBMACRO(RSSVALS,buf,pos,val,len,2) |
#define RPSVAL | ( | buf, | |||
pos, | |||||
val, | |||||
len | ) | SMBMACRO(RSVAL,buf,pos,val,len,2) |
#define RPSVALS | ( | buf, | |||
pos, | |||||
val, | |||||
len | ) | SMBMACRO(RSVALS,buf,pos,val,len,2) |
#define RSIVALS | ( | buf, | |||
pos, | |||||
val | ) | SIVALS(buf,pos,IREV(val)) |
#define RSSVALS | ( | buf, | |||
pos, | |||||
val | ) | SSVALS(buf,pos,SREV(val)) |
#define RW_CVAL | ( | read, | |||
inbuf, | |||||
outbuf, | |||||
offset | ) |
#define RW_IVAL | ( | read, | |||
big_endian, | |||||
inbuf, | |||||
outbuf, | |||||
offset | ) |
#define RW_PCVAL | ( | read, | |||
inbuf, | |||||
outbuf, | |||||
len | ) |
#define RW_PIVAL | ( | read, | |||
big_endian, | |||||
inbuf, | |||||
outbuf, | |||||
len | ) |
#define RW_PSVAL | ( | read, | |||
big_endian, | |||||
inbuf, | |||||
outbuf, | |||||
len | ) |
#define RW_SVAL | ( | read, | |||
big_endian, | |||||
inbuf, | |||||
outbuf, | |||||
offset | ) |
#define SIVAL | ( | buf, | |||
pos, | |||||
val | ) | SIVALX((buf),(pos),((uint32)(val))) |
#define SIVALS | ( | buf, | |||
pos, | |||||
val | ) | SIVALX((buf),(pos),((int32)(val))) |
#define SIVALX | ( | buf, | |||
pos, | |||||
val | ) | (SSVALX(buf,pos,val&0xFFFF),SSVALX(buf,pos+2,val>>16)) |
#define SMBMACRO | ( | macro, | |||
buf, | |||||
pos, | |||||
val, | |||||
len, | |||||
size | ) | { int l; for (l = 0; l < (len); l++) (val)[l] = macro((buf), (pos) + (size)*l); } |
#define SREV | ( | x | ) | ((((x)&0xFF)<<8) | (((x)>>8)&0xFF)) |
#define SSMBMACRO | ( | macro, | |||
buf, | |||||
pos, | |||||
val, | |||||
len, | |||||
size | ) | { int l; for (l = 0; l < (len); l++) macro((buf), (pos) + (size)*l, (val)[l]); } |
#define SSVAL | ( | buf, | |||
pos, | |||||
val | ) | SSVALX((buf),(pos),((uint16)(val))) |
#define SSVALS | ( | buf, | |||
pos, | |||||
val | ) | SSVALX((buf),(pos),((int16)(val))) |
#define SSVALX | ( | buf, | |||
pos, | |||||
val | ) | (CVAL(buf,pos)=(val)&0xFF,CVAL(buf,pos+1)=(val)>>8) |
#define SVAL | ( | buf, | |||
pos | ) | (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8) |
#define uchar unsigned char |
static int _my_mbstowcs | ( | int16 * | dst, | |
uchar * | src, | |||
int | len | |||
) | [static] |
static int _my_wcslen | ( | int16 * | str | ) | [static] |
void BuildAuthChallenge | ( | tSmbNtlmAuthChallenge * | pChallenge, | |
char * | DomainName, | |||
char * | ServerName, | |||
char * | DNS, | |||
char * | FQDN, | |||
uint8 | flags, | |||
uint8 * | SpoofedChallenge | |||
) |
Definition at line 1437 of file ntlm.cpp.
References tSmbStrItem::buffer, tSmbNtlmAuthChallenge::buffer, tSmbNtlmAuthChallenge::challengeData, chartoWide(), DNSITEM, DOMAINNAMEITEM, tSmbNtlmAuthChallenge::emptyString, tSmbNtlmAuthChallenge::flags, FQDNITEM, tSmbNtlmAuthChallenge::ident, tSmbStrItem::ItemLength, tSmbStrItem::ItemType, tSmbStrHeader::len, tSmbStrHeader::maxlen, tSmbNtlmAuthChallenge::msgType, tSmbStrHeader::offset, tSmbNtlmAuthChallenge::reserved, SERVERNAMEITEM, and tSmbNtlmAuthChallenge::uDomain.
void BuildAuthRequest | ( | tSmbNtlmAuthRequest * | request, | |
long | flags, | |||
char * | host, | |||
char * | domain | |||
) |
void buildAuthResponse | ( | tSmbNtlmAuthChallenge * | challenge, | |
tSmbNtlmAuthResponse * | response, | |||
long | flags, | |||
char * | user, | |||
char * | password, | |||
char * | domainname, | |||
char * | host, | |||
tSmbNtlmAuthResponse * | OptionalNtlmPacket3 | |||
) |
Definition at line 1298 of file ntlm.cpp.
Referenced by GetSmbPacket3(), HandleIncommingHTTPRequest(), HandleIncommingIMAPRequest(), HandleIncommingPOP3Request(), and HandleIncommingSMTPRequest().
void calc_resp | ( | unsigned char * | keys, | |
unsigned char * | plaintext, | |||
unsigned char * | results | |||
) |
Definition at line 1286 of file ntlm.cpp.
References setup_des_key().
void chartoWide | ( | char * | destination, | |
char * | source, | |||
int | len | |||
) |
Definition at line 1417 of file ntlm.cpp.
Referenced by BuildAuthChallenge(), BuildSmbPacket(), BuildTreeConnectAndXStub(), ChangeServiceConfigWStub(), InitDataBlock(), and OpenScManagerWStub().
static void concat | ( | char * | out, | |
char * | in1, | |||
char * | in2, | |||
int | l1, | |||
int | l2 | |||
) | [static] |
static void copy4 | ( | unsigned char * | out, | |
uint32 | x | |||
) | [static] |
static void copy64 | ( | uint32 * | M, | |
unsigned char * | in | |||
) | [static] |
void cred_hash1 | ( | unsigned char * | out, | |
unsigned char * | in, | |||
unsigned char * | key | |||
) |
void cred_hash2 | ( | unsigned char * | out, | |
unsigned char * | in, | |||
unsigned char * | key | |||
) |
void cred_hash3 | ( | unsigned char * | out, | |
unsigned char * | in, | |||
unsigned char * | key, | |||
int | forw | |||
) |
void D_P16 | ( | unsigned char * | p14, | |
unsigned char * | in, | |||
unsigned char * | out | |||
) |
static void dohash | ( | char * | out, | |
char * | in, | |||
char * | key, | |||
int | forw | |||
) | [static] |
void dumpAuthChallenge | ( | FILE * | fp, | |
tSmbNtlmAuthChallenge * | challenge | |||
) |
Definition at line 1511 of file ntlm.cpp.
Referenced by HandleIncommingHTTPRequest(), HandleIncommingIMAPRequest(), HandleIncommingPOP3Request(), HandleIncommingSmbRequest(), HandleIncommingSMTPRequest(), and StablishNTLMSession().
void dumpAuthRequest | ( | FILE * | fp, | |
tSmbNtlmAuthRequest * | request | |||
) |
Definition at line 1391 of file ntlm.cpp.
References tSmbNtlmAuthRequest::ident, IVAL, and tSmbNtlmAuthRequest::msgType.
Referenced by HandleIncommingIMAPRequest(), HandleIncommingPOP3Request(), and HandleIncommingSMTPRequest().
void dumpAuthResponse | ( | FILE * | fp, | |
tSmbNtlmAuthResponse * | response | |||
) |
Definition at line 1591 of file ntlm.cpp.
Referenced by HandleIncommingHTTPRequest(), HandleIncommingIMAPRequest(), HandleIncommingPOP3Request(), and HandleIncommingSMTPRequest().
static void dumpRaw | ( | FILE * | fp, | |
unsigned char * | buf, | |||
size_t | len | |||
) | [static] |
void E_md4hash | ( | uchar * | passwd, | |
uchar * | p16 | |||
) |
Definition at line 944 of file ntlm.cpp.
References _my_mbstowcs(), _my_wcslen(), and int16.
void E_old_pw_hash | ( | unsigned char * | p14, | |
unsigned char * | in, | |||
unsigned char * | out | |||
) |
void E_P16 | ( | unsigned char * | p14, | |
unsigned char * | p16 | |||
) |
void E_P24 | ( | unsigned char * | p21, | |
unsigned char * | c8, | |||
unsigned char * | p24 | |||
) |
int from64tobits | ( | char * | out, | |
const char * | in | |||
) |
Definition at line 1695 of file ntlm.cpp.
Referenced by HandleIncommingHTTPRequest(), HandleIncommingIMAPRequest(), HandleIncommingPOP3Request(), and HandleIncommingSMTPRequest().
void GetNTLMPacketInfo | ( | tSmbNtlmAuthResponse * | NtlmAuthResponse, | |
char * | UserName, | |||
char * | DomainName, | |||
char * | WorkstationName, | |||
int | verbose | |||
) |
Definition at line 1622 of file ntlm.cpp.
Referenced by HandleIncommingHTTPRequest(), HandleIncommingIMAPRequest(), HandleIncommingPOP3Request(), HandleIncommingSMTPRequest(), and WriteDataToReportFile().
static void l_shift | ( | char * | d, | |
int | count, | |||
int | n | |||
) | [static] |
void mdfour | ( | unsigned char * | out, | |
unsigned char * | in, | |||
int | n | |||
) |
static void mdfour64 | ( | uint32 * | M | ) | [static] |
void nt_lm_owf_gen | ( | char * | pwd, | |
uchar | nt_p16[16], | |||
uchar | p16[16] | |||
) |
void NTLMSSPOWFencrypt | ( | uchar | passwd[8], | |
uchar * | ntlmchalresp, | |||
uchar | p24[24] | |||
) |
static void permute | ( | char * | out, | |
char * | in, | |||
uchar * | p, | |||
int | n | |||
) | [static] |
char* safe_strcpy | ( | char * | dest, | |
const char * | src, | |||
size_t | maxlength | |||
) |
void SamOEMhash | ( | unsigned char * | data, | |
unsigned char * | key, | |||
int | val | |||
) |
__inline void SetChallengeKey | ( | tSmbNtlmAuthChallenge * | challenge, | |
uint8 * | SpoofedChallenge | |||
) |
void setup_des_key | ( | unsigned char | key_56[], | |
des_key_schedule | ksch | |||
) |
void SMBencrypt | ( | uchar * | passwd, | |
uchar * | c8, | |||
uchar * | p24 | |||
) |
Definition at line 887 of file ntlm.cpp.
References DEBUG, E_P16(), SMBOWFencrypt(), StrnCpy(), strupper(), and uchar.
static void smbhash | ( | unsigned char * | out, | |
unsigned char * | in, | |||
unsigned char * | key, | |||
int | forw | |||
) | [static] |
void SMBNTencrypt | ( | uchar * | passwd, | |
uchar * | c8, | |||
uchar * | p24 | |||
) |
void SMBOWFencrypt | ( | uchar | passwd[16], | |
uchar * | c8, | |||
uchar | p24[24] | |||
) |
static void str_to_key | ( | unsigned char * | str, | |
unsigned char * | key | |||
) | [static] |
char* StrnCpy | ( | char * | dest, | |
const char * | src, | |||
size_t | n | |||
) |
void strupper | ( | char * | s | ) |
void to64frombits | ( | unsigned char * | out, | |
const unsigned char * | in, | |||
int | inlen | |||
) |
Definition at line 1669 of file ntlm.cpp.
Referenced by HandleIncommingHTTPRequest(), HandleIncommingIMAPRequest(), HandleIncommingPOP3Request(), and HandleIncommingSMTPRequest().
static unsigned char* toString | ( | char * | p, | |
size_t | len | |||
) | [static] |
static char* unicodeToString | ( | char * | p, | |
size_t | len | |||
) | [static] |
void Widetochar | ( | char * | destination, | |
char * | source, | |||
int | len | |||
) |
static void xorFunction | ( | char * | out, | |
char * | in1, | |||
char * | in2, | |||
int | n | |||
) | [static] |
const char base64digits[] [static] |
const char base64val[] [static] |
Initial value:
{ BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD, 62, BAD,BAD,BAD, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,BAD,BAD, BAD,BAD,BAD,BAD, BAD, 0, 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,BAD, BAD,BAD,BAD,BAD, BAD, 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,BAD, BAD,BAD,BAD,BAD }
uchar perm1[56] [static] |
uchar perm2[48] [static] |
uchar perm3[64] [static] |
Initial value:
{58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8, 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3, 61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7}
uchar perm4[48] [static] |
uchar perm5[32] [static] |
uchar perm6[64] [static] |
Initial value:
{ 40, 8, 48, 16, 56, 24, 64, 32, 39, 7, 47, 15, 55, 23, 63, 31, 38, 6, 46, 14, 54, 22, 62, 30, 37, 5, 45, 13, 53, 21, 61, 29, 36, 4, 44, 12, 52, 20, 60, 28, 35, 3, 43, 11, 51, 19, 59, 27, 34, 2, 42, 10, 50, 18, 58, 26, 33, 1, 41, 9, 49, 17, 57, 25}
uchar sc[16] = {1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1} [static] |