-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e46a4bc
commit b470d20
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |