Use os.ExpandEnv for injecting gopath in dict path (#227)
This commit is contained in:
committed by
GitHub
parent
a5d3455333
commit
4603096b93
@@ -20,8 +20,8 @@ func parseArguments() error {
|
||||
|
||||
pflag.StringSliceP("targets", "t", []string{}, "The targets on which to scan for open RTSP streams - required (ex: 172.16.100.0/24)")
|
||||
pflag.StringSliceP("ports", "p", []string{"554", "5554", "8554"}, "The ports on which to search for RTSP streams")
|
||||
pflag.StringP("custom-routes", "r", "<GOPATH>/src/github.com/ullaakut/cameradar/dictionaries/routes", "The path on which to load a custom routes dictionary")
|
||||
pflag.StringP("custom-credentials", "c", "<GOPATH>/src/github.com/ullaakut/cameradar/dictionaries/credentials.json", "The path on which to load a custom credentials JSON dictionary")
|
||||
pflag.StringP("custom-routes", "r", "${GOPATH}/src/github.com/ullaakut/cameradar/dictionaries/routes", "The path on which to load a custom routes dictionary")
|
||||
pflag.StringP("custom-credentials", "c", "${GOPATH}/src/github.com/ullaakut/cameradar/dictionaries/credentials.json", "The path on which to load a custom credentials JSON dictionary")
|
||||
pflag.IntP("speed", "s", 4, "The nmap speed preset to use for discovery")
|
||||
pflag.DurationP("timeout", "T", 2*time.Second, "The timeout in miliseconds to use for attack attempts")
|
||||
pflag.BoolP("debug", "d", true, "Enable the debug logs")
|
||||
|
||||
+4
-5
@@ -3,7 +3,6 @@ package cameradar
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/ullaakut/disgo"
|
||||
@@ -12,8 +11,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
defaultCredentialDictionaryPath = "<GOPATH>/src/github.com/ullaakut/cameradar/dictionaries/credentials.json"
|
||||
defaultRouteDictionaryPath = "<GOPATH>/src/github.com/ullaakut/cameradar/dictionaries/routes"
|
||||
defaultCredentialDictionaryPath = "${GOPATH}/src/github.com/ullaakut/cameradar/dictionaries/credentials.json"
|
||||
defaultRouteDictionaryPath = "${GOPATH}/src/github.com/ullaakut/cameradar/dictionaries/routes"
|
||||
)
|
||||
|
||||
// Scanner represents a cameradar scanner. It scans a network and
|
||||
@@ -62,8 +61,8 @@ func New(options ...func(*Scanner)) (*Scanner, error) {
|
||||
disgo.Errorln(style.Failure("No $GOPATH was found.\nDictionaries may not be loaded properly, please set your $GOPATH to use the default dictionaries."))
|
||||
}
|
||||
|
||||
scanner.credentialDictionaryPath = strings.Replace(scanner.credentialDictionaryPath, "<GOPATH>", gopath, 1)
|
||||
scanner.routeDictionaryPath = strings.Replace(scanner.routeDictionaryPath, "<GOPATH>", gopath, 1)
|
||||
scanner.credentialDictionaryPath = os.ExpandEnv(scanner.credentialDictionaryPath)
|
||||
scanner.routeDictionaryPath = os.ExpandEnv(scanner.routeDictionaryPath)
|
||||
|
||||
scanner.term = disgo.NewTerminal(
|
||||
disgo.WithDebug(scanner.debug),
|
||||
|
||||
Reference in New Issue
Block a user