Table of Contents

Nikto

Examples

 def run_nikto_scan(target_url):
     result = subprocess.run(['nikto', '-h', target_url], capture_output=True, text=True)
     print(result.stdout)
     if result.stderr:
         print(f"Error: {result.stderr}")
 # Run Nikto scan on a target URL
 run_nikto_scan('http://example.com')
 ```

 public class NiktoExample {
     public static void runNiktoScan(String targetUrl) {
         try {
             Process process = new ProcessBuilder("nikto", "-h", targetUrl).start();
             BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
             String line;
             while ((line = reader.readLine()) != null) {
                 System.out.println(line);
             }
             reader.close();
             int exitCode = process.waitFor();
             if (exitCode != 0) {
                 BufferedReader errorReader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
                 while ((line = errorReader.readLine()) != null) {
                     System.err.println("Error: " + line);
                 }
                 errorReader.close();
             }
         } catch (Exception e) {
             e.printStackTrace();
         }
     }
     public static void main(String[] args) {
         // Run Nikto scan on a target URL
         runNiktoScan("http://example.com");
     }
 }
 ```

Summary