First, the basic principle of the vulnerability scanner:
Writing a Vulnerability Scanner Progressing whether there may be a file with security risks on the remote server exists, its Socket establishment process is the same, the port scanner is the same, and the vulnerability scanner usually uses the 80 port, then this port Send a request for a GET file, the server receives the request to return file content, if the file does not exist, return an error message, can determine if the file is present by receiving the return content. Sending and receiving data requires a function send () and RECV (), and the string existing in the stream requires the function strstr (), which in addition to the knowledge of the Socket function library, there is also some of the String function library. know how.
Second, simple vulnerability scan source code:
/ ************************************************** /
/ * Port Scanner Source Code * /
/ * Cgiscanner.cpp * /
/ ************************************************** /
#include
#include
#include
Int main (int Argc, char * argv [])
{
IF (argc! = 2) {
Printf ("Useage: Scan [IP Address] / N");
Return (1);
}
Struct SockAddr_in Blah;
Struct hostent * he;
Wsadata wsadata;
INT I;
Word wversionRequested;
Socket sock;
Char buff [1024];
Char * EX [10];
EX [1] = "get /../....../.. --...0 / n / n";
EX [2] = "get /scripts/..