@@ -57,19 +57,21 @@ def run_host(ip)
57
57
58
58
@uri = "/login.htm"
59
59
60
+ if is_dlink?
61
+ vprint_good ( "#{ target_url } - DLink device detected" )
62
+ else
63
+ vprint_error ( "#{ target_url } - Dlink device doesn't detected" )
64
+ return
65
+ end
60
66
61
- #doing a first fingerprint
62
- fp = fingerprint ( ip )
63
- return :abort if fp == false
64
-
65
- print_status ( "Attempting to login to #{ target_url } " )
67
+ print_status ( "#{ target_url } - Attempting to login" )
66
68
67
69
each_user_pass { |user , pass |
68
70
do_login ( user , pass )
69
71
}
70
72
end
71
73
72
- def fingerprint ( ip )
74
+ def is_dlink?
73
75
#the tested DIR-615 has no nice Server banner, gconfig.htm gives us interesting
74
76
#input to detect this device. Not sure if this works on other devices! Tested on v8.04.
75
77
begin
@@ -78,13 +80,14 @@ def fingerprint(ip)
78
80
'method' => 'GET' ,
79
81
}
80
82
)
81
- return if response . nil?
82
- return if ( response . code == 404 )
83
+ return false if response . nil?
84
+ return false if ( response . code == 404 )
83
85
84
86
#fingerprinting tested on firmware version 8.04
85
87
if response . body !~ /var\ systemName\= \' DLINK\- DIR615/
86
- vprint_error ( "#{ target_url } - Could not detect a DIR-615 router" )
87
88
return false
89
+ else
90
+ return true
88
91
end
89
92
rescue ::Rex ::ConnectionError
90
93
vprint_error ( "#{ target_url } - Failed to connect to the web server" )
@@ -145,6 +148,7 @@ def do_http_login(user,pass)
145
148
end
146
149
147
150
def determine_result ( response )
151
+ return :abort if response . nil?
148
152
return :abort unless response . kind_of? Rex ::Proto ::Http ::Response
149
153
return :abort unless response . code
150
154
if response . body =~ /\< script\ langauge\= \" javascript\" \> showMainTabs\( \" setup\" \) \; \< \/ script\> /
0 commit comments