Skip to content

Commit 4742dba

Browse files
committed
Fix YARD documentation
1 parent 9ef09a7 commit 4742dba

File tree

3 files changed

+50
-28
lines changed

3 files changed

+50
-28
lines changed

lib/msf/http/jboss/base.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# -*- coding: binary -*-
2+
23
module Msf::HTTP::JBoss::Base
3-
# Call the specified uri to deploy the payload / stager
4-
# @param opts [Hash] Hash of configuration options.
4+
5+
# Deploys a WAR through HTTP uri invoke
6+
#
7+
# @param opts [Hash] Hash containing {Exploit::Remote::HttpClient#send_request_cgi} options
58
# @param num_attempts [Integer] The number of attempts
6-
# @return [ClientRequest] or nil
9+
# @return [Rex::Proto::Http::Response, nil] The {Rex::Proto::Http::Response} response if exists, nil otherwise
710
def deploy(opts = {}, num_attempts = 5)
811
uri = opts['uri']
912

@@ -36,6 +39,9 @@ def deploy(opts = {}, num_attempts = 5)
3639
end
3740
end
3841

42+
# Provides the HTTP verb used
43+
#
44+
# @return [String] The HTTP verb in use
3945
def http_verb
4046
datastore['VERB']
4147
end

lib/msf/http/jboss/bean_shell.rb

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# -*- coding: binary -*-
2+
23
module Msf::HTTP::JBoss::BeanShell
34

45
DEFAULT_PACKAGES = %w{ deployer scripts }
56

6-
# Try to deploy a BSH script using different packages
7-
# @param [String] A BSH script
8-
# @return [String] the package used to deploy the script or nil if it fails
7+
# Deploys a Bean Shell script with a set of JBOSS default packages
8+
#
9+
# @param bsh_script [String] The Bean Shell script to deploy
10+
# @return [String, nil] The package name used to deploy the script, nil otherwise
911
def deploy_bsh(bsh_script)
1012
package = nil
1113

@@ -24,10 +26,11 @@ def deploy_bsh(bsh_script)
2426
package
2527
end
2628

27-
# Try to deploy a BSH script using the specified package
28-
# @param [String] A BSH script
29-
# @param [String] The package used to deploy the script
30-
# @return [Boolean] Wether the script get deployed or not
29+
# Deploys a Bean Shell script using the specified package
30+
#
31+
# @param bsh_script [String] The Bean Shell script to deploy
32+
# @param package [String] The package used to deploy the script
33+
# @return [Boolean] `true` if the script gets deployed, `false` otherwise
3134
def deploy_package(bsh_script, package)
3235
success = false
3336

@@ -50,18 +53,19 @@ def deploy_package(bsh_script, package)
5053
success
5154
end
5255

53-
# Invokes bsh_script on the JBoss AS via BSHDeployer
54-
# @param [String] A BSH script
55-
# @param [String] The package used to deploy the script
56-
# @return [ClientRequest]
56+
# Invokes a Bean Shell script on the JBoss via BSHDeployer
57+
#
58+
# @param bsh_script [String] A Bean Shell script
59+
# @param package [String] The package used to deploy the script
60+
# @return [Rex::Proto::Http::Response, nil] The {Rex::Proto::Http::Response} response, nil if timeout
5761
def invoke_bsh_script(bsh_script, package)
5862
params = { }
5963
params.compare_by_identity
6064
params['action'] = 'invokeOpByName'
6165
params['name'] = "jboss.#{package}:service=BSHDeployer"
6266
params['methodName'] = 'createScriptDeployment'
6367
params['argType'] = 'java.lang.String'
64-
params['arg0'] = bsh_script #Rex::Text.uri_encode(bsh_script)
68+
params['arg0'] = bsh_script
6569
params['argType'] = 'java.lang.String'
6670
params['arg1'] = Rex::Text.rand_text_alphanumeric(8+rand(8)) + '.bsh'
6771

lib/msf/http/jboss/bean_shell_scripts.rb

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# -*- coding: binary -*-
2+
23
module Msf::HTTP::JBoss::BeanShellScripts
34

4-
# Generate a BSH script
5+
# Generates a Bean Shell Script.
6+
#
7+
# @param type [Symbol] The Bean Shell script type, `:create` or `:delete`.
58
# @param opts [Hash] Hash of configuration options.
6-
# @return [String] A BSH script
9+
# @return [String] A Bean Shell script.
710
def generate_bsh(type, opts ={})
811
bean_shell = nil
912
case type
@@ -16,10 +19,11 @@ def generate_bsh(type, opts ={})
1619
bean_shell
1720
end
1821

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.
2327
def stager_jsp(app_base)
2428
decoded_var = Rex::Text.rand_text_alpha(8+rand(8))
2529
file_path_var = Rex::Text.rand_text_alpha(8+rand(8))
@@ -51,9 +55,15 @@ def stager_jsp(app_base)
5155
stager_jsp
5256
end
5357

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.
5767
def create_file_bsh(opts = {})
5868
dir = opts[:dir]
5969
file = opts[:file]
@@ -75,13 +85,15 @@ def create_file_bsh(opts = {})
7585
fstream.close();
7686
EOT
7787

78-
vprint_status("Creating deploy/#{file} via BSHDeployer")
7988
payload_bsh_script
8089
end
8190

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.
8597
def delete_files_bsh(opts = {})
8698
script = "String jboss_home = System.getProperty(\"jboss.server.home.dir\");\n"
8799
opts.values.each do |v|

0 commit comments

Comments
 (0)