Skip to content

Commit

Permalink
added new tool, idc
Browse files Browse the repository at this point in the history
  • Loading branch information
NitescuLucian committed May 2, 2023
1 parent e46a4bc commit b470d20
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
45 changes: 45 additions & 0 deletions idc/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package main

import (
"bufio"
"encoding/json"
"fmt"
"net"
"net/http"
"os"
)

func main() {
scanner := bufio.NewScanner(os.Stdin)

for scanner.Scan() {
input := scanner.Text()
if input == "" {
continue
}

// Get the IP address of the domain name
ip, err := net.LookupIP(input)
if err != nil {
continue
}
// Query Shodan for the IP address
resp, err := http.Get(fmt.Sprintf("https://internetdb.shodan.io/%s", ip[0].String()))
if err != nil {
continue
}
defer resp.Body.Close()
// Parse the JSON response
var result map[string]interface{}
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
continue
}
// Print the vuln if they exist
if vulns, ok := result["vulns"]; ok {
for _, vuln := range vulns.([]interface{}) {
fmt.Printf("%s:%s\n", input, vuln)
}
}
}

}
15 changes: 15 additions & 0 deletions idc/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# idc

## Why?

To vulnerability scan using internetdb.shodan.io.

## Install

You can install using go:

```
go install -v github.com/NitescuLucian/hacks/idc@latest
```

Contact me at [@LucianNitescu](https://twitter.com/LucianNitescu)

0 comments on commit b470d20

Please sign in to comment.