forked from thehackersbrain/simple_web_server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhacking.h
More file actions
executable file
·22 lines (22 loc) · 742 Bytes
/
hacking.h
File metadata and controls
executable file
·22 lines (22 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Dumps raw memory in hex byte and printable split format
void dump(const unsigned char *data_buffer, const unsigned int length) {
unsigned char byte;
unsigned int i, j;
for (int i = 0; i < length; i++){
byte = data_buffer[i];
printf("%02x ", data_buffer[i]); // Display byte in hex
if (((i%16)==15) || (i==length-1)){
for (int j = 0; j < 15-(i%16); j++)
printf(" ");
printf("| ");
for(j=(i-(i%16)); j <= i; j++){ // Display printable bytes from line
byte = data_buffer[j];
if((byte > 31) && (byte < 127)) // Outside printable char range
printf("%c", byte);
else
printf(".");
}
printf("\n"); // End of the dump line (each line is 16 byte)
} // End if
} // End for
}