Skip to content

Commit

Permalink
Merge pull request #118 from iamshreeram/feature-subdomaincenter
Browse files Browse the repository at this point in the history
feature: adding subdomain center as source
  • Loading branch information
edoardottt authored Oct 18, 2023
2 parents aefb769 + df98dcc commit 4f242d5
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
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

0 comments on commit 4f242d5

Please sign in to comment.