Skip to content

Commit 64f3e68

Browse files
author
m-1-k-3
committed
is_dlink and some more feedback included
1 parent 2b4d6eb commit 64f3e68

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

modules/auxiliary/scanner/http/dlink_dir_300b_600b_815_http_login.rb

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,31 @@ def target_url
5454
"#{proto}://#{rhost}:#{rport}#{@uri.to_s}"
5555
end
5656

57+
def is_dlink?
58+
response = send_request_cgi({
59+
'uri' => @uri,
60+
'method' => 'GET'
61+
})
62+
63+
if response and response.headers['Server'] and response.headers['Server'] =~ /Linux,\ HTTP\/1.1,\ DIR-.*Ver\ .*/
64+
return true
65+
else
66+
return false
67+
end
68+
end
69+
5770
def run_host(ip)
5871

5972
@uri = "/session.cgi"
6073

61-
print_status("Attempting to login to #{target_url}")
74+
if is_dlink?
75+
vprint_good("#{target_url} - DLink device detected")
76+
else
77+
vprint_error("#{target_url} - Dlink device doesn't detected")
78+
return
79+
end
80+
81+
print_status("#{target_url} - Attempting to login")
6282

6383
each_user_pass { |user, pass|
6484
do_login(user, pass)
@@ -106,7 +126,6 @@ def do_http_login(user,pass)
106126
}
107127
})
108128
return if response.nil?
109-
return if (response.headers['Server'].nil? or response.headers['Server'] !~ /Linux,\ HTTP\/1.1,\ DIR-.*Ver\ .*/)
110129
return if (response.code == 404)
111130

112131
return response
@@ -117,6 +136,7 @@ def do_http_login(user,pass)
117136
end
118137

119138
def determine_result(response)
139+
return :abort if response.nil?
120140
return :abort unless response.kind_of? Rex::Proto::Http::Response
121141
return :abort unless response.code
122142
if response.body =~ /\<RESULT\>SUCCESS\<\/RESULT\>/

0 commit comments

Comments
 (0)