Skip to content

Commit

Permalink
Embed default lists #135
Browse files Browse the repository at this point in the history
  • Loading branch information
edoardottt committed Apr 7, 2024
1 parent e87ac54 commit f03d537
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 21 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ WORKDIR $GOPATH/src/github.com/edoardottt/scilla
COPY . .
RUN go mod download golang.org/x/sys
RUN go install -v ./...
RUN mv ./lists/ /usr/bin/

ENTRYPOINT ["scilla"]
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,12 @@ lint:
linux:
@go build ./cmd/scilla
@sudo mv scilla /usr/bin/
@sudo cp -r lists/ /usr/bin/
@chmod +x scripts/config.sh
@./scripts/config.sh
@echo "Done."

unlinux:
@sudo rm -rf /usr/bin/scilla
@sudo rm -rf /usr/bin/lists/
@rm -rf ~/.config/scilla
@echo "Done."

Expand Down
21 changes: 12 additions & 9 deletions pkg/input/dirs.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ import (
"bufio"
"log"
"os"
"runtime"
"strings"

_ "embed"

sliceUtils "github.com/edoardottt/scilla/internal/slice"
urlUtils "github.com/edoardottt/scilla/internal/url"
Expand All @@ -41,6 +43,11 @@ const (
windows = "windows"
)

var (
//go:embed dirs.txt
defaultDirsWordlist string
)

// ReadDictDirs reads all the possible dirs from input file.
func ReadDictDirs(inputFile string) []string {
file, err := os.Open(inputFile)
Expand Down Expand Up @@ -73,18 +80,14 @@ func ReadDictDirs(inputFile string) []string {
}

// CreateUrls returns a list of directories
// from the default file lists/dirs.txt.
// from the default file dirs.txt.
func CreateUrls(filename string, scheme string, url string) []string {
var dirs []string

if filename == "" {
if runtime.GOOS == windows {
dirs = ReadDictDirs("lists/dirs.txt")
} else { // linux
dirs = ReadDictDirs("/usr/bin/lists/dirs.txt")
}
} else {
if filename != "" {
dirs = ReadDictDirs(filename)
} else {
dirs = strings.Fields(defaultDirsWordlist)
}

result := []string{}
Expand Down
File renamed without changes.
File renamed without changes.
21 changes: 12 additions & 9 deletions pkg/input/subs.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,18 @@ import (
"bufio"
"log"
"os"
"runtime"
"strings"

_ "embed"

urlUtils "github.com/edoardottt/scilla/internal/url"
)

var (
//go:embed subdomains.txt
defaultSubdomainsWordlist string
)

// ReadDictSubs reads all the possible subdomains from file.
func ReadDictSubs(inputFile string) []string {
file, err := os.Open(inputFile)
Expand All @@ -58,18 +65,14 @@ func ReadDictSubs(inputFile string) []string {
}

// CreateSubdomains returns a list of subdomains
// from the default file lists/subdomains.txt.
// from the default file subdomains.txt.
func CreateSubdomains(filename string, scheme string, url string) []string {
var subs []string

if filename == "" {
if runtime.GOOS == windows {
subs = ReadDictSubs("lists/subdomains.txt")
} else { // linux
subs = ReadDictSubs("/usr/bin/lists/subdomains.txt")
}
} else {
if filename != "" {
subs = ReadDictSubs(filename)
} else {
subs = strings.Fields(defaultSubdomainsWordlist)
}

result := []string{}
Expand Down

0 comments on commit f03d537

Please sign in to comment.