1
1
# -*- coding: binary -*-
2
+
2
3
module Msf ::HTTP ::JBoss ::BeanShellScripts
3
4
4
- # Generate a BSH script
5
+ # Generates a Bean Shell Script.
6
+ #
7
+ # @param type [Symbol] The Bean Shell script type, `:create` or `:delete`.
5
8
# @param opts [Hash] Hash of configuration options.
6
- # @return [String] A BSH script
9
+ # @return [String] A Bean Shell script.
7
10
def generate_bsh ( type , opts = { } )
8
11
bean_shell = nil
9
12
case type
@@ -16,10 +19,11 @@ def generate_bsh(type, opts ={})
16
19
bean_shell
17
20
end
18
21
19
- # Generate a stager to write the exploded WAR file to the deploy/
20
- # directory. This is used to bypass the size limit for GET/HEAD requests
21
- # @param [String] The name of the app to deploy
22
- # @return [String] The jsp stager
22
+ # Generate a stager JSP to write a WAR file to the deploy/ directory.
23
+ # This is used to bypass the size limit for GET/HEAD requests.
24
+ #
25
+ # @param app_base [String] The name of the WAR app to write.
26
+ # @return [String] The JSP stager.
23
27
def stager_jsp ( app_base )
24
28
decoded_var = Rex ::Text . rand_text_alpha ( 8 +rand ( 8 ) )
25
29
file_path_var = Rex ::Text . rand_text_alpha ( 8 +rand ( 8 ) )
@@ -51,9 +55,15 @@ def stager_jsp(app_base)
51
55
stager_jsp
52
56
end
53
57
54
- # Generate a BSH script to deploy the WAR
55
- # @param opts [Hash] Hash of configuration options.
56
- # @return [String] A BSH script to deploy the WAR
58
+ # Generate a Bean Shell script which creates files inside the JBOSS's deploy
59
+ # directory.
60
+ #
61
+ # @param opts [Hash] Hash containing the options to create the Bean Shell
62
+ # Script.
63
+ # @option opts :dir [Symbol] The dir where place the file.
64
+ # @option opts :file [Symbol] The file path.
65
+ # @option opts :contents [Symbol] The file contents.
66
+ # @return [String] A Bean Shell script to create the file.
57
67
def create_file_bsh ( opts = { } )
58
68
dir = opts [ :dir ]
59
69
file = opts [ :file ]
@@ -75,13 +85,15 @@ def create_file_bsh(opts = {})
75
85
fstream.close();
76
86
EOT
77
87
78
- vprint_status ( "Creating deploy/#{ file } via BSHDeployer" )
79
88
payload_bsh_script
80
89
end
81
90
82
- # Generate a BSH script to delete an application
83
- # @param opts [Hash] Hash of configuration options.
84
- # @return [String] A BSH script to delete an application
91
+ # Generate a Bean Shell script to delete files from the JBoss's /deploy
92
+ # directory.
93
+ #
94
+ # @param opts [Hash] Hash containing the files to delete, the values are
95
+ # the files paths.
96
+ # @return [String] A Bean Shell script to delete files.
85
97
def delete_files_bsh ( opts = { } )
86
98
script = "String jboss_home = System.getProperty(\" jboss.server.home.dir\" );\n "
87
99
opts . values . each do |v |
0 commit comments