mirror of
https://github.com/decoder-it/ADCSCoercePotato
synced 2026-06-08 13:46:48 +00:00
49 lines
1.0 KiB
C++
49 lines
1.0 KiB
C++
#include <stdio.h>
|
|
|
|
void DumpHex(const void* data, size_t size) {
|
|
char ascii[17];
|
|
size_t i, j;
|
|
ascii[16] = '\0';
|
|
for (i = 0; i < size; ++i) {
|
|
printf("%02X ", ((unsigned char*)data)[i]);
|
|
if (((unsigned char*)data)[i] >= ' ' && ((unsigned char*)data)[i] <= '~') {
|
|
ascii[i % 16] = ((unsigned char*)data)[i];
|
|
}
|
|
else {
|
|
ascii[i % 16] = '.';
|
|
}
|
|
if ((i + 1) % 8 == 0 || i + 1 == size) {
|
|
printf(" ");
|
|
if ((i + 1) % 16 == 0) {
|
|
printf("| %s \n", ascii);
|
|
}
|
|
else if (i + 1 == size) {
|
|
ascii[(i + 1) % 16] = '\0';
|
|
if ((i + 1) % 16 <= 8) {
|
|
printf(" ");
|
|
}
|
|
for (j = (i + 1) % 16; j < 16; ++j) {
|
|
printf(" ");
|
|
}
|
|
printf("| %s \n", ascii);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
int findNTLMBytes(char* bytes, int len) {
|
|
|
|
char pattern[7] = { 0x4E, 0x54, 0x4C, 0x4D, 0x53, 0x53, 0x50 };
|
|
int pIdx = 0;
|
|
int i;
|
|
for (i = 0; i < len; i++) {
|
|
if (bytes[i] == pattern[pIdx]) {
|
|
pIdx = pIdx + 1;
|
|
if (pIdx == 7) return (i - 6);
|
|
}
|
|
else {
|
|
pIdx = 0;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|