Skip to content

Commit 2f96a67

Browse files
author
m-1-k-3
committed
is_dlink, more feedback included
1 parent 8032a33 commit 2f96a67

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

modules/auxiliary/scanner/http/dlink_dir_615h_http_login.rb

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,21 @@ def run_host(ip)
5757

5858
@uri = "/login.htm"
5959

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
6066

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")
6668

6769
each_user_pass { |user, pass|
6870
do_login(user, pass)
6971
}
7072
end
7173

72-
def fingerprint(ip)
74+
def is_dlink?
7375
#the tested DIR-615 has no nice Server banner, gconfig.htm gives us interesting
7476
#input to detect this device. Not sure if this works on other devices! Tested on v8.04.
7577
begin
@@ -78,13 +80,14 @@ def fingerprint(ip)
7880
'method' => 'GET',
7981
}
8082
)
81-
return if response.nil?
82-
return if (response.code == 404)
83+
return false if response.nil?
84+
return false if (response.code == 404)
8385

8486
#fingerprinting tested on firmware version 8.04
8587
if response.body !~ /var\ systemName\=\'DLINK\-DIR615/
86-
vprint_error("#{target_url} - Could not detect a DIR-615 router")
8788
return false
89+
else
90+
return true
8891
end
8992
rescue ::Rex::ConnectionError
9093
vprint_error("#{target_url} - Failed to connect to the web server")
@@ -145,6 +148,7 @@ def do_http_login(user,pass)
145148
end
146149

147150
def determine_result(response)
151+
return :abort if response.nil?
148152
return :abort unless response.kind_of? Rex::Proto::Http::Response
149153
return :abort unless response.code
150154
if response.body =~ /\<script\ langauge\=\"javascript\"\>showMainTabs\(\"setup\"\)\;\<\/script\>/

0 commit comments

Comments
 (0)