Compare commits

...

3 Commits

Author SHA1 Message Date
Brendan Le Glaunec 9a6c030a74 Remove spam from curl verbose mode (#257) 2020-01-21 08:49:36 +01:00
Brendan Le Glaunec afe2caddd6 Add routes and credentials for Besder IP cameras (#256) 2020-01-21 08:39:06 +01:00
Brendan Le Glaunec 8349bc7c3a Fix scan unit tests (#253) 2020-01-17 09:47:38 +01:00
4 changed files with 23 additions and 21 deletions
-10
View File
@@ -191,8 +191,6 @@ func (s *Scanner) detectAuthMethod(stream Stream) int {
s.setCurlOptions(c) s.setCurlOptions(c)
_ = c.Setopt(curl.OPT_VERBOSE, 1)
// Send a request to the URL of the stream we want to attack. // Send a request to the URL of the stream we want to attack.
_ = c.Setopt(curl.OPT_URL, attackURL) _ = c.Setopt(curl.OPT_URL, attackURL)
// Set the RTSP STREAM URI as the stream URL. // Set the RTSP STREAM URI as the stream URL.
@@ -233,8 +231,6 @@ func (s *Scanner) routeAttack(stream Stream, route string) bool {
s.setCurlOptions(c) s.setCurlOptions(c)
_ = c.Setopt(curl.OPT_VERBOSE, 1)
// Set proper authentication type. // Set proper authentication type.
_ = c.Setopt(curl.OPT_HTTPAUTH, stream.AuthenticationType) _ = c.Setopt(curl.OPT_HTTPAUTH, stream.AuthenticationType)
_ = c.Setopt(curl.OPT_USERPWD, fmt.Sprint(stream.Username, ":", stream.Password)) _ = c.Setopt(curl.OPT_USERPWD, fmt.Sprint(stream.Username, ":", stream.Password))
@@ -271,10 +267,6 @@ func (s *Scanner) routeAttack(stream Stream, route string) bool {
} }
func (s *Scanner) credAttack(stream Stream, username string, password string) bool { func (s *Scanner) credAttack(stream Stream, username string, password string) bool {
fmt.Println()
fmt.Println()
fmt.Println()
c := s.curl.Duphandle() c := s.curl.Duphandle()
attackURL := fmt.Sprintf( attackURL := fmt.Sprintf(
@@ -288,8 +280,6 @@ func (s *Scanner) credAttack(stream Stream, username string, password string) bo
s.setCurlOptions(c) s.setCurlOptions(c)
_ = c.Setopt(curl.OPT_VERBOSE, 1)
// Set proper authentication type. // Set proper authentication type.
_ = c.Setopt(curl.OPT_HTTPAUTH, stream.AuthenticationType) _ = c.Setopt(curl.OPT_HTTPAUTH, stream.AuthenticationType)
_ = c.Setopt(curl.OPT_USERPWD, fmt.Sprint(username, ":", password)) _ = c.Setopt(curl.OPT_USERPWD, fmt.Sprint(username, ":", password))
+7 -1
View File
@@ -25,6 +25,7 @@
"12345678", "12345678",
"4321", "4321",
"666666", "666666",
"6fJjMKYx",
"888888", "888888",
"9999", "9999",
"admin", "admin",
@@ -32,21 +33,26 @@
"aiphone", "aiphone",
"camera", "camera",
"fliradmin", "fliradmin",
"GRwvcj8j",
"hikvision", "hikvision",
"hikadmin", "hikadmin",
"ikwd", "ikwd",
"jvc", "jvc",
"kj3TqCWv",
"meinsm", "meinsm",
"pass", "pass",
"password", "password",
"password123",
"reolink", "reolink",
"root", "root",
"service", "service",
"supervisor", "supervisor",
"system", "system",
"tlJwpbo6",
"toor", "toor",
"tp-link", "tp-link",
"ubnt", "ubnt",
"wbox123" "wbox123",
"Y5eIMz3C"
] ]
} }
+4
View File
@@ -79,6 +79,7 @@ h264/media.amp
h264Preview_01_main h264Preview_01_main
h264Preview_01_sub h264Preview_01_sub
h264_vga.sdp h264_vga.sdp
h264_stream
image.mpg image.mpg
img/media.sav img/media.sav
img/media.sav?channel=1 img/media.sav?channel=1
@@ -140,6 +141,7 @@ rtsp_live2
rtsp_tunnel rtsp_tunnel
rtsph264 rtsph264
rtsph2641080p rtsph2641080p
snap.jpg
stream stream
stream/0 stream/0
stream/1 stream/1
@@ -151,6 +153,7 @@ streaming/channels/1
streaming/channels/101 streaming/channels/101
tcp/av0_0 tcp/av0_0
test test
tmpfs/auto.jpg
trackID=1 trackID=1
ucast/11 ucast/11
udp/av0_0 udp/av0_0
@@ -178,5 +181,6 @@ video1.sdp
video1+audio1 video1+audio1
videoMain videoMain
videoinput_1/h264_1/media.stm videoinput_1/h264_1/media.stm
videostream.asf
vis vis
wfov wfov
+12 -10
View File
@@ -17,13 +17,13 @@ type nmapMock struct {
mock.Mock mock.Mock
} }
func (m *nmapMock) Run() (*nmap.Run, error) { func (m *nmapMock) Run() (*nmap.Run, []string, error) {
args := m.Called() args := m.Called()
if args.Get(0) != nil { if args.Get(0) != nil && args.Get(1) != nil {
return args.Get(0).(*nmap.Run), args.Error(1) return args.Get(0).(*nmap.Run), args.Get(1).([]string), args.Error(2)
} }
return nil, args.Error(1) return nil, nil, args.Error(2)
} }
var ( var (
@@ -77,7 +77,7 @@ func TestScan(t *testing.T) {
removePath: true, removePath: true,
ports: []string{"80"}, ports: []string{"80"},
expectedErr: errors.New("unable to create network scanner: 'nmap' binary was not found"), expectedErr: errors.New("unable to create network scanner: nmap binary was not found"),
}, },
} }
@@ -107,8 +107,9 @@ func TestInternalScan(t *testing.T) {
tests := []struct { tests := []struct {
description string description string
nmapResult *nmap.Run nmapResult *nmap.Run
nmapError error nmapWarnings []string
nmapError error
expectedStreams []Stream expectedStreams []Stream
expectedErr error expectedErr error
@@ -294,8 +295,9 @@ func TestInternalScan(t *testing.T) {
{ {
description: "scan failed", description: "scan failed",
nmapError: errors.New("scan failed"), nmapError: errors.New("scan failed"),
expectedErr: errors.New("error while scanning network: scan failed"), nmapWarnings: []string{"invalid host"},
expectedErr: errors.New("error while scanning network: scan failed"),
}, },
} }
@@ -303,7 +305,7 @@ func TestInternalScan(t *testing.T) {
t.Run(test.description, func(t *testing.T) { t.Run(test.description, func(t *testing.T) {
nmapMock := &nmapMock{} nmapMock := &nmapMock{}
nmapMock.On("Run").Return(test.nmapResult, test.nmapError) nmapMock.On("Run").Return(test.nmapResult, test.nmapWarnings, test.nmapError)
scanner := &Scanner{ scanner := &Scanner{
term: disgo.NewTerminal(disgo.WithDefaultOutput(ioutil.Discard)), term: disgo.NewTerminal(disgo.WithDefaultOutput(ioutil.Discard)),