I am working on a program that scans a host and I ve run in to a simple problem I cant figure out. When it asks what type of scan to perform and you say number 2 it will go to the number 1 type of scan. Here is the code:
#include <iostream>
#include <cstring>
#include <string>
using namespace std;
int main()
{
string ping = "ping";
string ip_address;
string ipai;
string ping_ip;
string ping_ip_intense;
int rd;
int number_of_scan;
string scan;
string intense_scan;
string light_scan;
cout<<"1. Regular Scan"<<endl;
cout<<"2. Intense Scan"<<endl;
cout<<"3. Light Scan"<<endl;
cout<<"\n\n\n"<<endl;
cout<<"Please enter the number of the scan you would like to perform: "<<endl;
cin>>number_of_scan;
if (number_of_scan = '1'){
cout<<"You are going to perform the Regular Scan"<<endl;
cout<<"Please enter the IP address or domain of the host: "<<endl;
cin>>ip_address;
ping_ip= ping+" "+ip_address;
system(ping_ip.c_str());
}
if (number_of_scan = '2'){
cout<<"You are goin to perform the Intense Scan"<<endl;
cout<<"Please enter the IP address or domain of the host: "<<endl;
cin>>ipai;
rd = rand()% 83 + 107;
cout<<"Estimated time(seconds): "<<rd<<endl;
ping_ip_intense="ping "+ipai+" -n 20 -l 60 -w 10000";
system(ping_ip_intense.c_str());
}
system("pause");
return 0;
}
Thank You.