Fix dictionary path for binary & use glide in CI

This commit is contained in:
Brendan LE GLAUNEC
2017-10-19 20:32:23 +02:00
committed by Brendan Le Glaunec
parent 961d34d05a
commit dba1391a08
4 changed files with 15 additions and 11 deletions
+2 -4
View File
@@ -22,10 +22,8 @@ install:
- docker build -t cameradar .
script:
- go get github.com/andelf/go-curl
- go get github.com/pkg/errors
- go get gopkg.in/go-playground/validator.v9
- go get github.com/stretchr/testify/assert
- curl https://glide.sh/get | sh
- glide install
# Run unit tests
- go test
# Launch a fake camera to check if cameradar is able to access it
+3 -2
View File
@@ -23,5 +23,6 @@ RUN apk --update add --no-cache nmap nmap-nselibs nmap-scripts \
curl-dev
WORKDIR /app/cameradar
COPY --from=build-env /go/src/github.com/EtixLabs/cameradar/ /app/
ENTRYPOINT ["/app/cameradar/cameradar"]
COPY --from=build-env /go/src/github.com/EtixLabs/cameradar/dictionaries/ /app/dictionaries/
COPY --from=build-env /go/src/github.com/EtixLabs/cameradar/cameradar/ /app/cameradar/
ENTRYPOINT ["/app/cameradar/cameradar", "-r", "/app/dictionaries/routes", "-c", "/app/dictionaries/credentials.json"]
+2 -2
View File
@@ -146,8 +146,8 @@ With the above result, the RTSP URL would be `rtsp://admin:12345@173.16.100.45:5
* **"-p, --ports"**: (Default: `554,8554`) Set custom ports.
* **"-s, --speed"**: (Default: `4`) Set custom nmap discovery presets to improve speed or accuracy. It's recommended to lower it if you are attempting to scan an unstable and slow network, or to increase it if on a very performant and reliable network. See [this for more info on the nmap timing templates](https://nmap.org/book/man-performance.html).
* **"-T, --timeout"**: (Default: `2000`) Set custom timeout value in miliseconds after which an attack attempt without an answer should give up. It's recommended to increase it when attempting to scan unstable and slow networks or to decrease it on very performant and reliable networks.
* **"-r, --custom-routes"**: (Default: `dictionaries/routes`) Set custom dictionary path for routes
* **"-c, --custom-credentials"**: (Default: `dictionaries/credentials.json`) Set custom dictionary path for credentials
* **"-r, --custom-routes"**: (Default: `<CAMERADAR_GOPATH>/dictionaries/routes`) Set custom dictionary path for routes
* **"-c, --custom-credentials"**: (Default: `<CAMERADAR_GOPATH>/dictionaries/credentials.json`) Set custom dictionary path for credentials
* **"-o, --nmap-output"**: (Default: `/tmp/cameradar_scan.xml`) Set custom nmap output path
* **"-l, --log"**: Enable debug logs (nmap requests, curl describe requests, etc.)
* **"-h"** : Display the usage information
+8 -3
View File
@@ -15,6 +15,7 @@ package main
import (
"fmt"
"os"
"strings"
"time"
"github.com/EtixLabs/cameradar"
@@ -26,11 +27,11 @@ import (
)
type options struct {
Target string `short:"t" long:"target" description:"The target on which to scan for open RTSP streams - required" required:"true"`
Target string `short:"t" long:"target" description:"The target on which to scan for open RTSP streams - required (ex: 172.16.100.0/24)" required:"true"`
Ports string `short:"p" long:"ports" description:"The ports on which to search for RTSP streams" default:"554,8554"`
OutputFile string `short:"o" long:"nmap-output" description:"The path where nmap will create its XML result file" default:"/tmp/cameradar_scan.xml"`
Routes string `short:"r" long:"custom-routes" description:"The path on which to load a custom routes dictionary" default:"../dictionaries/routes"`
Credentials string `short:"c" long:"custom-credentials" description:"The path on which to load a custom credentials JSON dictionary" default:"../dictionaries/credentials.json"`
Routes string `short:"r" long:"custom-routes" description:"The path on which to load a custom routes dictionary" default:"<GOPATH>/src/github.com/EtixLabs/cameradar/dictionaries/routes"`
Credentials string `short:"c" long:"custom-credentials" description:"The path on which to load a custom credentials JSON dictionary" default:"<GOPATH>/src/github.com/EtixLabs/cameradar/dictionaries/credentials.json"`
Speed int `short:"s" long:"speed" description:"The nmap speed preset to use" default:"4"`
Timeout int `short:"T" long:"timeout" description:"The timeout in miliseconds to use for attack attempts" default:"2000"`
EnableLogs bool `short:"l" long:"log" description:"Enable the logs for nmap's output to stdout"`
@@ -45,6 +46,10 @@ func main() {
w := startSpinner(options.EnableLogs)
gopath := os.Getenv("GOPATH")
options.Credentials = strings.Replace(options.Credentials, "<GOPATH>", gopath, 1)
options.Routes = strings.Replace(options.Routes, "<GOPATH>", gopath, 1)
credentials, err := cmrdr.LoadCredentials(options.Credentials)
if err != nil {
color.Red("Invalid credentials dictionary: %s", err.Error())