@@ -30,7 +30,7 @@ def report_creds(user, pass, port)
30
30
private_type : :password ,
31
31
session_id : session_db_id ,
32
32
username : user ,
33
- workspace_id : myworkspace_id ,
33
+ workspace_id : myworkspace_id
34
34
}
35
35
36
36
credential_core = create_credential ( credential_data )
@@ -56,9 +56,10 @@ def getpw(file, ports)
56
56
i = 0
57
57
file . each do |pwfile |
58
58
begin
59
+ print_status ( "Getting passwords from: #{ pwfile } " )
59
60
lines = read_file ( pwfile ) . split ( "\n " )
60
61
rescue
61
- print_error ( "Cannot open #{ pwfile } , you probably don't have permissions to open the file." )
62
+ print_error ( "Cannot open #{ pwfile } , you probably do not have permissions to open the file." )
62
63
next
63
64
end
64
65
for line in lines
@@ -82,7 +83,7 @@ def getversion(array)
82
83
begin
83
84
file = read_file ( array [ i ] )
84
85
rescue
85
- print_error ( "Cannot open #{ array [ i ] } , you probably don't have permissions to open the file." )
86
+ print_error ( "Cannot open #{ array [ i ] } , you probably do not have permissions to open the file." )
86
87
next
87
88
end
88
89
xml_doc = Nokogiri ::XML ( file )
@@ -161,36 +162,40 @@ def getports(version)
161
162
begin
162
163
file1_read = read_file ( file1 ) . split ( "\n " )
163
164
rescue
164
- print_error ( "Cannot open #{ file1 } , you probably don't have permissions to open the file." )
165
+ print_error ( "Cannot open #{ file1 } , you probably do not have permissions to open the file." )
165
166
next
166
167
end
167
168
parse = false
168
169
portfound = false
169
170
file1_read . each do |line |
170
- if line . strip . include? 'deploy/httpha-invoker.sar'
171
- parse = true
172
- elsif ( line . strip == '</bean>' and portfound )
173
- parse = false
174
- elsif parse and line . include? '<property name="port">'
175
- port . push ( line . split ( '<property name="port">' ) [ 1 ] . split ( '<' ) [ 0 ] . to_i )
176
- portfound = true
171
+ if line . strip . include? 'deploy/httpha-invoker.sar'
172
+ parse = true
173
+ elsif ( line . strip == '</bean>' and portfound )
174
+ parse = false
175
+ elsif parse and line . include? '<property name="port">'
176
+ portnr = line . split ( '<property name="port">' ) [ 1 ] . split ( '<' ) [ 0 ] . to_i
177
+ port . push ( portnr )
178
+ portfound = true
179
+ print_good ( "Jboss port found: #{ portnr } " )
180
+ end
177
181
end
178
182
end
179
183
end
180
- end
181
184
182
185
type2 . each do |file2 |
183
186
if file2 and file2 . include? version
184
187
print_status ( "Attempting to extract Jboss service ports from: #{ file2 } " )
185
188
begin
186
189
xml2 = Nokogiri ::XML ( read_file ( file2 ) )
187
190
rescue
188
- print_error ( "Cannot open #{ file2 } , you probably don't have permissions to open the file." )
191
+ print_error ( "Cannot open #{ file2 } , you probably do not have permissions to open the file." )
189
192
next
190
193
end
191
194
xml2 . xpath ( "//Server//Connector" ) . each do |connector |
192
195
if connector [ 'protocol' ] . include? "HTTP"
193
- port . push ( connector [ 'port' ] . to_i )
196
+ portnr = connector [ 'port' ] . to_i
197
+ port . push ( portnr )
198
+ print_good ( "Jboss port found: #{ portnr } " )
194
199
break
195
200
end
196
201
end
@@ -225,16 +230,16 @@ def wingetinstances(home, version)
225
230
instances = [ ]
226
231
instance_location = "#{ home } \\ server"
227
232
exec = cmd_exec ( "cmd /c dir #{ instance_location } " ) . split ( "\n " )
228
- exec . each do |instance |
229
- if instance . split ( "<DIR>" ) [ 1 ]
230
- if ( not instance . split ( "<DIR>" ) [ 1 ] . strip . include? "." ) and ( not instance . split ( "<DIR>" ) [ 1 ] . strip . include? ".." )
231
- instance_path = "#{ home } \\ server\\ #{ ( instance . split ( '<DIR>' ) [ 1 ] . strip ) } "
232
- if instance_path . include? version
233
- instances . push ( instance_path )
234
- end
233
+ exec . each do |instance |
234
+ if instance . split ( "<DIR>" ) [ 1 ]
235
+ if ( not instance . split ( "<DIR>" ) [ 1 ] . strip . include? "." ) and ( not instance . split ( "<DIR>" ) [ 1 ] . strip . include? ".." )
236
+ instance_path = "#{ home } \\ server\\ #{ ( instance . split ( '<DIR>' ) [ 1 ] . strip ) } "
237
+ if instance_path . include? version
238
+ instances . push ( instance_path )
235
239
end
236
240
end
237
241
end
242
+ end
238
243
return instances
239
244
end
240
245
@@ -273,25 +278,28 @@ def wingetport(instances)
273
278
elsif ( line . strip == '</bean>' and portfound )
274
279
parse = false
275
280
elsif parse and line . include? '<property name="port">'
276
- port . push ( line . split ( '<property name="port">' ) [ 1 ] . split ( '<' ) [ 0 ] . to_i )
281
+ portnr = line . split ( '<property name="port">' ) [ 1 ] . split ( '<' ) [ 0 ] . to_i
282
+ port . push ( portnr )
277
283
portfound = true
284
+ print_good ( "Jboss port found: #{ portnr } " )
278
285
end
279
286
end
280
287
end
281
288
282
289
if file2
283
290
print_status ( "Attempting to extract Jboss service ports from: #{ seed } \\ deploy\\ jboss-web.deployer\\ server.xml" )
284
- xml2 = Nokogiri ::XML ( file2 )
291
+ xml2 = Nokogiri ::XML ( file2 )
285
292
xml2 . xpath ( "//Server//Connector" ) . each do |connector |
286
293
if connector [ 'protocol' ] . include? "HTTP"
287
- print_status ( connector [ 'port' ] )
288
- port . push ( connector [ 'port' ] . to_i )
294
+ portnr = connector [ 'port' ] . to_i
295
+ port . push ( portnr )
296
+ print_good ( "Jboss port found: #{ portnr } " )
289
297
break
290
298
end
291
299
end
292
300
end
293
301
end
294
- return port
302
+ return port
295
303
end
296
304
297
305
def gatherwin
0 commit comments