Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: adding subdomain center as source #118

Merged
merged 5 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions pkg/opendb/subdomaincenter.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*

=======================
Scilla - Information Gathering Tool
=======================

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.

@Repository: https://github.com/edoardottt/scilla

@Author: edoardottt, https://www.edoardoottavianelli.it

@License: https://github.com/edoardottt/scilla/blob/main/LICENSE

*/

package opendb

import (
"encoding/json"
"fmt"
"io"
"net/http"

httpUtils "github.com/edoardottt/scilla/internal/http"
)

// SubdomainCenter retrieves from the url below some known subdomains.
func SubdomainCenterSubdomains(domain string, plain bool) []string {
if !plain {
fmt.Println("Pulling data from Subdomain Center")
}

client := http.Client{
Timeout: httpUtils.Seconds30,
}

result := make([]string, 0)
url := "http://api.subdomain.center/?domain=" + domain

resp, err := client.Get(url)
if err != nil {
return result
}
defer resp.Body.Close()

// read the response body
body, err := io.ReadAll(resp.Body)
if err != nil {
return result
}

// Decode the response body as list of string
var response []string
err = json.Unmarshal(body, &response)

if err != nil {
return result
}

result = append(result, response...)

return result
}
8 changes: 8 additions & 0 deletions pkg/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ func ReportSubcommandHandler(userInput input.Input, mutex *sync.Mutex,
// sonar := opendb.SonarSubdomains(urlUtils.CleanProtocol(target), false)
// subdomains = opendb.AppendDBSubdomains(sonar, subdomains)

// Service not working
// subdomaincenter := opendb.SubdomainCenterSubdomains(urlUtils.CleanProtocol(target), false)
// subdomains = opendb.AppendDBSubdomains(subdomaincenter, subdomains)

if userInput.ReportVirusTotal {
vtSubs := opendb.VirusTotalSubdomains(urlUtils.CleanProtocol(target), input.GetVirusTotalKey(), false)
subdomains = opendb.AppendDBSubdomains(vtSubs, subdomains)
Expand Down Expand Up @@ -365,6 +369,10 @@ func SubdomainSubcommandHandler(userInput input.Input, mutex *sync.Mutex,
// sonar := opendb.SonarSubdomains(urlUtils.CleanProtocol(target), userInput.SubdomainPlain)
// subdomains = opendb.AppendDBSubdomains(sonar, subdomains)

// Service not working
// subdomaincenter := opendb.SubdomainCenterSubdomains(urlUtils.CleanProtocol(target), false)
// subdomains = opendb.AppendDBSubdomains(subdomaincenter, subdomains)

if userInput.SubdomainVirusTotal {
vtSubs := opendb.VirusTotalSubdomains(urlUtils.CleanProtocol(target), input.GetVirusTotalKey(),
userInput.SubdomainPlain)
Expand Down