![]() |
Scan() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Public Function |
Declared in: TCPPortScannerStealth.h |
virtual BOOL Scan( IP aTarget);
//Check max sockets are ok if (GetMaxSockets()<=0 || !IsDone() || !aTarget) { //Report it ReportError("Scan","Invalid parameters!"); //Exit return FALSE; } try { //Delete the thread delete m_pThread; m_pThread=NULL; //Reset the pair ResetPair(); //Can we scan if (!CanScan()) { //Error ReportError("Scan","No ports given!"); //Error SetError(TRUE); //Exit return FALSE; } //Clear the ports map m_aPortsMap.clear(); //Do we have the socket? if (m_pScanner) delete m_pScanner; //Allocate it m_pScanner=new CTCPScanner; //Try to create it if (!m_pScanner->Create()) { //Report it ReportError("Scan","Failed to create socket!"); //Exit return FALSE; } //Set the source address as the sniffing interface m_pScanner->SetSourceAddress(m_aBindInterface); //Try to create the sniffer if (!CreateSniffer()) { //Error ReportError("Scan","Failed to create sniffer!"); //Error SetError(TRUE); //Exit return FALSE; } //Set the flags SetError(FALSE); SetDone(FALSE); //Save the number of max sockets ResetSocketCount(); //Delete the port data DeletePortsMap(); //Delete other data ResetData(); //Set our target SetTarget(aTarget); //Start the sniffer if (!m_pSniffer->Sniff(TRUE)) { //Error ReportError("Scan","Failed to create sniffer!"); //Error SetError(TRUE); //We are done SetDone(TRUE); //Exit return FALSE; } //Start the thread StartThread(); //Start the loop for (int iCounter=0; iCounter<GetMaxSockets(); ++iCounter) { BOOL bQuit; bQuit=FALSE; //Try to allocate sockets while (!bQuit) { //Another socket AdjustNumberOfSockets(1); //Create it if (!(bQuit=NewSocket())) ReportError("Scan","Failed to create socket!"); } } //Done return TRUE; } ERROR_HANDLER_RETURN("Scan",FALSE)
![]() |
Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003. |