/* ** This one returns the configuration, useful for displaying information before running an attack. ** Basically just grabs information from the getters and puts it together in a more stylish way for terminal or log output. ** ** @return std::string */ std::string panda::getConfiguration() { std::string config; config = "\n\n+--------------[AngryPanda Configuration]---------------\n|\n|\tHosts: \t\t" + stringify(getHosts()); config += "\n|\tTarget count:\t\t" + stringify(getHostCount()); config += "\n|\tPort:\t\t" + stringify(getPort()); config += "\n|\tMode:\t\t" + stringify(getMode()); config += "\n|\tTries/IP:\t" + stringify(getTries()); if(arguments.mode) { config += "\n|\tWordlist:\t" + stringify(getWordlist()); config += "\n|\tUsername:\t" + stringify(getUsername()); } else { config += "\n|\tUsername:\t" + stringify(getUsername()); config += "\n|\tPassword:\t" + stringify(getPassword()); } return config; }
// Calculate the max time the rest of the scan could take int PortScanner::getRemainingScanTime() { if (debug > 2) printf("PortScanner::getRemainingScanTime: Called\n"); int bytes_per_packet = int(total_bytes_sent / packets_sent); return int(1 + getRTT().tv_sec + getRTT().tv_usec / 1000000 + (getPortCount() * getHostCount() * tries - packets_sent) * bytes_per_packet * 8 / getBandwidthMax()); }
// Calculate most conservative esitmate of scan progress int PortScanner::getPercentComplete() { if (debug > 2) printf("PortScanner::getPercentComplete: Called\n"); return int(100 * packets_sent / (getPortCount() * getHostCount() * tries)); }