Skip to content
Open
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
25 changes: 15 additions & 10 deletions extractApiPaths.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"strings"
)
Expand Down Expand Up @@ -40,7 +40,7 @@ func getApiPaths(domains []string) {
defer resp.Body.Close()

// Read response
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body) // Updated from ioutil.ReadAll
if err != nil {
fmt.Printf("Failed to read response body: %v\n", err)
return
Expand All @@ -54,14 +54,19 @@ func getApiPaths(domains []string) {
return
}

// Access and print API paths
if apiPaths, ok := response["apiPaths"].([]interface{}); ok {
for _, path := range apiPaths {
if pathStr, ok := path.(string); ok {
fmt.Println(pathStr)
} else {
fmt.Println("Error: Invalid type in 'apiPaths'")
}
// Check if "apiPaths" exists in the response
apiPaths, ok := response["apiPaths"].([]interface{})
if !ok {
fmt.Println("Error: 'apiPaths' missing or invalid in response")
return
}

// Print the API paths
for _, path := range apiPaths {
if pathStr, ok := path.(string); ok {
fmt.Println(pathStr)
} else {
fmt.Println("Error: Invalid type in 'apiPaths'")
}
}
}
4 changes: 2 additions & 2 deletions getS3Domains.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"strings"
)
Expand Down Expand Up @@ -40,7 +40,7 @@ func getS3Domains(domains []string) {
defer resp.Body.Close()

// Read response
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body) // Updated here
if err != nil {
fmt.Printf("Failed to read response body: %v\n", err)
return
Expand Down