Skip to content

Commit f13d012

Browse files
authored
Merge pull request rapid7#7639 from wchen-r7/fix_7628
Fix rapid7#7628, concrete5_member_list HTML parser
2 parents b6bb199 + 56505d2 commit f13d012

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

modules/auxiliary/scanner/http/concrete5_member_list.rb

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,25 @@ def run_host(rhost)
6666
end
6767

6868
def extract_members(res, url)
69-
members = res.body.scan(/<div class="ccm\-profile\-member\-username">(.*?)<\/div>/i)
69+
members = res.get_html_document.search('div[@class="ccm-profile-member-username"]')
7070

71-
if members
71+
unless members.empty?
7272
print_good("#{peer} Extracted #{members.length} entries")
7373

7474
# separate user data into userID, username and Profile URL
7575
memberlist = []
7676
users = []
7777

7878
members.each do | mem |
79-
userid = mem[0].scan(/\/view\/(\d+)/i)
80-
username = mem[0].scan(/">(.+)<\/a>/i)
81-
profile = mem[0].scan(/href="(.+)">/i)
79+
userid = mem.text.scan(/\/view\/(\d+)/i).flatten.first
80+
anchor = mem.at('a')
81+
username = anchor.text
82+
profile = anchor.attributes['href'].value
8283
# add all data to memberlist for table output
83-
memberlist.push([userid[0], username[0], profile[0]])
84+
85+
memberlist.push([userid, username, profile])
8486
# add usernames to users array for reporting
85-
users.push(username[0])
87+
users.push(username)
8688
end
8789

8890
membertbl = Msf::Ui::Console::Table.new(
@@ -99,7 +101,7 @@ def extract_members(res, url)
99101
]})
100102

101103
memberlist.each do | mem |
102-
membertbl << ["#{mem[0].join}", "#{mem[1].join}", "#{mem[2].join}"]
104+
membertbl << [mem[0], mem[1], mem[2]]
103105
end
104106

105107
# print table

0 commit comments

Comments
 (0)