Skip to content

Commit 9cbc55c

Browse files
committed
Land rapid7#9593, finger_users regex fix
2 parents bda7fef + d6206dc commit 9cbc55c

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

modules/auxiliary/scanner/finger/finger_users.rb

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def run_host(ip)
3434
finger_zero
3535
finger_dot
3636
finger_chars
37-
vprint_status "#{rhost}:#{rport} - Sending finger request for user list: #{finger_user_common.join(", ")}"
37+
vprint_status "#{rhost}:#{rport} - Sending finger request for #{finger_user_common.count} users"
3838
finger_list
3939

4040
rescue ::Rex::ConnectionError
@@ -168,22 +168,21 @@ def parse_users(buff)
168168

169169
# No such file or directory == valid user bad utmp
170170

171-
# Solaris
172-
if(line =~ /^([a-z0-9\.\_]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)/)
171+
172+
case line
173+
when /^([a-z0-9\.\_]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)/
174+
# Solaris
173175
uid = $1
174176
if ($2 != "Name")
175177
@users[uid] ||= {}
176178
end
177-
end
178179

179-
# IRIX
180-
if(line =~ /^\s*Login name:\s*([^\s]+)\s+/i)
180+
when /^\s*Login name:\s*([^\s]+)\s+/i
181+
# IRIX
181182
uid = $1
182183
@users[uid] ||= {} if uid
183-
end
184-
185-
# Debian GNU/Linux
186-
if(line =~ /^\s*Username:\s*([^\s]+)\s+/i)
184+
when /^\s*(?:Username|Login):\s*([^\s]+)\s+/i
185+
# Debian GNU/Linux
187186
uid = $1
188187
@users[uid] ||= {} if uid
189188
end

0 commit comments

Comments
 (0)