Question:
RSAkeyfind a software written by Nadia Heninger and J Alex Halderman to find out the Cached RSA keys from memory dumps. I recently referred your tutorial to create a memory dump on my Ubuntu server. Once I had the dump ready, I decided to find RSA key using RSAkeyfind software. But while compiling the source, make failed with the error message as ‘memcmp, read, close was not declared in this scope‘.
Please help me to solve this error. Below is the complete error message:
root@ubuntu:~/rsakeyfind# make g++ -Wall -O4 -c -o rsakeyfind.o rsakeyfind.cpp rsakeyfind.cpp: In function "void FindKeys(unsigned char*, int, unsigned char*, int, bool)": rsakeyfind.cpp:98:46: error: "memcmp" was not declared in this scope if (memcmp(&image[i], target, target_size)) ^ rsakeyfind.cpp: In function "int GetHexByte(int)": rsakeyfind.cpp:141:26: error: "read" was not declared in this scope if (read(fd, &a[0], 1) < 1) ^ rsakeyfind.cpp:144:28: error: "read" was not declared in this scope if (read(fd, &a[1], 1) < 1) ^ rsakeyfind.cpp: In function "unsigned char* ReadModulus(char*, unsigned int&)": rsakeyfind.cpp:173:11: error: "close" was not declared in this scope close(fd); ^ make: *** [rsakeyfind.o] Error 1 root@ubuntu:~/rsakeyfind#
Solution:
The rsakeyfind.cpp program is missing few header files. Just add the below lines to the rsakeyfind.cpp and compile it again.
#include <fstream> #include <unistd.h> #include <string.h>
root@ubuntu:~/rsakeyfind# make g++ -Wall -O4 -c -o rsakeyfind.o rsakeyfind.cpp g++ -o rsakeyfind rsakeyfind.o root@ubuntu:~/rsakeyfind#