-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v0.5
- Loading branch information
Showing
9 changed files
with
243 additions
and
45 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
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
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,27 @@ | ||
version: '{branch} - {build}' | ||
|
||
branches: | ||
only: | ||
- master | ||
- develop | ||
|
||
|
||
environment: | ||
GOPATH: c:\gopath | ||
GOVERSION: 1.8 | ||
|
||
install: | ||
- go version | ||
- go env | ||
- go get -v github.com/deckarep/golang-set | ||
- go get -v github.com/nhoya/goPwned | ||
- go get -v github.com/jessevdk/go-flags | ||
- go get -v gopkg.in/src-d/go-git.v4 | ||
- go get -v github.com/jaytaylor/html2text | ||
- go get -v gopkg.in/ns3777k/go-shodan.v2/shodan | ||
|
||
build_script: | ||
- go build | ||
|
||
artifacts: | ||
- path: gosint.exe |
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
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,3 @@ | ||
{ | ||
"ShodanAPIKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | ||
} |
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
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,105 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"strconv" | ||
|
||
"gopkg.in/ns3777k/go-shodan.v2/shodan" | ||
) | ||
|
||
func initShodan() { | ||
if len(opts.ShodanTarget) < 1 { | ||
fmt.Println("[-] You need to specify the target") | ||
os.Exit(1) | ||
} | ||
APIKey := getConfigFile().ShodanAPIKey | ||
if APIKey == "" { | ||
fmt.Println("[-] Unable to retrive Shodan API Key from config file") | ||
os.Exit(1) | ||
} | ||
fmt.Println("[+] APIKey Found") | ||
client := shodan.NewClient(nil, APIKey) | ||
if opts.ShodanScan { | ||
newShodanScan(client, opts.ShodanTarget) | ||
} else { | ||
for _, host := range opts.ShodanTarget { | ||
getShodanHostInfo(host, client) | ||
} | ||
} | ||
} | ||
|
||
func getShodanHostInfo(host string, client *shodan.Client) { | ||
fmt.Println("==== REPORT FOR " + host + " ====") | ||
report, err := client.GetServicesForHost(host, &shodan.HostServicesOptions{false, false}) | ||
if err != nil { | ||
fmt.Println("[-] Unable to get Report") | ||
fmt.Println(err) | ||
os.Exit(1) | ||
} | ||
fmt.Println("ISP: " + report.ISP) | ||
fmt.Println("Organization: " + report.Organization) | ||
if report.OS != "" { | ||
fmt.Println("OS: " + report.OS) | ||
} | ||
fmt.Println("Ports:", report.Ports) | ||
fmt.Println("Hostnames:", report.Hostnames) | ||
if len(report.Vulnerabilities) > 0 { | ||
fmt.Println("Vulnerabilities:", report.Vulnerabilities) | ||
} | ||
fmt.Println("Country:", report.HostLocation.Country) | ||
fmt.Println("City:", report.HostLocation.City) | ||
fmt.Println("Last Update: " + report.LastUpdate) | ||
getShodanServicesData(report.Data) | ||
|
||
if opts.ShodanHoneyPotFlag { | ||
checkHoneyPotProbability(client, host) | ||
} | ||
} | ||
|
||
func getShodanServicesData(services []*shodan.HostData) { | ||
for _, service := range services { | ||
if service.Product == "" { | ||
service.Product = "Unknown" | ||
} | ||
fmt.Println("Service on port " + strconv.Itoa(service.Port) + ": " + service.Product + " " + string(service.Version)) | ||
if service.Title != "" { | ||
fmt.Println("\tTitle: " + service.Title) | ||
} | ||
if service.OS != "" { | ||
fmt.Println("\tOS " + service.OS) | ||
} | ||
} | ||
} | ||
|
||
func newShodanScan(client *shodan.Client, hosts []string) { | ||
info, _ := client.GetAPIInfo() | ||
if info.ScanCredits < len(hosts) { | ||
fmt.Println("[-] Insufficient credits") | ||
os.Exit(1) | ||
} | ||
fmt.Println("[+] Current Scan credits:", info.ScanCredits) | ||
fmt.Println("[+] Requesting new scan") | ||
scan, err := client.Scan(hosts) | ||
if err != nil { | ||
fmt.Println(err) | ||
os.Exit(1) | ||
} | ||
fmt.Printf("[+] Scan request ID: %s (1 credit will be deducted)\n", scan.ID) | ||
for { | ||
status, _ := client.GetScanStatus(scan.ID) | ||
if status.Status == shodan.ScanStatusDone { | ||
fmt.Println("[+] Scan started, the new result will be available in ~30 minutes") | ||
break | ||
} | ||
} | ||
} | ||
|
||
func checkHoneyPotProbability(client *shodan.Client, host string) { | ||
honeyscore, err := client.CalcHoneyScore(host) | ||
if err != nil { | ||
fmt.Println(err) | ||
os.Exit(1) | ||
} | ||
fmt.Println("Honeypot Score (0-1):", honeyscore) | ||
} |
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
Oops, something went wrong.