ronin 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. data/COPYING.txt +339 -0
  2. data/History.txt +34 -0
  3. data/Manifest.txt +157 -0
  4. data/README.txt +131 -0
  5. data/Rakefile +23 -0
  6. data/TODO.txt +6 -0
  7. data/bin/ronin +12 -0
  8. data/lib/ronin.rb +35 -0
  9. data/lib/ronin/arch.rb +86 -0
  10. data/lib/ronin/author.rb +88 -0
  11. data/lib/ronin/cache.rb +27 -0
  12. data/lib/ronin/cache/config.rb +34 -0
  13. data/lib/ronin/cache/exceptions.rb +25 -0
  14. data/lib/ronin/cache/exceptions/extension_not_found.rb +29 -0
  15. data/lib/ronin/cache/exceptions/overlay_cached.rb +29 -0
  16. data/lib/ronin/cache/exceptions/overlay_not_found.rb +29 -0
  17. data/lib/ronin/cache/extension.rb +706 -0
  18. data/lib/ronin/cache/extension_cache.rb +108 -0
  19. data/lib/ronin/cache/overlay.rb +418 -0
  20. data/lib/ronin/cache/overlay_cache.rb +228 -0
  21. data/lib/ronin/cache/ronin.rb +50 -0
  22. data/lib/ronin/chars.rb +25 -0
  23. data/lib/ronin/chars/char_set.rb +121 -0
  24. data/lib/ronin/chars/chars.rb +180 -0
  25. data/lib/ronin/config.rb +31 -0
  26. data/lib/ronin/console.rb +127 -0
  27. data/lib/ronin/context.rb +233 -0
  28. data/lib/ronin/database.rb +122 -0
  29. data/lib/ronin/environment.rb +39 -0
  30. data/lib/ronin/exceptions/context_not_found.rb +27 -0
  31. data/lib/ronin/exceptions/invalid_database_config.rb +27 -0
  32. data/lib/ronin/exceptions/object_context_not_found.rb +27 -0
  33. data/lib/ronin/exceptions/unknown_context.rb +27 -0
  34. data/lib/ronin/exceptions/unknown_object_context.rb +27 -0
  35. data/lib/ronin/extensions.rb +28 -0
  36. data/lib/ronin/extensions/hash.rb +62 -0
  37. data/lib/ronin/extensions/kernel.rb +34 -0
  38. data/lib/ronin/extensions/meta.rb +24 -0
  39. data/lib/ronin/extensions/meta/object.rb +24 -0
  40. data/lib/ronin/extensions/string.rb +37 -0
  41. data/lib/ronin/extensions/uri.rb +24 -0
  42. data/lib/ronin/extensions/uri/http.rb +78 -0
  43. data/lib/ronin/extensions/uri/query_params.rb +97 -0
  44. data/lib/ronin/formatting.rb +29 -0
  45. data/lib/ronin/formatting/binary.rb +24 -0
  46. data/lib/ronin/formatting/digest.rb +24 -0
  47. data/lib/ronin/formatting/extensions.rb +26 -0
  48. data/lib/ronin/formatting/extensions/binary.rb +25 -0
  49. data/lib/ronin/formatting/extensions/binary/integer.rb +59 -0
  50. data/lib/ronin/formatting/extensions/binary/string.rb +73 -0
  51. data/lib/ronin/formatting/extensions/digest.rb +24 -0
  52. data/lib/ronin/formatting/extensions/digest/string.rb +65 -0
  53. data/lib/ronin/formatting/extensions/html.rb +24 -0
  54. data/lib/ronin/formatting/extensions/html/string.rb +75 -0
  55. data/lib/ronin/formatting/extensions/http.rb +24 -0
  56. data/lib/ronin/formatting/extensions/http/string.rb +69 -0
  57. data/lib/ronin/formatting/extensions/text.rb +24 -0
  58. data/lib/ronin/formatting/extensions/text/string.rb +96 -0
  59. data/lib/ronin/formatting/html.rb +24 -0
  60. data/lib/ronin/formatting/http.rb +24 -0
  61. data/lib/ronin/formatting/text.rb +24 -0
  62. data/lib/ronin/license.rb +87 -0
  63. data/lib/ronin/model.rb +44 -0
  64. data/lib/ronin/models.rb +34 -0
  65. data/lib/ronin/network.rb +31 -0
  66. data/lib/ronin/network/esmtp.rb +24 -0
  67. data/lib/ronin/network/extensions.rb +31 -0
  68. data/lib/ronin/network/extensions/esmtp.rb +24 -0
  69. data/lib/ronin/network/extensions/esmtp/net.rb +68 -0
  70. data/lib/ronin/network/extensions/http.rb +24 -0
  71. data/lib/ronin/network/extensions/http/net.rb +303 -0
  72. data/lib/ronin/network/extensions/imap.rb +24 -0
  73. data/lib/ronin/network/extensions/imap/net.rb +92 -0
  74. data/lib/ronin/network/extensions/pop3.rb +24 -0
  75. data/lib/ronin/network/extensions/pop3/net.rb +65 -0
  76. data/lib/ronin/network/extensions/smtp.rb +24 -0
  77. data/lib/ronin/network/extensions/smtp/net.rb +80 -0
  78. data/lib/ronin/network/extensions/tcp.rb +24 -0
  79. data/lib/ronin/network/extensions/tcp/net.rb +94 -0
  80. data/lib/ronin/network/extensions/telnet.rb +24 -0
  81. data/lib/ronin/network/extensions/telnet/net.rb +132 -0
  82. data/lib/ronin/network/extensions/udp.rb +24 -0
  83. data/lib/ronin/network/extensions/udp/net.rb +99 -0
  84. data/lib/ronin/network/http.rb +128 -0
  85. data/lib/ronin/network/http/exceptions.rb +24 -0
  86. data/lib/ronin/network/http/exceptions/unknown_request.rb +31 -0
  87. data/lib/ronin/network/imap.rb +47 -0
  88. data/lib/ronin/network/pop3.rb +47 -0
  89. data/lib/ronin/network/smtp.rb +26 -0
  90. data/lib/ronin/network/smtp/email.rb +126 -0
  91. data/lib/ronin/network/smtp/smtp.rb +55 -0
  92. data/lib/ronin/network/tcp.rb +24 -0
  93. data/lib/ronin/network/telnet.rb +95 -0
  94. data/lib/ronin/network/udp.rb +24 -0
  95. data/lib/ronin/object_context.rb +257 -0
  96. data/lib/ronin/objects.rb +29 -0
  97. data/lib/ronin/parameters.rb +27 -0
  98. data/lib/ronin/parameters/class_param.rb +45 -0
  99. data/lib/ronin/parameters/exceptions.rb +25 -0
  100. data/lib/ronin/parameters/exceptions/missing_param.rb +29 -0
  101. data/lib/ronin/parameters/exceptions/param_not_found.rb +29 -0
  102. data/lib/ronin/parameters/instance_param.rb +57 -0
  103. data/lib/ronin/parameters/param.rb +45 -0
  104. data/lib/ronin/parameters/parameters.rb +275 -0
  105. data/lib/ronin/path.rb +70 -0
  106. data/lib/ronin/pending_context.rb +42 -0
  107. data/lib/ronin/persistence.rb +32 -0
  108. data/lib/ronin/platform.rb +95 -0
  109. data/lib/ronin/product.rb +56 -0
  110. data/lib/ronin/ronin.rb +49 -0
  111. data/lib/ronin/rpc.rb +27 -0
  112. data/lib/ronin/rpc/call.rb +75 -0
  113. data/lib/ronin/rpc/client.rb +91 -0
  114. data/lib/ronin/rpc/console.rb +79 -0
  115. data/lib/ronin/rpc/exceptions.rb +25 -0
  116. data/lib/ronin/rpc/exceptions/not_implemented.rb +29 -0
  117. data/lib/ronin/rpc/exceptions/response_missing.rb +29 -0
  118. data/lib/ronin/rpc/interactive.rb +55 -0
  119. data/lib/ronin/rpc/interactive_console.rb +58 -0
  120. data/lib/ronin/rpc/interactive_shell.rb +59 -0
  121. data/lib/ronin/rpc/response.rb +57 -0
  122. data/lib/ronin/rpc/service.rb +69 -0
  123. data/lib/ronin/rpc/shell.rb +66 -0
  124. data/lib/ronin/runner.rb +24 -0
  125. data/lib/ronin/runner/program.rb +26 -0
  126. data/lib/ronin/runner/program/command.rb +204 -0
  127. data/lib/ronin/runner/program/commands.rb +33 -0
  128. data/lib/ronin/runner/program/commands/add.rb +73 -0
  129. data/lib/ronin/runner/program/commands/help.rb +52 -0
  130. data/lib/ronin/runner/program/commands/install.rb +65 -0
  131. data/lib/ronin/runner/program/commands/list.rb +81 -0
  132. data/lib/ronin/runner/program/commands/remove.rb +57 -0
  133. data/lib/ronin/runner/program/commands/uninstall.rb +57 -0
  134. data/lib/ronin/runner/program/commands/update.rb +55 -0
  135. data/lib/ronin/runner/program/exceptions.rb +24 -0
  136. data/lib/ronin/runner/program/exceptions/unknown_command.rb +31 -0
  137. data/lib/ronin/runner/program/options.rb +205 -0
  138. data/lib/ronin/runner/program/program.rb +173 -0
  139. data/lib/ronin/runner/program/runner.rb +35 -0
  140. data/lib/ronin/sessions.rb +32 -0
  141. data/lib/ronin/sessions/esmtp.rb +76 -0
  142. data/lib/ronin/sessions/imap.rb +73 -0
  143. data/lib/ronin/sessions/pop3.rb +70 -0
  144. data/lib/ronin/sessions/session.rb +52 -0
  145. data/lib/ronin/sessions/smtp.rb +76 -0
  146. data/lib/ronin/sessions/tcp.rb +111 -0
  147. data/lib/ronin/sessions/telnet.rb +76 -0
  148. data/lib/ronin/sessions/udp.rb +99 -0
  149. data/lib/ronin/sessions/web.rb +83 -0
  150. data/lib/ronin/shell.rb +81 -0
  151. data/lib/ronin/target.rb +40 -0
  152. data/lib/ronin/version.rb +27 -0
  153. data/lib/ronin/web.rb +24 -0
  154. data/lib/ronin/web/web.rb +265 -0
  155. data/spec/spec_helper.rb +9 -0
  156. data/tasks/spec.rb +7 -0
  157. metadata +324 -0
@@ -0,0 +1,52 @@
1
+ #
2
+ #--
3
+ # Ronin - A ruby development platform designed for information security
4
+ # and data exploration tasks.
5
+ #
6
+ # Copyright (c) 2006-2008 Hal Brodigan (postmodern.mod3 at gmail.com)
7
+ #
8
+ # This program is free software; you can redistribute it and/or modify
9
+ # it under the terms of the GNU General Public License as published by
10
+ # the Free Software Foundation; either version 2 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # This program is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with this program; if not, write to the Free Software
20
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
+ #++
22
+ #
23
+
24
+ require 'ronin/parameters'
25
+
26
+ module Ronin
27
+ module Sessions
28
+ module Session
29
+ #
30
+ # Includes Parameters and runs the _block_ in the specified
31
+ # _base_class_.
32
+ #
33
+ def Session.setup_class(base_class,&block)
34
+ base_class.module_eval { include Parameters }
35
+ base_class.module_eval(&block)
36
+
37
+ return base_class
38
+ end
39
+
40
+ #
41
+ # Extends Parameters and runs the specified _block_ in the specified
42
+ # _obj_.
43
+ #
44
+ def Session.setup_object(obj,&block)
45
+ obj.extend(Parameters)
46
+ obj.instance_eval(&block)
47
+
48
+ return obj
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,76 @@
1
+ #
2
+ #--
3
+ # Ronin - A ruby development platform designed for information security
4
+ # and data exploration tasks.
5
+ #
6
+ # Copyright (c) 2006-2008 Hal Brodigan (postmodern.mod3 at gmail.com)
7
+ #
8
+ # This program is free software; you can redistribute it and/or modify
9
+ # it under the terms of the GNU General Public License as published by
10
+ # the Free Software Foundation; either version 2 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # This program is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with this program; if not, write to the Free Software
20
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
+ #++
22
+ #
23
+
24
+ require 'ronin/sessions/session'
25
+ require 'ronin/network/smtp'
26
+
27
+ module Ronin
28
+ module Sessions
29
+ module SMTP
30
+ include Session
31
+
32
+ SMTP_SESSION = proc do
33
+ parameter :smtp_host, :description => 'SMTP host'
34
+ parameter :smtp_port, :description => 'SMTP port'
35
+
36
+ parameter :smtp_login, :description => 'SMTP login'
37
+ parameter :smtp_user, :description => 'SMTP user'
38
+ parameter :smtp_password, :description => 'SMTP password'
39
+ end
40
+
41
+ def self.included(base)
42
+ Session.setup_class(base,&SMTP_SESSION)
43
+ end
44
+
45
+ def self.extended(obj)
46
+ Session.setup_object(obj,&SMTP_SESSION)
47
+ end
48
+
49
+ protected
50
+
51
+ def smtp_message(options={},&block)
52
+ Network::SMTP.message(options,&block)
53
+ end
54
+
55
+ def smtp_connect(options={},&block)
56
+ unless @smtp_host
57
+ raise(ParamNotFound,"Missing parameter #{describe_param(:smtp_host).dump}",caller)
58
+ end
59
+
60
+ options[:port] ||= @smtp_port
61
+ options[:login] ||= @smtp_login
62
+ options[:user] ||= @smtp_user
63
+ options[:password] ||= @smtp_password
64
+
65
+ return ::Net.smtp_connect(@smtp_host,options,&block)
66
+ end
67
+
68
+ def smtp_session(options={},&block)
69
+ smtp_connect(options) do |sess|
70
+ block.call(sess) if block
71
+ sess.close
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,111 @@
1
+ #
2
+ #--
3
+ # Ronin - A ruby development platform designed for information security
4
+ # and data exploration tasks.
5
+ #
6
+ # Copyright (c) 2006-2008 Hal Brodigan (postmodern.mod3 at gmail.com)
7
+ #
8
+ # This program is free software; you can redistribute it and/or modify
9
+ # it under the terms of the GNU General Public License as published by
10
+ # the Free Software Foundation; either version 2 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # This program is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with this program; if not, write to the Free Software
20
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
+ #++
22
+ #
23
+
24
+ require 'ronin/sessions/session'
25
+ require 'ronin/network/tcp'
26
+
27
+ module Ronin
28
+ module Sessions
29
+ module TCP
30
+ include Session
31
+
32
+ TCP_SESSION = proc do
33
+ parameter :lhost, :description => 'TCP local host'
34
+ parameter :lport, :description => 'TCP local port'
35
+
36
+ parameter :rhost, :description => 'TCP remote host'
37
+ parameter :rport, :description => 'TCP remote port'
38
+ end
39
+
40
+ def self.included(base)
41
+ Session.setup_class(base,&TCP_SESSION)
42
+ end
43
+
44
+ def self.extended(obj)
45
+ Session.setup_object(obj,&TCP_SESSION)
46
+ end
47
+
48
+ protected
49
+
50
+ def tcp_connect(&block)
51
+ unless @rhost
52
+ raise(ParamNotFound,"Missing parameter '#{describe_param(:rhost)}'",caller)
53
+ end
54
+
55
+ unless @rport
56
+ raise(ParamNotFound,"Missing parameter '#{describe_param(:rport)}'",caller)
57
+ end
58
+
59
+ return ::Net.tcp_connect(@rhost,@rport,@lhost,@lport,&block)
60
+ end
61
+
62
+ def tcp_connect_and_recv(&block)
63
+ unless @rhost
64
+ raise(ParamNotFound,"Missing parameter '#{describe_param(:rhost)}'",caller)
65
+ end
66
+
67
+ unless @rport
68
+ raise(ParamNotFound,"Missing parameter '#{describe_param(:rport)}'",caller)
69
+ end
70
+
71
+ return ::Net.tcp_connect_and_recv(@rhost,@rport,@lhost,@lport,&block)
72
+ end
73
+
74
+ def tcp_connect_and_send(data,&block)
75
+ unless @rhost
76
+ raise(ParamNotFound,"Missing parameter '#{describe_param(:rhost)}'",caller)
77
+ end
78
+
79
+ unless @rport
80
+ raise(ParamNotFound,"Missing parameter '#{describe_param(:rport)}'",caller)
81
+ end
82
+
83
+ return ::Net.tcp_connect_and_send(data,@rhost,@rport,@lhost,@lport,&block)
84
+ end
85
+
86
+ def tcp_session(&block)
87
+ unless @rhost
88
+ raise(ParamNotFound,"Missing parameter '#{describe_param(:rhost)}'",caller)
89
+ end
90
+
91
+ unless @rport
92
+ raise(ParamNotFound,"Missing parameter '#{describe_param(:rport)}'",caller)
93
+ end
94
+
95
+ return Net.tcp_session(@rhost,@rport,@lhost,@lport,&block)
96
+ end
97
+
98
+ def tcp_banner(&block)
99
+ unless @rhost
100
+ raise(ParamNotFound,"Missing parameter '#{describe_param(:rhost)}'",caller)
101
+ end
102
+
103
+ unless @rport
104
+ raise(ParamNotFound,"Missing parameter '#{describe_param(:rport)}'",caller)
105
+ end
106
+
107
+ return ::Net.tcp_banner(@rhost,@rport,@lhost,@lport,&block)
108
+ end
109
+ end
110
+ end
111
+ end
@@ -0,0 +1,76 @@
1
+ #
2
+ #--
3
+ # Ronin - A ruby development platform designed for information security
4
+ # and data exploration tasks.
5
+ #
6
+ # Copyright (c) 2006-2008 Hal Brodigan (postmodern.mod3 at gmail.com)
7
+ #
8
+ # This program is free software; you can redistribute it and/or modify
9
+ # it under the terms of the GNU General Public License as published by
10
+ # the Free Software Foundation; either version 2 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # This program is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with this program; if not, write to the Free Software
20
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
+ #++
22
+ #
23
+
24
+ require 'ronin/sessions/session'
25
+ require 'ronin/network/telnet'
26
+
27
+ module Ronin
28
+ module Sessions
29
+ module TELNET
30
+ include Session
31
+
32
+ TELNET_SESSION = proc do
33
+ parameter :telnet_host, :description => 'Telnet host'
34
+ parameter :telnet_port, :value => Network::Telnet.default_port, :description => 'Telnet port'
35
+
36
+ parameter :telnet_user, :description => 'Telnet user'
37
+ parameter :telnet_password, :description => 'Telnet password'
38
+
39
+ parameter :telnet_proxy, :description => 'Telnet proxy'
40
+ parameter :telnet_ssl, :description => 'Telnet SSL options'
41
+ end
42
+
43
+ def self.included(base)
44
+ Session.setup_class(base,&TELNET_SESSION)
45
+ end
46
+
47
+ def self.extended(obj)
48
+ Session.setup_object(obj,&TELNET_SESSION)
49
+ end
50
+
51
+ protected
52
+
53
+ def telnet_connect(options={},&block)
54
+ unless @telnet_host
55
+ raise(ParamNotFound,"Missing parameter '#{describe_param(:telnet_host)}'",caller)
56
+ end
57
+
58
+ options[:port] ||= @telnet_port
59
+ options[:user] ||= @telnet_user
60
+ options[:password] ||= @telnet_password
61
+
62
+ options[:proxy] ||= @telnet_proxy
63
+ options[:ssl] ||= @telnet_ssl
64
+
65
+ return ::Net.telnet_connect(@telnet_host,options,&block)
66
+ end
67
+
68
+ def telnet_session(options={},&block)
69
+ return telnet_connect(options) do |sess|
70
+ block.call(sess) if block
71
+ sess.close
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,99 @@
1
+ #
2
+ #--
3
+ # Ronin - A ruby development platform designed for information security
4
+ # and data exploration tasks.
5
+ #
6
+ # Copyright (c) 2006-2008 Hal Brodigan (postmodern.mod3 at gmail.com)
7
+ #
8
+ # This program is free software; you can redistribute it and/or modify
9
+ # it under the terms of the GNU General Public License as published by
10
+ # the Free Software Foundation; either version 2 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # This program is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with this program; if not, write to the Free Software
20
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
+ #++
22
+ #
23
+
24
+ require 'ronin/sessions/session'
25
+ require 'ronin/network/udp'
26
+
27
+ module Ronin
28
+ module Sessions
29
+ module UDP
30
+ include Parameters
31
+
32
+ UDP_SESSION = proc do
33
+ parameter :lhost, :description => 'local host'
34
+ parameter :lport, :description => 'local port'
35
+
36
+ parameter :rhost, :description => 'remote host'
37
+ parameter :rport, :description => 'remote port'
38
+ end
39
+
40
+ def self.included(base)
41
+ Session.setup_class(base,&UDP_SESSION)
42
+ end
43
+
44
+ def self.extended(obj)
45
+ Session.setup_object(obj,&UDP_SESSION)
46
+ end
47
+
48
+ protected
49
+
50
+ def udp_connect(&block)
51
+ unless @rhost
52
+ raise(ParamNotFound,"Missing '#{describe_param(:rhost)}' parameter",caller)
53
+ end
54
+
55
+ unless @rport
56
+ raise(ParamNotFound,"Missing '#{describe_param(:rport)}' parameter",caller)
57
+ end
58
+
59
+ return ::Net.udp_connect(@rhost,@rport,@lhost,@lport,&block)
60
+ end
61
+
62
+ def udp_connect_and_recv(&block)
63
+ unless @rhost
64
+ raise(ParamNotFound,"Missing '#{describe_param(:rhost)}' parameter",caller)
65
+ end
66
+
67
+ unless @rport
68
+ raise(ParamNotFound,"Missing '#{describe_param(:rport)}' parameter",caller)
69
+ end
70
+
71
+ return ::Net.udp_connect_and_recv(@rhost,@rport,@lhost,@lport,&block)
72
+ end
73
+
74
+ def udp_connect_and_send(data,&block)
75
+ unless @rhost
76
+ raise(ParamNotFound,"Missing '#{describe_param(:rhost)}' parameter",caller)
77
+ end
78
+
79
+ unless @rport
80
+ raise(ParamNotFound,"Missing '#{describe_param(:rport)}' parameter",caller)
81
+ end
82
+
83
+ return ::Net.udp_connect_and_send(data,@rhost,@rport,@lhost,@lport,&block)
84
+ end
85
+
86
+ def udp_session(&block)
87
+ unless @rhost
88
+ raise(ParamNotFound,"Missing parameter '#{describe_param(:rhost)}'",caller)
89
+ end
90
+
91
+ unless @rport
92
+ raise(ParamNotFound,"Missing parameter '#{describe_param(:rport)}'",caller)
93
+ end
94
+
95
+ return ::Net.udp_session(@rhost,@rport,@lhost,@lport,&block)
96
+ end
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,83 @@
1
+ #
2
+ #--
3
+ # Ronin - A ruby development platform designed for information security
4
+ # and data exploration tasks.
5
+ #
6
+ # Copyright (c) 2006-2008 Hal Brodigan (postmodern.mod3 at gmail.com)
7
+ #
8
+ # This program is free software; you can redistribute it and/or modify
9
+ # it under the terms of the GNU General Public License as published by
10
+ # the Free Software Foundation; either version 2 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # This program is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with this program; if not, write to the Free Software
20
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
+ #++
22
+ #
23
+
24
+ require 'ronin/sessions/session'
25
+ require 'ronin/web'
26
+
27
+ module Ronin
28
+ module Sessions
29
+ module Web
30
+ include Session
31
+
32
+ WEB_SESSION = proc do
33
+ parameter :web_proxy, :value => Ronin::Web.proxy, :description => 'Web Proxy'
34
+ parameter :web_user_agent, :value => Ronin::Web.user_agent, :description => 'Web User-Agent'
35
+ end
36
+
37
+ def self.included(base)
38
+ Session.setup_class(base,&WEB_SESSION)
39
+ end
40
+
41
+ def self.extended(obj)
42
+ Session.setup_object(obj,&WEB_SESSION)
43
+ end
44
+
45
+ protected
46
+
47
+ def web_agent(options={},&block)
48
+ options[:proxy] ||= @web_proxy
49
+ options[:user_agent] ||= @web_user_agent
50
+
51
+ return Ronin::Web.agent(options,&block)
52
+ end
53
+
54
+ def web_get(uri,options={},&block)
55
+ page = web_agent(options).get(uri)
56
+
57
+ block.call(page) if block
58
+ return page
59
+ end
60
+
61
+ def web_get_body(uri,options={},&block)
62
+ body = web_agent(options).get(uri).body
63
+
64
+ block.call(body) if block
65
+ return body
66
+ end
67
+
68
+ def web_post(uri,options={},&block)
69
+ page = web_agent(options).post(uri)
70
+
71
+ block.call(page) if block
72
+ return page
73
+ end
74
+
75
+ def web_post_body(uri,options={},&block)
76
+ body = web_agent(options).post(uri).body
77
+
78
+ block.call(body) if block
79
+ return body
80
+ end
81
+ end
82
+ end
83
+ end