Devon is an applications developer that just got back from a conference on how to correctly write
code. Devon has a number of programs he has written that access data across WAN links, so he
is particularly concerned about their security. Devon writes a script in C++ to check the security of
the programs running on his internal servers. What will the following code from Devon’s script
accomplish?
#include <iostream>
#include <socket.cpp>
#include <util.h>
using namespace std;
bool tryPort(int p);
string target(“”);
int main(int argC, char *argV[])
{
printf(“PlagueZ port scanner 0.1\n”);
int startPort = getInt(“start Port: “);
int endPort = getInt(“end Port: “);
target = getString(“Host: “);
printf(“[Processing port %d to %d]\n”,
startPort, endPort);
for(int i=0; i<endPort; i++)
{
printf(“[Trying port: %d]\n”, i);
if(tryPort(i)) // port open
printf(“[Port %d is open]\n”, i);
}
printf(“——Scan Finished——-\n”);
system(“pause”);
return 0;
}
bool tryPort(int p)
{
SocketClient *scan;
try
{
scan = new SocketClient(target, p);
}
catch(int e) { delete &scan; return
false; }
delete &scan;
return true;
}
A.
Scan the perimeter firewall for DoS vulnerabilities
B.
Create socket connections to the remote sites to check their security
C.
Close off any ports used by malicious code
D.
Scan for open ports
Explanation: