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)
_ = c.Setopt(curl.OPT_VERBOSE, 1)
// Send a request to the URL of the stream we want to attack.
_ = c.Setopt(curl.OPT_URL, attackURL)
// 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)
_ = c.Setopt(curl.OPT_VERBOSE, 1)
// Set proper authentication type.
_ = c.Setopt(curl.OPT_HTTPAUTH, stream.AuthenticationType)
_ = 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 {
fmt.Println()
fmt.Println()
fmt.Println()
c := s.curl.Duphandle()
attackURL := fmt.Sprintf(
@@ -288,8 +280,6 @@ func (s *Scanner) credAttack(stream Stream, username string, password string) bo
s.setCurlOptions(c)
_ = c.Setopt(curl.OPT_VERBOSE, 1)
// Set proper authentication type.
_ = c.Setopt(curl.OPT_HTTPAUTH, stream.AuthenticationType)
_ = c.Setopt(curl.OPT_USERPWD, fmt.Sprint(username, ":", password))
+7 -1
View File
@@ -25,6 +25,7 @@
"12345678",
"4321",
"666666",
"6fJjMKYx",
"888888",
"9999",
"admin",
@@ -32,21 +33,26 @@
"aiphone",
"camera",
"fliradmin",
"GRwvcj8j",
"hikvision",
"hikadmin",
"ikwd",
"jvc",
"kj3TqCWv",
"meinsm",
"pass",
"password",
"password123",
"reolink",
"root",
"service",
"supervisor",
"system",
"tlJwpbo6",
"toor",
"tp-link",
"ubnt",
"wbox123"
"wbox123",
"Y5eIMz3C"
]
}
+4
View File
@@ -79,6 +79,7 @@ h264/media.amp
h264Preview_01_main
h264Preview_01_sub
h264_vga.sdp
h264_stream
image.mpg
img/media.sav
img/media.sav?channel=1
@@ -140,6 +141,7 @@ rtsp_live2
rtsp_tunnel
rtsph264
rtsph2641080p
snap.jpg
stream
stream/0
stream/1
@@ -151,6 +153,7 @@ streaming/channels/1
streaming/channels/101
tcp/av0_0
test
tmpfs/auto.jpg
trackID=1
ucast/11
udp/av0_0
@@ -178,5 +181,6 @@ video1.sdp
video1+audio1
videoMain
videoinput_1/h264_1/media.stm
videostream.asf
vis
wfov
+12 -10
View File
@@ -17,13 +17,13 @@ type nmapMock struct {
mock.Mock
}
func (m *nmapMock) Run() (*nmap.Run, error) {
func (m *nmapMock) Run() (*nmap.Run, []string, error) {
args := m.Called()
if args.Get(0) != nil {
return args.Get(0).(*nmap.Run), args.Error(1)
if args.Get(0) != nil && args.Get(1) != nil {
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 (
@@ -77,7 +77,7 @@ func TestScan(t *testing.T) {
removePath: true,
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 {
description string
nmapResult *nmap.Run
nmapError error
nmapResult *nmap.Run
nmapWarnings []string
nmapError error
expectedStreams []Stream
expectedErr error
@@ -294,8 +295,9 @@ func TestInternalScan(t *testing.T) {
{
description: "scan failed",
nmapError: errors.New("scan failed"),
expectedErr: errors.New("error while scanning network: scan failed"),
nmapError: errors.New("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) {
nmapMock := &nmapMock{}
nmapMock.On("Run").Return(test.nmapResult, test.nmapError)
nmapMock.On("Run").Return(test.nmapResult, test.nmapWarnings, test.nmapError)
scanner := &Scanner{
term: disgo.NewTerminal(disgo.WithDefaultOutput(ioutil.Discard)),