Projects STRLCPY shodanidb Commits fad21dcc
🤬
  • ■ ■ ■ ■ ■ ■
    README.md
    skipped 27 lines
    28 28   -v Verbose mode
    29 29   -c Concurrency (default 5)
    30 30   -nmap Run Nmap Service Detection
     31 + -script Run Nmap Scripts
    31 32   
    32 33   
    33 34  # Simple Usage:
    skipped 37 lines
    71 72  echo 149.202.182.140 | shodanidb -nmap -compare output.json
    72 73  echo 149.202.182.140 | shodanidb -url -compare output.json
    73 74  echo 149.202.182.140 | shodanidb -url -nmap -compare output.json
     75 +echo 149.202.182.140 | shodanidb -url -nmap -script -compare output.json
    74 76  ```
    75 77   
    76 78   
    skipped 13 lines
    90 92  echo 149.202.182.140 | shodanidb -nmap
    91 93  echo 149.202.182.140 | shodanidb -url -nmap
    92 94  echo 149.202.182.140 | shodanidb -nmap -compare output.json
     95 +```
     96 + 
     97 +Also it can be used with `-script` switch. It's equals to `-sC` in the nmap and run the nmap scripts.
     98 + 
     99 +```shell
     100 +echo 149.202.182.140 | shodanidb -nmap -script
    93 101  ```
    94 102   
    95 103   
    skipped 15 lines
  • ■ ■ ■ ■ ■
    shodanidb.go
    skipped 29 lines
    30 30   
    31 31  var (
    32 32   nmapScan bool
     33 + script bool
    33 34   urls bool
    34 35   noCPEs bool
    35 36   noTags bool
    skipped 19 lines
    55 56   flag.BoolVar(&urls, "url", false, "Show only IP and Port")
    56 57   flag.IntVar(&concurrency, "c", 5, "Concurrency")
    57 58   flag.BoolVar(&nmapScan, "nmap", false, "Run Nmap Service Detection")
     59 + flag.BoolVar(&script, "script", false, "Run Nmap Scripts")
    58 60   flag.Parse()
    59 61   
    60 62   var inputs, targets []string
    skipped 322 lines
    383 385   
    384 386   ports := strings.Trim(strings.Join(strings.Fields(fmt.Sprint(intPorts)), ", "), "[]")
    385 387   
    386  - scanner, err := nmap.NewScanner(
     388 + var options = []nmap.Option{
    387 389   nmap.WithTargets(target),
    388 390   nmap.WithPorts(ports),
    389 391   nmap.WithServiceInfo(),
    390 392   nmap.WithSkipHostDiscovery(),
    391  - )
     393 + }
     394 + 
     395 + if script {
     396 + options = append(options, nmap.WithDefaultScript())
     397 + }
     398 + 
     399 + scanner, err := nmap.NewScanner(options...)
    392 400   if err != nil {
    393 401   log.Fatalf("unable to create nmap scanner: %v", err)
    394 402   }
    skipped 15 lines
    410 418   }
    411 419   for _, port := range host.Ports {
    412 420   fmt.Printf("%s:%d/%s %s %s %s %s %s\n", host.Addresses[0], port.ID, port.Protocol, port.State, port.Service.Name, port.Service.Product, port.Service.ExtraInfo, port.Service.Version)
     421 + if script {
     422 + for _, service := range port.Scripts {
     423 + fmt.Printf(" %s: %s\n", service.ID, service.Output)
     424 + }
     425 + fmt.Println()
     426 + }
    413 427   }
    414 428   }
    415 429  }
Please wait...
Page is in error, reload to recover