ronin-exploits 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +122 -0
- data/Manifest.txt +110 -20
- data/README.txt +112 -31
- data/Rakefile +12 -1
- data/bin/ronin-exploit +12 -0
- data/bin/ronin-exploits +1 -1
- data/bin/ronin-gen-binary-payload +12 -0
- data/bin/ronin-gen-exploit +12 -0
- data/bin/ronin-gen-ftp-exploit +12 -0
- data/bin/ronin-gen-http-exploit +12 -0
- data/bin/ronin-gen-local-exploit +12 -0
- data/bin/ronin-gen-nops +12 -0
- data/bin/ronin-gen-payload +12 -0
- data/bin/ronin-gen-remote-exploit +12 -0
- data/bin/ronin-gen-remote-tcp-exploit +12 -0
- data/bin/ronin-gen-remote-udp-exploit +12 -0
- data/bin/ronin-gen-shellcode +12 -0
- data/bin/ronin-gen-web-exploit +12 -0
- data/bin/ronin-payload +1 -1
- data/bin/ronin-payloads +1 -1
- data/lib/ronin/controls.rb +23 -0
- data/lib/ronin/controls/behaviors.rb +133 -0
- data/lib/ronin/{payloads/helpers → controls}/exceptions.rb +2 -4
- data/lib/ronin/{payloads/arch.rb → controls/exceptions/not_implemented.rb} +3 -8
- data/lib/ronin/controls/exceptions/program_not_found.rb +27 -0
- data/lib/ronin/controls/file_system.rb +145 -0
- data/lib/ronin/{exploits/os.rb → controls/helpers.rb} +12 -13
- data/lib/ronin/controls/helpers/command_exec.rb +143 -0
- data/lib/ronin/controls/helpers/dir_create.rb +42 -0
- data/lib/ronin/controls/helpers/dir_listing.rb +62 -0
- data/lib/ronin/controls/helpers/dir_remove.rb +42 -0
- data/lib/ronin/controls/helpers/file_ctime.rb +52 -0
- data/lib/ronin/controls/helpers/file_mtime.rb +53 -0
- data/lib/ronin/controls/helpers/file_ownership.rb +53 -0
- data/lib/ronin/controls/helpers/file_read.rb +62 -0
- data/lib/ronin/controls/helpers/file_remove.rb +51 -0
- data/lib/ronin/controls/helpers/file_write.rb +62 -0
- data/lib/ronin/controls/helpers/memory_read.rb +39 -0
- data/lib/ronin/controls/helpers/memory_write.rb +39 -0
- data/lib/ronin/exploits.rb +0 -2
- data/lib/ronin/exploits/{allow.rb → control.rb} +5 -9
- data/lib/ronin/exploits/exceptions.rb +1 -2
- data/lib/ronin/exploits/exceptions/exception.rb +27 -0
- data/lib/ronin/exploits/exceptions/exploit_not_built.rb +3 -3
- data/lib/ronin/exploits/exceptions/payload_size.rb +3 -3
- data/lib/ronin/exploits/exceptions/restricted_char.rb +3 -3
- data/lib/ronin/exploits/exceptions/target_data_missing.rb +3 -3
- data/lib/ronin/exploits/exceptions/target_unspecified.rb +3 -3
- data/lib/ronin/exploits/exceptions/unknown_helper.rb +3 -3
- data/lib/ronin/exploits/exploit.rb +449 -92
- data/lib/ronin/exploits/exploit_author.rb +2 -3
- data/lib/ronin/exploits/ftp.rb +7 -2
- data/lib/ronin/exploits/helpers.rb +0 -2
- data/lib/ronin/exploits/helpers/binary.rb +11 -5
- data/lib/ronin/exploits/helpers/buffer_overflow.rb +38 -25
- data/lib/ronin/exploits/helpers/file_based.rb +29 -30
- data/lib/ronin/exploits/helpers/format_string.rb +34 -24
- data/lib/ronin/exploits/helpers/padding.rb +33 -16
- data/lib/ronin/exploits/http.rb +9 -4
- data/lib/ronin/exploits/local.rb +8 -2
- data/lib/ronin/exploits/remote.rb +8 -2
- data/lib/ronin/exploits/remote_tcp.rb +26 -8
- data/lib/ronin/exploits/remote_udp.rb +26 -8
- data/lib/ronin/exploits/target.rb +41 -30
- data/lib/ronin/exploits/targets.rb +0 -2
- data/lib/ronin/exploits/targets/buffer_overflow.rb +0 -2
- data/lib/ronin/exploits/targets/format_string.rb +0 -2
- data/lib/ronin/exploits/verifiers.rb +45 -16
- data/lib/ronin/exploits/version.rb +1 -3
- data/lib/ronin/exploits/web.rb +18 -6
- data/lib/ronin/generators/exploits.rb +23 -0
- data/lib/ronin/generators/exploits/exploit.rb +70 -0
- data/lib/ronin/generators/exploits/ftp.rb +42 -0
- data/lib/ronin/generators/exploits/http.rb +42 -0
- data/lib/ronin/generators/exploits/local.rb +42 -0
- data/lib/ronin/generators/exploits/remote.rb +42 -0
- data/lib/ronin/generators/exploits/remote_tcp.rb +44 -0
- data/lib/ronin/generators/exploits/remote_udp.rb +44 -0
- data/lib/ronin/{exploits/arch.rb → generators/exploits/static.rb} +5 -9
- data/lib/ronin/generators/exploits/web.rb +45 -0
- data/lib/ronin/generators/payloads.rb +23 -0
- data/lib/ronin/generators/payloads/binary_payload.rb +42 -0
- data/lib/ronin/generators/payloads/nops.rb +42 -0
- data/lib/ronin/generators/payloads/payload.rb +66 -0
- data/lib/ronin/generators/payloads/shellcode.rb +42 -0
- data/lib/ronin/generators/payloads/static.rb +30 -0
- data/lib/ronin/model/has_default_port.rb +6 -6
- data/lib/ronin/model/targets_arch.rb +18 -7
- data/lib/ronin/model/targets_os.rb +18 -8
- data/lib/ronin/model/targets_product.rb +68 -0
- data/lib/ronin/payloads.rb +0 -2
- data/lib/ronin/payloads/asm_payload.rb +8 -2
- data/lib/ronin/payloads/binary_payload.rb +8 -2
- data/lib/ronin/payloads/control.rb +1 -5
- data/lib/ronin/payloads/encoders.rb +1 -2
- data/lib/ronin/payloads/encoders/encoder.rb +92 -0
- data/lib/ronin/payloads/encoders/xor.rb +4 -6
- data/lib/ronin/payloads/exceptions.rb +1 -2
- data/lib/ronin/payloads/{helpers/exceptions/not_implemented.rb → exceptions/exception.rb} +1 -5
- data/lib/ronin/payloads/{helpers/exceptions/program_not_found.rb → exceptions/not_implemented.rb} +3 -5
- data/lib/ronin/payloads/exceptions/unknown_helper.rb +3 -3
- data/lib/ronin/payloads/has_payload.rb +111 -0
- data/lib/ronin/payloads/helpers.rb +1 -4
- data/lib/ronin/payloads/helpers/chained.rb +61 -0
- data/lib/ronin/payloads/helpers/rpc.rb +31 -21
- data/lib/ronin/payloads/nops.rb +7 -2
- data/lib/ronin/payloads/payload.rb +144 -85
- data/lib/ronin/payloads/payload_author.rb +2 -3
- data/lib/ronin/payloads/shellcode.rb +8 -5
- data/lib/ronin/payloads/web_payload.rb +8 -2
- data/lib/ronin/ui/command_line/commands/exploit.rb +193 -0
- data/lib/ronin/ui/command_line/commands/exploits.rb +102 -25
- data/lib/ronin/ui/command_line/commands/gen_binary_payload.rb +34 -0
- data/lib/ronin/ui/command_line/commands/gen_exploit.rb +34 -0
- data/lib/ronin/ui/command_line/commands/gen_ftp_exploit.rb +34 -0
- data/lib/ronin/ui/command_line/commands/gen_http_exploit.rb +34 -0
- data/lib/ronin/ui/command_line/commands/gen_local_exploit.rb +34 -0
- data/lib/ronin/{exploits/license.rb → ui/command_line/commands/gen_nops.rb} +8 -8
- data/lib/ronin/ui/command_line/commands/gen_payload.rb +34 -0
- data/lib/ronin/ui/command_line/commands/gen_remote_exploit.rb +34 -0
- data/lib/ronin/ui/command_line/commands/gen_remote_tcp_exploit.rb +34 -0
- data/lib/ronin/ui/command_line/commands/gen_remote_udp_exploit.rb +34 -0
- data/lib/ronin/ui/command_line/commands/gen_shellcode.rb +34 -0
- data/lib/ronin/ui/command_line/commands/gen_web_exploit.rb +34 -0
- data/lib/ronin/ui/command_line/commands/payload.rb +73 -50
- data/lib/ronin/ui/command_line/commands/payloads.rb +78 -23
- data/lib/ronin/vuln/behavior.rb +101 -28
- data/spec/controls/behaviors_examples.rb +38 -0
- data/spec/exploits/exploit_spec.rb +177 -23
- data/spec/exploits/file_based_exploit_spec.rb +16 -7
- data/spec/exploits/remote_tcp_spec.rb +1 -1
- data/spec/exploits/remote_udp_spec.rb +1 -1
- data/spec/generators/exploits/exploit_examples.rb +24 -0
- data/spec/generators/exploits/exploit_spec.rb +42 -0
- data/spec/generators/exploits/ftp_spec.rb +42 -0
- data/spec/generators/exploits/http_spec.rb +42 -0
- data/spec/generators/exploits/local_spec.rb +42 -0
- data/spec/generators/exploits/remote_spec.rb +42 -0
- data/spec/generators/exploits/remote_tcp_spec.rb +47 -0
- data/spec/generators/exploits/remote_udp_spec.rb +47 -0
- data/spec/generators/exploits/web_spec.rb +52 -0
- data/spec/generators/payloads/binary_payload_spec.rb +31 -0
- data/spec/generators/payloads/nops_spec.rb +31 -0
- data/spec/generators/payloads/payload_examples.rb +16 -0
- data/spec/generators/payloads/payload_spec.rb +31 -0
- data/spec/generators/payloads/shellcode_spec.rb +31 -0
- data/spec/model/models/targets_product_model.rb +11 -0
- data/spec/model/targets_arch_spec.rb +11 -1
- data/spec/model/targets_os_spec.rb +11 -1
- data/spec/model/targets_product_spec.rb +35 -0
- data/spec/objects/exploits/{test.rb → simple.rb} +1 -1
- data/spec/objects/payloads/{test.rb → simple.rb} +6 -2
- data/spec/payloads/encoders/encoder_spec.rb +30 -0
- data/spec/payloads/encoders/xor_spec.rb +1 -1
- data/spec/payloads/payload_spec.rb +41 -43
- data/spec/spec_helper.rb +4 -1
- data/static/ronin/generators/exploits/_cache.erb +14 -0
- data/static/ronin/generators/exploits/_header.erb +1 -0
- data/static/ronin/generators/exploits/_helpers.erb +4 -0
- data/static/ronin/generators/exploits/exploit.erb +24 -0
- data/static/ronin/generators/exploits/ftp.erb +24 -0
- data/static/ronin/generators/exploits/http.erb +26 -0
- data/static/ronin/generators/exploits/local.erb +24 -0
- data/static/ronin/generators/exploits/remote.erb +24 -0
- data/static/ronin/generators/exploits/remote_tcp.erb +26 -0
- data/static/ronin/generators/exploits/remote_udp.erb +26 -0
- data/static/ronin/generators/exploits/web.erb +28 -0
- data/static/ronin/generators/payloads/_cache.erb +10 -0
- data/static/ronin/generators/payloads/_header.erb +1 -0
- data/static/ronin/generators/payloads/_helpers.erb +2 -0
- data/static/ronin/generators/payloads/binary_payload.erb +25 -0
- data/static/ronin/generators/payloads/nops.erb +19 -0
- data/static/ronin/generators/payloads/payload.erb +25 -0
- data/static/ronin/generators/payloads/shellcode.erb +25 -0
- data/tasks/spec.rb +1 -0
- data/tasks/yard.rb +13 -0
- metadata +162 -30
- metadata.gz.sig +0 -0
- data/TODO.txt +0 -22
- data/lib/ronin/exploits/product.rb +0 -34
- data/lib/ronin/payloads/encoder.rb +0 -84
- data/lib/ronin/payloads/helpers/file_system.rb +0 -187
- data/lib/ronin/payloads/helpers/shell.rb +0 -91
- data/lib/ronin/payloads/license.rb +0 -34
- data/lib/ronin/payloads/os.rb +0 -34
- data/spec/payloads/encoder_spec.rb +0 -30
@@ -1,5 +1,4 @@
|
|
1
1
|
#
|
2
|
-
#--
|
3
2
|
# Ronin Exploits - A Ruby library for Ronin that provides exploitation and
|
4
3
|
# payload crafting functionality.
|
5
4
|
#
|
@@ -18,9 +17,7 @@
|
|
18
17
|
# You should have received a copy of the GNU General Public License
|
19
18
|
# along with this program; if not, write to the Free Software
|
20
19
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
#++
|
22
20
|
#
|
23
21
|
|
24
|
-
require 'ronin/payloads/helpers/
|
25
|
-
require 'ronin/payloads/helpers/shell'
|
22
|
+
require 'ronin/payloads/helpers/chained'
|
26
23
|
require 'ronin/payloads/helpers/rpc'
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'ronin/payloads/has_payload'
|
2
|
+
|
3
|
+
module Ronin
|
4
|
+
module Payloads
|
5
|
+
module Helpers
|
6
|
+
module Chained
|
7
|
+
include HasPayload
|
8
|
+
|
9
|
+
#
|
10
|
+
# Chains the payload to another payload.
|
11
|
+
#
|
12
|
+
# @param [Payload] sub_payload
|
13
|
+
# The payload chained to this payload.
|
14
|
+
#
|
15
|
+
# @return [Payload]
|
16
|
+
# The chained payload.
|
17
|
+
#
|
18
|
+
def chain(sub_payload)
|
19
|
+
self.payload = sub_payload
|
20
|
+
end
|
21
|
+
|
22
|
+
#
|
23
|
+
# Builds the chained payload first, then the payload.
|
24
|
+
#
|
25
|
+
# @see Payload#build!
|
26
|
+
#
|
27
|
+
def build!(options={},&block)
|
28
|
+
@payload.build!() if @payload
|
29
|
+
|
30
|
+
return super(options,&block)
|
31
|
+
end
|
32
|
+
|
33
|
+
#
|
34
|
+
# Verifies the built payload and deploys the payload. After the
|
35
|
+
# payload has been deployed, the chained payload will then be
|
36
|
+
# deployed.
|
37
|
+
#
|
38
|
+
# @yield [(payload)]
|
39
|
+
# If a block is given, the chained payload will be passed to the
|
40
|
+
# block.
|
41
|
+
#
|
42
|
+
# @yieldparam [Payload] payload
|
43
|
+
# The chained payload.
|
44
|
+
#
|
45
|
+
# @return [Payload]
|
46
|
+
# The chained payload.
|
47
|
+
#
|
48
|
+
# @see Payload#deploy!
|
49
|
+
#
|
50
|
+
def deploy!(&block)
|
51
|
+
if @payload
|
52
|
+
super()
|
53
|
+
return @payload.deploy!(&block)
|
54
|
+
end
|
55
|
+
|
56
|
+
return super(&block)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
#
|
2
|
-
#--
|
3
2
|
# Ronin Exploits - A Ruby library for Ronin that provides exploitation and
|
4
3
|
# payload crafting functionality.
|
5
4
|
#
|
@@ -18,45 +17,54 @@
|
|
18
17
|
# You should have received a copy of the GNU General Public License
|
19
18
|
# along with this program; if not, write to the Free Software
|
20
19
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
#++
|
22
20
|
#
|
23
21
|
|
24
|
-
require 'ronin/payloads/
|
22
|
+
require 'ronin/payloads/exceptions/not_implemented'
|
25
23
|
|
26
24
|
module Ronin
|
27
25
|
module Payloads
|
28
26
|
module Helpers
|
29
|
-
module
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
42
|
-
|
27
|
+
module Rpc
|
28
|
+
#
|
29
|
+
# Calls a specific method with additional arguments.
|
30
|
+
#
|
31
|
+
# @param [Symbol, String] method
|
32
|
+
# The method name to call.
|
33
|
+
#
|
34
|
+
# @param [Array] arguments
|
35
|
+
# The arguments to use when calling the method.
|
36
|
+
#
|
37
|
+
# @return [Object]
|
38
|
+
# The result of the method call.
|
43
39
|
#
|
44
|
-
#
|
45
|
-
# Returns the return-value of the method-call.
|
40
|
+
# @since 0.3.0
|
46
41
|
#
|
47
42
|
def call_method(method,*arguments)
|
48
43
|
raise(NotImplemented,"the call method is unimplemented",caller)
|
49
44
|
end
|
50
45
|
|
51
46
|
#
|
52
|
-
# Evaluates
|
47
|
+
# Evaluates code.
|
48
|
+
#
|
49
|
+
# @param [String] code
|
50
|
+
# The code to evaluate.
|
51
|
+
#
|
52
|
+
# @return [Object]
|
53
|
+
# The result of the code evaluation.
|
54
|
+
#
|
55
|
+
# @since 0.3.0
|
53
56
|
#
|
54
57
|
def eval(code)
|
55
58
|
call_method(:eval,code)
|
56
59
|
end
|
57
60
|
|
58
61
|
#
|
59
|
-
# Exits
|
62
|
+
# Exits the process.
|
63
|
+
#
|
64
|
+
# @param [Integer] status
|
65
|
+
# The status to exit with.
|
66
|
+
#
|
67
|
+
# @since 0.3.0
|
60
68
|
#
|
61
69
|
def exit(status=0)
|
62
70
|
call_method(:exit,status)
|
@@ -68,6 +76,8 @@ module Ronin
|
|
68
76
|
# Provides transparent access to remote methods using the
|
69
77
|
# specified _name_ and given _arguments_.
|
70
78
|
#
|
79
|
+
# @since 0.3.0
|
80
|
+
#
|
71
81
|
def method_missing(name,*arguments,&block)
|
72
82
|
name = name.to_s
|
73
83
|
|
data/lib/ronin/payloads/nops.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
#
|
2
|
-
#--
|
3
2
|
# Ronin Exploits - A Ruby library for Ronin that provides exploitation and
|
4
3
|
# payload crafting functionality.
|
5
4
|
#
|
@@ -18,7 +17,6 @@
|
|
18
17
|
# You should have received a copy of the GNU General Public License
|
19
18
|
# along with this program; if not, write to the Free Software
|
20
19
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
#++
|
22
20
|
#
|
23
21
|
|
24
22
|
require 'ronin/payloads/asm_payload'
|
@@ -27,6 +25,13 @@ module Ronin
|
|
27
25
|
module Payloads
|
28
26
|
class Nops < ASMPayload
|
29
27
|
|
28
|
+
#
|
29
|
+
# Creates a new Ronin::Payloads::Nops object using the given _block_.
|
30
|
+
#
|
31
|
+
# ronin_nops do
|
32
|
+
# ...
|
33
|
+
# end
|
34
|
+
#
|
30
35
|
contextify :ronin_nops
|
31
36
|
|
32
37
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
#
|
2
|
-
#--
|
3
2
|
# Ronin Exploits - A Ruby library for Ronin that provides exploitation and
|
4
3
|
# payload crafting functionality.
|
5
4
|
#
|
@@ -18,23 +17,21 @@
|
|
18
17
|
# You should have received a copy of the GNU General Public License
|
19
18
|
# along with this program; if not, write to the Free Software
|
20
19
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
#++
|
22
20
|
#
|
23
21
|
|
24
22
|
require 'ronin/payloads/exceptions/unknown_helper'
|
25
|
-
require 'ronin/payloads/license'
|
26
|
-
require 'ronin/payloads/arch'
|
27
|
-
require 'ronin/payloads/os'
|
28
23
|
require 'ronin/payloads/payload_author'
|
29
24
|
require 'ronin/payloads/control'
|
25
|
+
require 'ronin/cacheable'
|
30
26
|
require 'ronin/model/targets_arch'
|
31
27
|
require 'ronin/model/targets_os'
|
32
28
|
require 'ronin/model/has_name'
|
33
29
|
require 'ronin/model/has_description'
|
34
30
|
require 'ronin/model/has_version'
|
35
31
|
require 'ronin/model/has_license'
|
36
|
-
require 'ronin/
|
37
|
-
require 'ronin/
|
32
|
+
require 'ronin/controls/behaviors'
|
33
|
+
require 'ronin/ui/output/helpers'
|
34
|
+
require 'ronin/extensions/kernel'
|
38
35
|
|
39
36
|
require 'parameters'
|
40
37
|
|
@@ -50,18 +47,27 @@ module Ronin
|
|
50
47
|
include Model::HasLicense
|
51
48
|
include Model::TargetsArch
|
52
49
|
include Model::TargetsOS
|
53
|
-
include
|
50
|
+
include Controls::Behaviors
|
51
|
+
include UI::Output::Helpers
|
54
52
|
|
53
|
+
#
|
54
|
+
# Creates a new Ronin::Payloads::Payload object using the given
|
55
|
+
# _block_.
|
56
|
+
#
|
57
|
+
# ronin_payload do
|
58
|
+
# ...
|
59
|
+
# end
|
60
|
+
#
|
55
61
|
contextify :ronin_payload
|
56
62
|
|
57
63
|
# Primary key of the payload
|
58
64
|
property :id, Serial
|
59
65
|
|
60
66
|
# Author(s) of the payload
|
61
|
-
has n, :authors, :
|
67
|
+
has n, :authors, :model => 'Ronin::Payloads::PayloadAuthor'
|
62
68
|
|
63
69
|
# Controls the payload provides
|
64
|
-
has n, :controls
|
70
|
+
has n, :controls, :model => 'Ronin::Payloads::Control'
|
65
71
|
|
66
72
|
# Validations
|
67
73
|
validates_present :name
|
@@ -70,13 +76,18 @@ module Ronin
|
|
70
76
|
# The exploit to deploy with
|
71
77
|
attr_accessor :exploit
|
72
78
|
|
73
|
-
# The
|
74
|
-
attr_accessor :
|
79
|
+
# The raw payload
|
80
|
+
attr_accessor :raw_payload
|
75
81
|
|
76
82
|
#
|
77
|
-
# Creates a new Payload object
|
78
|
-
#
|
79
|
-
#
|
83
|
+
# Creates a new Payload object.
|
84
|
+
#
|
85
|
+
# @param [Array] attributes
|
86
|
+
# Additional attributes to initialize the payload with.
|
87
|
+
#
|
88
|
+
# @yield []
|
89
|
+
# If a block is given, it will be evaluated in the newly created
|
90
|
+
# Payload object.
|
80
91
|
#
|
81
92
|
def initialize(attributes={},&block)
|
82
93
|
super(attributes)
|
@@ -90,66 +101,103 @@ module Ronin
|
|
90
101
|
end
|
91
102
|
|
92
103
|
#
|
93
|
-
#
|
94
|
-
# is given, it will be passed to the newly created PayloadAuthor
|
95
|
-
# object.
|
104
|
+
# Finds all payloads written by a specific author.
|
96
105
|
#
|
97
|
-
#
|
98
|
-
#
|
99
|
-
# :organization => 'Anonymous LLC'
|
106
|
+
# @param [String] name
|
107
|
+
# The name of the author.
|
100
108
|
#
|
101
|
-
|
102
|
-
|
109
|
+
# @return [Array<Payload>]
|
110
|
+
# The payload written by the author.
|
111
|
+
#
|
112
|
+
def self.written_by(name)
|
113
|
+
all(self.authors.name.like => "%#{name}%")
|
103
114
|
end
|
104
115
|
|
105
116
|
#
|
106
|
-
#
|
107
|
-
# _behaviors_.
|
117
|
+
# Finds all payloads written for a specific organization.
|
108
118
|
#
|
109
|
-
#
|
110
|
-
#
|
111
|
-
# :file_write,
|
112
|
-
# :file_create
|
119
|
+
# @param [String] name
|
120
|
+
# The name of the organization.
|
113
121
|
#
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
end
|
122
|
+
# @return [Array<Payload>]
|
123
|
+
# The payloads written for the organization.
|
124
|
+
#
|
125
|
+
def self.written_for(name)
|
126
|
+
all(self.authors.organization.like => "%#{name}%")
|
120
127
|
end
|
121
128
|
|
122
129
|
#
|
123
|
-
#
|
130
|
+
# Adds a new author to the payload.
|
131
|
+
#
|
132
|
+
# @param [Hash] attributes
|
133
|
+
# Additional attributes to create the PayloadAuthor object with.
|
134
|
+
#
|
135
|
+
# @yield [author]
|
136
|
+
# If a block is given, it will be passed the newly created author
|
137
|
+
# object.
|
138
|
+
#
|
139
|
+
# @yieldparam [PayloadAuthor] author
|
140
|
+
# The author object tied to the payload.
|
124
141
|
#
|
125
|
-
|
126
|
-
|
142
|
+
# @example
|
143
|
+
# author :name => 'Anonymous',
|
144
|
+
# :email => 'anon@example.com',
|
145
|
+
# :organization => 'Anonymous LLC'
|
146
|
+
#
|
147
|
+
def author(attributes={},&block)
|
148
|
+
self.authors << PayloadAuthor.new(attributes,&block)
|
127
149
|
end
|
128
150
|
|
129
151
|
#
|
130
|
-
#
|
152
|
+
# @return [Boolean]
|
153
|
+
# Specifies whether the payload is built.
|
131
154
|
#
|
132
155
|
def built?
|
133
156
|
@built == true
|
134
157
|
end
|
135
158
|
|
136
159
|
#
|
137
|
-
#
|
138
|
-
#
|
139
|
-
#
|
160
|
+
# Builds the payload.
|
161
|
+
#
|
162
|
+
# @param [Hash] options
|
163
|
+
# Additional options to build the payload with and use as
|
164
|
+
# parameters.
|
165
|
+
#
|
166
|
+
# @yield [payload]
|
167
|
+
# If a block is given, it will be yielded the result of the
|
168
|
+
# payload building.
|
169
|
+
#
|
170
|
+
# @yieldparam [String] payload
|
171
|
+
# The built payload.
|
172
|
+
#
|
173
|
+
# @return [String]
|
174
|
+
# The built payload.
|
140
175
|
#
|
141
176
|
def build!(options={},&block)
|
142
177
|
self.params = options
|
143
178
|
|
179
|
+
print_debug "Payload parameters: #{self.params.inspect}"
|
180
|
+
|
144
181
|
@built = false
|
145
|
-
@
|
182
|
+
@raw_payload = ''
|
183
|
+
|
184
|
+
print_info "Building payload ..."
|
146
185
|
|
147
186
|
build()
|
148
187
|
|
188
|
+
print_info "Payload built!"
|
189
|
+
|
149
190
|
@built = true
|
150
191
|
|
151
|
-
|
152
|
-
|
192
|
+
if block
|
193
|
+
if block.arity == 1
|
194
|
+
block.call(self)
|
195
|
+
else
|
196
|
+
block.call()
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
return self
|
153
201
|
end
|
154
202
|
|
155
203
|
#
|
@@ -157,73 +205,75 @@ module Ronin
|
|
157
205
|
# deployed.
|
158
206
|
#
|
159
207
|
def verify!
|
208
|
+
print_info "Verifying payload ..."
|
209
|
+
|
160
210
|
verify
|
211
|
+
|
212
|
+
print_info "Payload verified!"
|
161
213
|
end
|
162
214
|
|
163
215
|
#
|
164
|
-
#
|
165
|
-
#
|
216
|
+
# @return [Boolean]
|
217
|
+
# Specifies whether the payload has previously been deployed.
|
166
218
|
#
|
167
219
|
def deployed?
|
168
220
|
@deployed == true
|
169
221
|
end
|
170
222
|
|
171
223
|
#
|
172
|
-
# Verifies the built payload and deploys the payload.
|
173
|
-
#
|
174
|
-
#
|
175
|
-
#
|
224
|
+
# Verifies the built payload and deploys the payload.
|
225
|
+
#
|
226
|
+
# @yield [payload]
|
227
|
+
# If a block is given, it will be passed the deployed payload.
|
228
|
+
#
|
229
|
+
# @yieldparam [Payload] payload
|
230
|
+
# The deployed payload.
|
176
231
|
#
|
177
|
-
def deploy!(
|
232
|
+
def deploy!(&block)
|
178
233
|
# verify the payload
|
179
234
|
verify!
|
180
235
|
|
181
|
-
|
182
|
-
# build, verify and deploy the exploit with the built payload
|
183
|
-
@exploit.call(options.merge(:payload => @payload))
|
184
|
-
end
|
185
|
-
|
236
|
+
print_info "Deploying payload ..."
|
186
237
|
@deployed = false
|
187
238
|
|
188
239
|
deploy()
|
189
240
|
|
241
|
+
print_info "Payload deployed!"
|
190
242
|
@deployed = true
|
191
243
|
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
# the given _block_. If a _block_ is given, it will be passed the
|
199
|
-
# deployed payload object.
|
200
|
-
#
|
201
|
-
# _options_ may contain the following keys:
|
202
|
-
# <tt>:exploit</tt>:: The exploit object to use with the payload.
|
203
|
-
#
|
204
|
-
def call(options={},&block)
|
205
|
-
if options[:exploit]
|
206
|
-
# set the exploit if one is given
|
207
|
-
@exploit = options.delete(:exploit)
|
244
|
+
if block
|
245
|
+
if block.arity == 1
|
246
|
+
block.call(self)
|
247
|
+
else
|
248
|
+
block.call()
|
249
|
+
end
|
208
250
|
end
|
209
251
|
|
210
|
-
|
211
|
-
build!(options)
|
212
|
-
|
213
|
-
# deploy the payload
|
214
|
-
return deploy!(options,&block)
|
252
|
+
return self
|
215
253
|
end
|
216
254
|
|
217
255
|
#
|
218
|
-
#
|
256
|
+
# Converts the payload to a String.
|
257
|
+
#
|
258
|
+
# @return [String]
|
259
|
+
# The name and version of the payload.
|
219
260
|
#
|
220
261
|
def to_s
|
221
|
-
|
262
|
+
if (self.name && self.version)
|
263
|
+
"#{self.name} #{self.version}"
|
264
|
+
elsif self.name
|
265
|
+
self.name
|
266
|
+
elsif self.version
|
267
|
+
self.version
|
268
|
+
end
|
222
269
|
end
|
223
270
|
|
224
271
|
#
|
225
272
|
# Inspects the contents of the payload.
|
226
273
|
#
|
274
|
+
# @return [String]
|
275
|
+
# The inspected payload.
|
276
|
+
#
|
227
277
|
def inspect
|
228
278
|
str = "#{self.class}: #{self}"
|
229
279
|
str << " #{self.params.inspect}" unless self.params.empty?
|
@@ -235,11 +285,20 @@ module Ronin
|
|
235
285
|
|
236
286
|
#
|
237
287
|
# Extends the payload with the helper module defined in
|
238
|
-
# Ronin::Payloads::Helpers that has the similar
|
239
|
-
#
|
240
|
-
#
|
241
|
-
#
|
288
|
+
# Ronin::Payloads::Helpers that has the similar name.
|
289
|
+
#
|
290
|
+
# @param [Symbol, String] name
|
291
|
+
# The snake-case name of the payload helper to load and extend the
|
292
|
+
# payload with.
|
293
|
+
#
|
294
|
+
# @return [true]
|
295
|
+
# The payload helper was successfully loaded.
|
296
|
+
#
|
297
|
+
# @raise [UnknownHelper]
|
298
|
+
# No valid helper module could be found or loaded with the similar
|
299
|
+
# name.
|
242
300
|
#
|
301
|
+
# @example
|
243
302
|
# helper :shell
|
244
303
|
#
|
245
304
|
def helper(name)
|
@@ -247,7 +306,7 @@ module Ronin
|
|
247
306
|
module_name = name.to_const_string
|
248
307
|
|
249
308
|
begin
|
250
|
-
|
309
|
+
require_within File.join('ronin','payloads','helpers'), name
|
251
310
|
rescue Gem::LoadError => e
|
252
311
|
raise(e)
|
253
312
|
rescue ::LoadError
|