ronin-payloads 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +15 -1
- data/.rubocop.yml +37 -0
- data/ChangeLog.md +13 -1
- data/Gemfile +5 -2
- data/Rakefile +3 -1
- data/bin/ronin-payloads +6 -7
- data/examples/bin_sh.rb +4 -0
- data/lib/ronin/payloads/asm_payload.rb +1 -1
- data/lib/ronin/payloads/builtin/php/cmd_exec.rb +4 -3
- data/lib/ronin/payloads/builtin/shellcode/freebsd/x86/bind_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/shellcode/freebsd/x86/exec_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/shellcode/freebsd/x86/reverse_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/shellcode/freebsd/x86_64/exec_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/shellcode/linux/arm/bind_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/shellcode/linux/arm/exec_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/shellcode/linux/arm/reverse_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/shellcode/linux/mips/bind_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/shellcode/linux/mips/exec_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/shellcode/linux/mips/reverse_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/shellcode/linux/ppc/exec_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/shellcode/linux/ppc/reverse_shell.rb +2 -2
- data/lib/ronin/payloads/builtin/shellcode/linux/x86/bind_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/shellcode/linux/x86/exec_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/shellcode/linux/x86/reverse_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/shellcode/linux/x86_64/bind_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/shellcode/linux/x86_64/exec_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/shellcode/linux/x86_64/reverse_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/shellcode/macos/x86_64/exec_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/shellcode/macos/x86_64/reverse_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/shellcode/netbsd/x86/exec_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/shellcode/netbsd/x86/reverse_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/shellcode/openbsd/x86/bind_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/shellcode/openbsd/x86/exec_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/shellcode/windows/x86_64/cmd.rb +2 -2
- data/lib/ronin/payloads/builtin/test/open_redirect.rb +3 -3
- data/lib/ronin/payloads/builtin/test/xss.rb +3 -3
- data/lib/ronin/payloads/c_payload.rb +1 -1
- data/lib/ronin/payloads/cli/commands/build.rb +10 -12
- data/lib/ronin/payloads/cli/commands/encode.rb +16 -20
- data/lib/ronin/payloads/cli/commands/launch.rb +2 -2
- data/lib/ronin/payloads/cli/commands/new.rb +1 -1
- data/lib/ronin/payloads/cli/commands/show.rb +1 -0
- data/lib/ronin/payloads/cli/encoder_methods.rb +1 -0
- data/lib/ronin/payloads/cli/generator/payload_types.rb +1 -0
- data/lib/ronin/payloads/encoders/builtin/html/encode.rb +1 -0
- data/lib/ronin/payloads/encoders/builtin/js/encode.rb +1 -0
- data/lib/ronin/payloads/encoders/builtin/powershell/encode.rb +1 -0
- data/lib/ronin/payloads/encoders/builtin/shell/encode.rb +1 -0
- data/lib/ronin/payloads/encoders/builtin/sql/encode.rb +1 -0
- data/lib/ronin/payloads/encoders/builtin/xml/encode.rb +1 -0
- data/lib/ronin/payloads/encoders/encoder.rb +2 -1
- data/lib/ronin/payloads/encoders/exceptions.rb +1 -0
- data/lib/ronin/payloads/encoders/html_encoder.rb +1 -0
- data/lib/ronin/payloads/encoders/javascript_encoder.rb +1 -0
- data/lib/ronin/payloads/encoders/pipeline.rb +1 -0
- data/lib/ronin/payloads/encoders/powershell_encoder.rb +1 -0
- data/lib/ronin/payloads/encoders/registry.rb +4 -0
- data/lib/ronin/payloads/encoders/shell_encoder.rb +1 -0
- data/lib/ronin/payloads/encoders/sql_encoder.rb +1 -0
- data/lib/ronin/payloads/encoders/xml_encoder.rb +1 -0
- data/lib/ronin/payloads/exceptions.rb +1 -0
- data/lib/ronin/payloads/go_payload.rb +1 -1
- data/lib/ronin/payloads/java_payload.rb +1 -1
- data/lib/ronin/payloads/metadata/arch.rb +1 -0
- data/lib/ronin/payloads/metadata/os.rb +1 -0
- data/lib/ronin/payloads/mixins/bind_shell.rb +2 -2
- data/lib/ronin/payloads/mixins/post_ex.rb +0 -1
- data/lib/ronin/payloads/mixins/reverse_shell.rb +0 -1
- data/lib/ronin/payloads/mixins/typescript.rb +1 -2
- data/lib/ronin/payloads/payload.rb +7 -7
- data/lib/ronin/payloads/registry.rb +3 -0
- data/lib/ronin/payloads/rust_payload.rb +1 -1
- data/lib/ronin/payloads/shellcode_payload.rb +8 -8
- data/lib/ronin/payloads/url_payload.rb +1 -1
- data/lib/ronin/payloads/version.rb +1 -1
- data/lib/ronin/payloads.rb +1 -0
- data/man/ronin-payloads-build.1 +1 -1
- data/man/ronin-payloads-build.1.md +1 -1
- data/man/ronin-payloads-encode.1 +1 -1
- data/man/ronin-payloads-encode.1.md +1 -1
- data/man/ronin-payloads-encoder.1 +1 -1
- data/man/ronin-payloads-encoder.1.md +1 -1
- data/man/ronin-payloads-encoders.1 +1 -1
- data/man/ronin-payloads-encoders.1.md +1 -1
- data/man/ronin-payloads-irb.1 +1 -1
- data/man/ronin-payloads-irb.1.md +1 -1
- data/man/ronin-payloads-launch.1 +1 -1
- data/man/ronin-payloads-launch.1.md +1 -1
- data/man/ronin-payloads-list.1 +1 -1
- data/man/ronin-payloads-list.1.md +1 -1
- data/man/ronin-payloads.1 +1 -1
- data/man/ronin-payloads.1.md +1 -1
- data/ronin-payloads.gemspec +3 -4
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fddb2f659bbde5b22104a0199430583326dd28ff4183121da3e25e88a94fe8a
|
4
|
+
data.tar.gz: 5e2f20bca62fcd8d43f4bc82eb33c1098cac1e20269d49b847e793dcd186a978
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d75e548fc4782f995dbba42e62f4a1a485d3fc2fbdf005c479fe6beda75b2006d9f8132fe98125586d5b4877604c251ad1fe284ea13dccb04476b4edecfc4e4
|
7
|
+
data.tar.gz: 36384af31fb5ba8e407c1b7ebe5777974b966a005c42ebe57a499fea46e450b82987ce3e117c07def7c515fe7f099caa1e760db1ca06ca077ccd2590a3cef8df
|
data/.github/workflows/ruby.yml
CHANGED
@@ -12,7 +12,7 @@ jobs:
|
|
12
12
|
- '3.0'
|
13
13
|
- '3.1'
|
14
14
|
- '3.2'
|
15
|
-
|
15
|
+
- jruby
|
16
16
|
- truffleruby
|
17
17
|
name: Ruby ${{ matrix.ruby }}
|
18
18
|
steps:
|
@@ -30,3 +30,17 @@ jobs:
|
|
30
30
|
run: bundle install --jobs 4 --retry 3
|
31
31
|
- name: Run tests
|
32
32
|
run: bundle exec rake test
|
33
|
+
|
34
|
+
# rubocop linting
|
35
|
+
rubocop:
|
36
|
+
runs-on: ubuntu-latest
|
37
|
+
steps:
|
38
|
+
- uses: actions/checkout@v2
|
39
|
+
- name: Set up Ruby
|
40
|
+
uses: ruby/setup-ruby@v1
|
41
|
+
with:
|
42
|
+
ruby-version: 3.0
|
43
|
+
- name: Install dependencies
|
44
|
+
run: bundle install --jobs 4 --retry 3
|
45
|
+
- name: Run rubocop
|
46
|
+
run: bundle exec rubocop --parallel
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
AllCops:
|
2
|
+
NewCops: enable
|
3
|
+
SuggestExtensions: false
|
4
|
+
TargetRubyVersion: 3.1
|
5
|
+
|
6
|
+
inherit_gem:
|
7
|
+
rubocop-ronin: rubocop.yml
|
8
|
+
|
9
|
+
#
|
10
|
+
# ronin-payload specific exceptions:
|
11
|
+
#
|
12
|
+
Layout/ArgumentAlignment: { Exclude: ['spec/rust_payload_spec.rb'] }
|
13
|
+
|
14
|
+
# the placeholder API methods are meant to be empty
|
15
|
+
Style/EmptyMethod:
|
16
|
+
Exclude:
|
17
|
+
- 'lib/ronin/payloads/payload.rb'
|
18
|
+
- 'spec/**/*'
|
19
|
+
|
20
|
+
# rubocop does not support constants that contain multiple numbers
|
21
|
+
Naming/ClassAndModuleCamelCase:
|
22
|
+
AllowedNames:
|
23
|
+
- X86_64
|
24
|
+
|
25
|
+
# robucop mistakes :x86_64 for a "symbol number"
|
26
|
+
Naming/VariableNumber:
|
27
|
+
AllowedIdentifiers:
|
28
|
+
- x86_64
|
29
|
+
|
30
|
+
# this is a bug in rubocop
|
31
|
+
Style/FormatStringToken:
|
32
|
+
Exclude:
|
33
|
+
- 'lib/ronin/payloads/builtin/cmd/powershell/reverse_shell.rb'
|
34
|
+
- 'spec/builtin/cmd/powershell/reverse_shell_spec.rb'
|
35
|
+
|
36
|
+
# rubocop does not recognize empty-line continuations
|
37
|
+
Layout/LineContinuationSpacing: { Exclude: ['lib/ronin/payloads/builtin/shellcode/**/*.rb'] }
|
data/ChangeLog.md
CHANGED
@@ -1,4 +1,16 @@
|
|
1
|
-
### 0.1.
|
1
|
+
### 0.1.1 / 2023-03-01
|
2
|
+
|
3
|
+
* Default the `host` param defined by {Ronin::Payloads::Mixins::BindShell} to
|
4
|
+
`0.0.0.0`.
|
5
|
+
|
6
|
+
#### CLI
|
7
|
+
|
8
|
+
* Fixed multiple bugs in the `--param` option of the `ronin-payloads encode`
|
9
|
+
comand.
|
10
|
+
* Fixed multiple bugs in the `--encoder-param` option of
|
11
|
+
the `ronin-payloads build` command.
|
12
|
+
|
13
|
+
### 0.1.0 / 2023-02-01
|
2
14
|
|
3
15
|
* Initial release:
|
4
16
|
* Require `ruby` >= 3.0.0.
|
data/Gemfile
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
source 'https://rubygems.org'
|
2
3
|
|
3
4
|
gemspec
|
@@ -41,6 +42,8 @@ group :development do
|
|
41
42
|
gem 'yard-spellcheck', require: false
|
42
43
|
|
43
44
|
gem 'dead_end', require: false
|
44
|
-
gem 'sord', require: false
|
45
|
-
gem 'stackprof', require: false
|
45
|
+
gem 'sord', require: false, platform: :mri
|
46
|
+
gem 'stackprof', require: false, platform: :mri
|
47
|
+
gem 'rubocop', require: false, platform: :mri
|
48
|
+
gem 'rubocop-ronin', require: false, platform: :mri
|
46
49
|
end
|
data/Rakefile
CHANGED
data/bin/ronin-payloads
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
#
|
3
4
|
# ronin-payloads - A Ruby micro-framework for writing and running exploit
|
4
5
|
# payloads.
|
@@ -22,13 +23,11 @@
|
|
22
23
|
root = File.expand_path(File.join(File.dirname(__FILE__),'..'))
|
23
24
|
if File.file?(File.join(root,'Gemfile.lock'))
|
24
25
|
Dir.chdir(root) do
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
exit -1
|
31
|
-
end
|
26
|
+
require 'bundler/setup'
|
27
|
+
rescue LoadError => e
|
28
|
+
warn e.message
|
29
|
+
warn "Run `gem install bundler` to install Bundler"
|
30
|
+
exit(-1)
|
32
31
|
end
|
33
32
|
end
|
34
33
|
|
data/examples/bin_sh.rb
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
#!/usr/bin/env -S ronin-payloads build -f
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require 'ronin/payloads/shellcode_payload'
|
4
5
|
|
5
6
|
module Ronin
|
6
7
|
module Payloads
|
8
|
+
#
|
9
|
+
# An example `execve()` `/bin/sh` shellcode payload.
|
10
|
+
#
|
7
11
|
class BinSh < ShellcodePayload
|
8
12
|
|
9
13
|
register 'examples/bin_sh'
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# ronin-payloads - A Ruby micro-framework for writing and running exploit
|
3
4
|
# payloads.
|
@@ -32,9 +33,9 @@ module Ronin
|
|
32
33
|
|
33
34
|
summary 'PHP command exec payload'
|
34
35
|
description <<~DESC
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
A basic injectable PHP payload which executes a command passed in via a
|
37
|
+
URL query parameter. The output of the commend will be returned in the
|
38
|
+
response body wrapped in `<exec>...</exec>` tags.
|
38
39
|
DESC
|
39
40
|
|
40
41
|
param :query_param, String, default: 'cmd',
|
@@ -40,9 +40,9 @@ module Ronin
|
|
40
40
|
|
41
41
|
summary 'Linux PPC reverse shell shellcode'
|
42
42
|
description <<~DESC
|
43
|
-
|
43
|
+
Linux PPC shellcode that spawns a connect back reverse shell.
|
44
44
|
|
45
|
-
|
45
|
+
Note: disabling with_stderr will save 16 bytes, but lose stderr.
|
46
46
|
DESC
|
47
47
|
|
48
48
|
references [
|
@@ -37,11 +37,11 @@ module Ronin
|
|
37
37
|
os :windows
|
38
38
|
os_version '7'
|
39
39
|
|
40
|
-
author "agix"
|
40
|
+
author "agix"
|
41
41
|
|
42
42
|
summary 'Windows x86-64 cmd shellcode'
|
43
43
|
description <<~DESC
|
44
|
-
|
44
|
+
Windows x86-64 shellcode that executes "cmd"
|
45
45
|
DESC
|
46
46
|
|
47
47
|
references [
|
@@ -33,10 +33,10 @@ module Ronin
|
|
33
33
|
|
34
34
|
summary 'An Open Redirect test payload'
|
35
35
|
description <<~DESC
|
36
|
-
|
37
|
-
|
36
|
+
A non-malicious test payload for testing Open Redirect vulnerabilities.
|
37
|
+
Simply redirects to https://google.com/.
|
38
38
|
DESC
|
39
|
-
|
39
|
+
|
40
40
|
#
|
41
41
|
# Builds the Open Redirect test payload.
|
42
42
|
#
|
@@ -33,10 +33,10 @@ module Ronin
|
|
33
33
|
|
34
34
|
summary 'A XSS test payload'
|
35
35
|
description <<~DESC
|
36
|
-
|
37
|
-
|
36
|
+
A non-malicious test payload for testing Cross Site Scripting (XSS).
|
37
|
+
Simply calls `alert(1)`.
|
38
38
|
DESC
|
39
|
-
|
39
|
+
|
40
40
|
#
|
41
41
|
# Builds the XSS test payload.
|
42
42
|
#
|
@@ -80,9 +80,9 @@ module Ronin
|
|
80
80
|
},
|
81
81
|
desc: 'Sets a param for one of the encoders' do |str|
|
82
82
|
name, value = str.split('=',2)
|
83
|
-
|
83
|
+
encoder_name, param_name = name.split('.',2)
|
84
84
|
|
85
|
-
@encoder_params[encoder_name][param_name] = value
|
85
|
+
@encoder_params[encoder_name][param_name.to_sym] = value
|
86
86
|
end
|
87
87
|
|
88
88
|
option :debug, short: '-D',
|
@@ -162,16 +162,14 @@ module Ronin
|
|
162
162
|
# Builds the {#payload}.
|
163
163
|
#
|
164
164
|
def build_payload
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
exit(-1)
|
174
|
-
end
|
165
|
+
@payload.perform_build
|
166
|
+
rescue PayloadError => error
|
167
|
+
print_error "failed to build the payload #{@payload_class.id}: #{error.message}"
|
168
|
+
exit(-1)
|
169
|
+
rescue => error
|
170
|
+
print_exception(error)
|
171
|
+
print_error "an unhandled exception occurred while building the payload #{@payload.class_id}"
|
172
|
+
exit(-1)
|
175
173
|
end
|
176
174
|
|
177
175
|
#
|
@@ -71,15 +71,15 @@ module Ronin
|
|
71
71
|
},
|
72
72
|
desc: 'Sets a param on an encoder' do |str|
|
73
73
|
prefix, value = str.split('=',2)
|
74
|
-
|
74
|
+
encoder, name = prefix.split('.',2)
|
75
75
|
|
76
|
-
@params[encoder][name] = value
|
76
|
+
@params[encoder][name.to_sym] = value
|
77
77
|
end
|
78
78
|
|
79
79
|
option :string, short: '-s',
|
80
80
|
value: {
|
81
81
|
type: String,
|
82
|
-
usage: 'STRING'
|
82
|
+
usage: 'STRING'
|
83
83
|
},
|
84
84
|
desc: 'The string to encode'
|
85
85
|
|
@@ -157,16 +157,14 @@ module Ronin
|
|
157
157
|
# Another encoder validation error occurred.
|
158
158
|
#
|
159
159
|
def validate_encoder(encoder)
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
exit(-1)
|
169
|
-
end
|
160
|
+
encoder.validate
|
161
|
+
rescue Core::Params::ParamError, ValidationError => error
|
162
|
+
print_error "failed to validate the encoder #{encoder.class_id}: #{error.message}"
|
163
|
+
exit(1)
|
164
|
+
rescue => error
|
165
|
+
print_error "an unhandled exception occurred while validating the encoder #{encoder.class_id}"
|
166
|
+
print_exception(error)
|
167
|
+
exit(-1)
|
170
168
|
end
|
171
169
|
|
172
170
|
#
|
@@ -197,13 +195,11 @@ module Ronin
|
|
197
195
|
# @return [String]
|
198
196
|
#
|
199
197
|
def encode_data(data)
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
exit(1)
|
206
|
-
end
|
198
|
+
@pipeline.encode(data)
|
199
|
+
rescue => error
|
200
|
+
print_error "unhandled exception occurred while encoding data"
|
201
|
+
print_exception(error)
|
202
|
+
exit(1)
|
207
203
|
end
|
208
204
|
|
209
205
|
end
|
@@ -36,7 +36,7 @@ module Ronin
|
|
36
36
|
# ronin-payloads launch [options] {-f FILE | NAME}
|
37
37
|
#
|
38
38
|
# ## Options
|
39
|
-
#
|
39
|
+
#
|
40
40
|
# -f, --file FILE The payload file to load
|
41
41
|
# -p, --param NAME=VALUE Sets a param
|
42
42
|
# -D, --debug Enables debugging messages
|
@@ -90,7 +90,7 @@ module Ronin
|
|
90
90
|
begin
|
91
91
|
@payload.perform_prelaunch
|
92
92
|
@payload.perform_postlaunch
|
93
|
-
rescue
|
93
|
+
rescue PayloadError => error
|
94
94
|
print_error("failed to launch payload #{@payload.class_id}: #{error.message}")
|
95
95
|
exit(1)
|
96
96
|
rescue => error
|
@@ -41,7 +41,7 @@ module Ronin
|
|
41
41
|
# ronin-payload new [options] FILE
|
42
42
|
#
|
43
43
|
# ## Options
|
44
|
-
#
|
44
|
+
#
|
45
45
|
# -t asm|shellcode|c|go|rust|shell|powershell|html|javascript|typescript|java|sql|php|python|ruby|nodejs,
|
46
46
|
# --type The type for the new payload
|
47
47
|
# -a, --author NAME The name of the author
|