Skip to content

Commit

Permalink
removing http since no point to duplicate, removing unused var from f…
Browse files Browse the repository at this point in the history
…etchurls.js
  • Loading branch information
CyberRoute committed Oct 17, 2023
1 parent 50b3fe4 commit c2336a9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 38 deletions.
61 changes: 26 additions & 35 deletions pkg/fuzzer/fuzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,46 +22,37 @@ func checkError(err error) {
}

func Get(Mu *sync.Mutex, domain, path string, progress float32, verbose bool) {
urjoinHTTP := "http://" + domain + path
urjoinHTTPS := "https://" + domain + path

urls := []string{urjoinHTTP, urjoinHTTPS}

for _, urjoin := range urls {
url, err := url.Parse(urjoin)
if err != nil {
log.Error().Err(err).Msgf("Error parsing URL: %s", urjoin)
continue
}
urjoin := "https://" + domain + path
url, err := url.Parse(urjoin)
if err != nil {
log.Error().Err(err).Msgf("Error parsing URL: %s", urjoin)
}

get, err := http.NewRequest("GET", url.String(), nil)
if err != nil {
log.Error().Err(err).Msgf("Error creating request for URL: %s", urjoin)
continue
}
get, err := http.NewRequest("GET", url.String(), nil)
if err != nil {
log.Error().Err(err).Msgf("Error creating request for URL: %s", urjoin)
}

client := &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
},
}
client := &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
},
}

resp, err := client.Do(get)
if err != nil {
log.Error().Err(err).Msgf("Error performing request for URL: %s", urjoin)
continue
}
resp, err := client.Do(get)
if err != nil {
log.Error().Err(err).Msgf("Error performing request for URL: %s", urjoin)
}

statusCode := float64(resp.StatusCode)
payload := &models.Url{Path: urjoin, Progress: progress, Status: statusCode}
payloadBuf := new(bytes.Buffer)
err = json.NewEncoder(payloadBuf).Encode(payload)
checkError(err)
statusCode := float64(resp.StatusCode)
payload := &models.Url{Path: urjoin, Progress: progress, Status: statusCode}
payloadBuf := new(bytes.Buffer)
err = json.NewEncoder(payloadBuf).Encode(payload)
checkError(err)

dfileHandler(Mu, domain, urjoin, statusCode, progress)
if verbose {
log.Info().Msg(fmt.Sprintf("%s => %s", urjoin, resp.Status))
}
dfileHandler(Mu, domain, urjoin, statusCode, progress)
if verbose {
log.Info().Msg(fmt.Sprintf("%s => %s", urjoin, resp.Status))
}
}

Expand Down
3 changes: 0 additions & 3 deletions static/js/fetchurls.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ function fetchUrls() {
// Get container element
const container = document.getElementById("container");
var bar = document.querySelector(".progress-bar");
var cardHeader = document.querySelector(".card-header h5");
var speedElement = document.getElementById("data");


// Clear loading message and append data
container.innerHTML = "";
data.Urls.forEach(url => {
Expand Down

0 comments on commit c2336a9

Please sign in to comment.