buby 1.3.3-java → 1.5.0-java
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +28 -14
- data/Rakefile +96 -6
- data/VERSION.yml +5 -0
- data/bin/buby +2 -0
- data/buby.gemspec +102 -17
- data/{java/src → ext/buby/burp}/BurpExtender.java +189 -29
- data/ext/burp_interfaces/burp/IBurpExtender.java +31 -0
- data/ext/burp_interfaces/burp/IBurpExtenderCallbacks.java +785 -0
- data/ext/burp_interfaces/burp/IContextMenuFactory.java +38 -0
- data/ext/burp_interfaces/burp/IContextMenuInvocation.java +156 -0
- data/ext/burp_interfaces/burp/ICookie.java +53 -0
- data/ext/burp_interfaces/burp/IExtensionHelpers.java +352 -0
- data/ext/burp_interfaces/burp/IExtensionStateListener.java +27 -0
- data/ext/burp_interfaces/burp/IHttpListener.java +37 -0
- data/ext/burp_interfaces/burp/IHttpRequestResponse.java +102 -0
- data/ext/burp_interfaces/burp/IHttpRequestResponsePersisted.java +26 -0
- data/ext/burp_interfaces/burp/IHttpRequestResponseWithMarkers.java +44 -0
- data/ext/burp_interfaces/burp/IHttpService.java +39 -0
- data/ext/burp_interfaces/burp/IInterceptedProxyMessage.java +116 -0
- data/ext/burp_interfaces/burp/IIntruderAttack.java +31 -0
- data/ext/burp_interfaces/burp/IIntruderPayloadGenerator.java +50 -0
- data/ext/burp_interfaces/burp/IIntruderPayloadGeneratorFactory.java +40 -0
- data/ext/burp_interfaces/burp/IIntruderPayloadProcessor.java +45 -0
- data/{java/src → ext/burp_interfaces}/burp/IMenuItemHandler.java +36 -40
- data/ext/burp_interfaces/burp/IMessageEditor.java +64 -0
- data/ext/burp_interfaces/burp/IMessageEditorController.java +49 -0
- data/ext/burp_interfaces/burp/IMessageEditorTab.java +102 -0
- data/ext/burp_interfaces/burp/IMessageEditorTabFactory.java +38 -0
- data/ext/burp_interfaces/burp/IParameter.java +104 -0
- data/ext/burp_interfaces/burp/IProxyListener.java +37 -0
- data/ext/burp_interfaces/burp/IRequestInfo.java +95 -0
- data/ext/burp_interfaces/burp/IResponseInfo.java +54 -0
- data/ext/burp_interfaces/burp/IScanIssue.java +120 -0
- data/ext/burp_interfaces/burp/IScanQueueItem.java +80 -0
- data/ext/burp_interfaces/burp/IScannerCheck.java +89 -0
- data/ext/burp_interfaces/burp/IScannerInsertionPoint.java +156 -0
- data/ext/burp_interfaces/burp/IScannerInsertionPointProvider.java +38 -0
- data/ext/burp_interfaces/burp/IScannerListener.java +30 -0
- data/ext/burp_interfaces/burp/IScopeChangeListener.java +25 -0
- data/ext/burp_interfaces/burp/ISessionHandlingAction.java +51 -0
- data/ext/burp_interfaces/burp/ITab.java +38 -0
- data/ext/burp_interfaces/burp/ITempFile.java +33 -0
- data/ext/burp_interfaces/burp/ITextEditor.java +90 -0
- data/lib/buby/burp_extender/console_frame.rb +33 -0
- data/lib/buby/burp_extender/console_pane.rb +26 -0
- data/lib/buby/burp_extender/console_tab.rb +15 -0
- data/lib/buby/burp_extender/context_menu.rb +29 -0
- data/lib/buby/burp_extender/context_menu_factory.rb +17 -0
- data/lib/buby/burp_extender/context_menu_item.rb +13 -0
- data/lib/buby/burp_extender/jcheck_box_menu_item.rb +12 -0
- data/lib/buby/burp_extender/jmenu.rb +11 -0
- data/lib/buby/burp_extender/jmenu_item.rb +12 -0
- data/lib/buby/burp_extender/menu.rb +11 -0
- data/lib/buby/burp_extender/menu_item.rb +12 -0
- data/lib/buby/burp_extender.rb +339 -0
- data/lib/buby/context_menu_factory.rb +35 -0
- data/lib/buby/cookie.rb +37 -0
- data/lib/buby/extender.rb +156 -0
- data/lib/buby/http_listener.rb +29 -0
- data/lib/buby/{extends → implants}/buby_array_wrapper.rb +0 -0
- data/lib/buby/implants/context_menu_invocation.rb +113 -0
- data/lib/buby/implants/cookie.rb +47 -0
- data/lib/buby/implants/extension_helpers.rb +286 -0
- data/lib/buby/{extends → implants}/http_request_response.rb +8 -1
- data/lib/buby/implants/intercepted_proxy_message.rb +53 -0
- data/lib/buby/implants/intruder_attack.rb +42 -0
- data/lib/buby/implants/jruby.rb +64 -0
- data/lib/buby/implants/message_editor.rb +70 -0
- data/lib/buby/implants/message_editor_controller.rb +60 -0
- data/lib/buby/implants/parameter.rb +84 -0
- data/lib/buby/implants/request_info.rb +47 -0
- data/lib/buby/implants/response_info.rb +44 -0
- data/lib/buby/{extends → implants}/scan_issue.rb +1 -2
- data/lib/buby/implants/scan_queue_item.rb +53 -0
- data/lib/buby/implants/scanner_insertion_point.rb +92 -0
- data/lib/buby/implants/temp_file.rb +43 -0
- data/lib/buby/implants/text_editor.rb +63 -0
- data/lib/buby/implants.rb +28 -0
- data/lib/buby/intruder_payload_generator.rb +60 -0
- data/lib/buby/intruder_payload_generator_factory.rb +32 -0
- data/lib/buby/intruder_payload_processor.rb +38 -0
- data/lib/buby/message_editor_controller.rb +41 -0
- data/lib/buby/message_editor_tab.rb +98 -0
- data/lib/buby/message_editor_tab_factory.rb +28 -0
- data/lib/buby/parameter/base.rb +40 -0
- data/lib/buby/parameter/body.rb +7 -0
- data/lib/buby/parameter/cookie.rb +7 -0
- data/lib/buby/parameter/url.rb +7 -0
- data/lib/buby/parameter.rb +15 -0
- data/lib/buby/proxy_listener.rb +26 -0
- data/lib/buby/scan_issue.rb +112 -0
- data/lib/buby/scanner_check.rb +84 -0
- data/lib/buby/scanner_insertion_point.rb +118 -0
- data/lib/buby/scanner_insertion_point_provider.rb +27 -0
- data/lib/buby/scanner_listener.rb +22 -0
- data/lib/buby/scope_change_listener.rb +19 -0
- data/lib/buby/session_handling_action.rb +43 -0
- data/lib/buby/tab.rb +37 -0
- data/lib/buby/version.rb +9 -0
- data/lib/buby.rb +892 -101
- metadata +118 -22
- data/VERSION +0 -1
- data/java/buby.jar +0 -0
- data/java/src/burp/IBurpExtender.java +0 -180
- data/java/src/burp/IBurpExtenderCallbacks.java +0 -373
- data/java/src/burp/IHttpRequestResponse.java +0 -156
- data/java/src/burp/IScanIssue.java +0 -106
- data/java/src/burp/IScanQueueItem.java +0 -76
- data/lib/buby/extends.rb +0 -4
@@ -1,7 +1,9 @@
|
|
1
1
|
require 'uri'
|
2
2
|
|
3
3
|
class Buby
|
4
|
+
# @todo bring IHttpRequestResponse into the now.
|
4
5
|
|
6
|
+
# @deprecated no longer needed in JRuby
|
5
7
|
class HttpRequestResponseList < BubyArrayWrapper
|
6
8
|
def initialize(obj)
|
7
9
|
HttpRequestResponseHelper.implant(obj[0]) if obj.size > 0
|
@@ -10,11 +12,15 @@ class Buby
|
|
10
12
|
|
11
13
|
end
|
12
14
|
|
13
|
-
|
15
|
+
# @deprecated This will change to the new Buby::Implants style in the next
|
16
|
+
# release. The interface methods will be overwritten to be Ruby-like
|
17
|
+
# themselves. If the standard Java implententation is still desired, use the
|
18
|
+
# +__method+ version (e.g. +#__response+ or +#__request+).
|
14
19
|
module HttpRequestResponseHelper
|
15
20
|
|
16
21
|
# returns the response as a Ruby String object - returns an empty string
|
17
22
|
# if response is nil.
|
23
|
+
# @deprecated
|
18
24
|
def response_str
|
19
25
|
return response().nil? ? "" : ::String.from_java_bytes(response())
|
20
26
|
end
|
@@ -45,6 +51,7 @@ class Buby
|
|
45
51
|
|
46
52
|
# Returns the full request as a Ruby String - returns an empty string if
|
47
53
|
# request is nil.
|
54
|
+
# @deprecated
|
48
55
|
def request_str
|
49
56
|
return request().nil? ? "" : ::String.from_java_bytes(request())
|
50
57
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
class Buby
|
2
|
+
module Implants
|
3
|
+
|
4
|
+
# This interface is used to represent an HTTP message that has been
|
5
|
+
# intercepted by Burp Proxy. Extensions can register an +IProxyListener+ to
|
6
|
+
# receive details of proxy messages using this interface.
|
7
|
+
#
|
8
|
+
module InterceptedProxyMessage
|
9
|
+
FOLLOW_RULES = Java::Burp::IInterceptedProxyMessage::ACTION_FOLLOW_RULES
|
10
|
+
DO_INTERCEPT = Java::Burp::IInterceptedProxyMessage::ACTION_DO_INTERCEPT
|
11
|
+
DONT_INTERCEPT = Java::Burp::IInterceptedProxyMessage::ACTION_DONT_INTERCEPT
|
12
|
+
DROP = Java::Burp::IInterceptedProxyMessage::ACTION_DROP
|
13
|
+
FOLLOW_RULES_AND_REHOOK = Java::Burp::IInterceptedProxyMessage::ACTION_FOLLOW_RULES_AND_REHOOK
|
14
|
+
DO_INTERCEPT_AND_REHOOK = Java::Burp::IInterceptedProxyMessage::ACTION_DO_INTERCEPT_AND_REHOOK
|
15
|
+
DONT_INTERCEPT_AND_REHOOK = Java::Burp::IInterceptedProxyMessage::ACTION_DONT_INTERCEPT_AND_REHOOK
|
16
|
+
|
17
|
+
# This method retrieves details of the intercepted message.
|
18
|
+
#
|
19
|
+
# @return [IHttpRequestResponse] object containing details of the
|
20
|
+
# intercepted message.
|
21
|
+
#
|
22
|
+
# @todo IHttpRequestResponse
|
23
|
+
def getMessageInfo
|
24
|
+
__getMessageInfo.tap{|msg| Buby::HttpRequestResponseHelper.implant(msg)}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Install ourselves into the current +IInterceptedProxyMessage+ java class
|
28
|
+
# @param [IInterceptedProxyMessage] message
|
29
|
+
#
|
30
|
+
def self.implant(message)
|
31
|
+
unless message.implanted? || message.nil?
|
32
|
+
pp [:implanting, message, message.class] if $DEBUG
|
33
|
+
message.class.class_exec(message) do |message|
|
34
|
+
a_methods = %w{
|
35
|
+
getMessageInfo
|
36
|
+
}
|
37
|
+
a_methods.each do |meth|
|
38
|
+
alias_method "__"+meth.to_s, meth
|
39
|
+
end
|
40
|
+
include Buby::Implants::InterceptedProxyMessage
|
41
|
+
a_methods.each do |meth|
|
42
|
+
java_class.ruby_names_for_java_method(meth).each do |ruby_meth|
|
43
|
+
define_method ruby_meth, Buby::Implants::InterceptedProxyMessage.instance_method(meth)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
include Buby::Implants::Proxy
|
47
|
+
end
|
48
|
+
end
|
49
|
+
message
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
class Buby
|
2
|
+
module Implants
|
3
|
+
# This interface is used to hold details about an Intruder attack.
|
4
|
+
#
|
5
|
+
module IntruderAttack
|
6
|
+
# This method is used to retrieve the request template for the attack.
|
7
|
+
#
|
8
|
+
# @return [String] The request template for the attack.
|
9
|
+
#
|
10
|
+
def getRequestTemplate
|
11
|
+
pp [:got_getRequestTemplate] if $DEBUG
|
12
|
+
String.from_java_bytes __getRequestTemplate
|
13
|
+
end
|
14
|
+
|
15
|
+
# Install ourselves into the current +IIntruderAttack+ java class
|
16
|
+
# @param [IIntruderAttack] attack
|
17
|
+
#
|
18
|
+
def self.implant(attack)
|
19
|
+
unless attack.implanted? || attack.nil?
|
20
|
+
pp [:implanting, attack, attack.class] if $DEBUG
|
21
|
+
attack.class.class_exec(attack) do |attack|
|
22
|
+
a_methods = %w{
|
23
|
+
getRequestTemplate
|
24
|
+
}
|
25
|
+
a_methods.each do |meth|
|
26
|
+
alias_method "__"+meth.to_s, meth
|
27
|
+
end
|
28
|
+
include Buby::Implants::IntruderAttack
|
29
|
+
a_methods.each do |meth|
|
30
|
+
java_class.ruby_names_for_java_method(meth).each do |ruby_meth|
|
31
|
+
define_method ruby_meth, Buby::Implants::IntruderAttack.instance_method(meth)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
include Buby::Implants::Proxy
|
35
|
+
end
|
36
|
+
end
|
37
|
+
attack
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
class Buby
|
2
|
+
module Implants
|
3
|
+
module Object
|
4
|
+
def implanted?(klass = nil)
|
5
|
+
self.class.ancestors.include?(klass)
|
6
|
+
end
|
7
|
+
|
8
|
+
def unique_methods regular = true
|
9
|
+
klass = self.class
|
10
|
+
meths = self.methods regular
|
11
|
+
while (klass != ::Object)
|
12
|
+
meths -= JRuby.reference(klass).getMethods.each_with_object([]){|meth, arr| arr << meth.first.intern if meth.last.kind_of?(Java::OrgJrubyInternalRuntimeMethods::AliasMethod)}
|
13
|
+
klass = klass.superclass
|
14
|
+
end
|
15
|
+
meths
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
unless [].respond_to?(:each_with_object)
|
20
|
+
module Enumerable
|
21
|
+
# XXX backport for 1.8.7
|
22
|
+
def each_with_object(memo)
|
23
|
+
inject(memo) do |memo, item|
|
24
|
+
yield item, memo
|
25
|
+
memo
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
module JavaClass
|
32
|
+
def ruby_names_for_java_method meth
|
33
|
+
self_java_ref = JRuby.reference(self).javaClass
|
34
|
+
target_methods = self_java_ref.getMethods.group_by{|jmeth| jmeth.name}[meth.to_s]
|
35
|
+
Java::OrgJrubyJavasupport::JavaUtil.getRubyNamesForJavaName(target_methods.first.name, target_methods)
|
36
|
+
end
|
37
|
+
|
38
|
+
# copies wrapper_id method to java_id and all ruby-like aliases
|
39
|
+
# used to re-attach java method proxies to new call wrapper
|
40
|
+
#
|
41
|
+
# @param java_id target java method (the original java method name)
|
42
|
+
def rewrap_java_method java_id
|
43
|
+
ruby_names_for_java_method(java_id).each do |ruby_name|
|
44
|
+
alias_method(ruby_name, java_id) unless wrapper_id == ruby_name
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
class Object
|
52
|
+
include Buby::Implants::Object
|
53
|
+
end
|
54
|
+
|
55
|
+
module Enumerable
|
56
|
+
include Buby::Implants::Enumerable unless [].respond_to?(:each_with_object)
|
57
|
+
end
|
58
|
+
|
59
|
+
module Java
|
60
|
+
class JavaClass
|
61
|
+
include Buby::Implants::JavaClass
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
@@ -0,0 +1,70 @@
|
|
1
|
+
class Buby
|
2
|
+
module Implants
|
3
|
+
# This interface is used to provide extensions with an instance of Burp's
|
4
|
+
# HTTP message editor, for the extension to use in its own UI. Extensions
|
5
|
+
# should call {Buby#createMessageEditor} to obtain an instance of this
|
6
|
+
# interface.
|
7
|
+
#
|
8
|
+
module MessageEditor
|
9
|
+
# This method is used to display an HTTP message in the editor.
|
10
|
+
#
|
11
|
+
# @param [Array<byte>, String] message The HTTP message to be displayed.
|
12
|
+
# @param [Boolean] isRequest Flags whether the message is an HTTP request
|
13
|
+
# or response.
|
14
|
+
# @return [void]
|
15
|
+
#
|
16
|
+
def setMessage(message, isRequest)
|
17
|
+
message = message.to_java_bytes if message.respond_to? :to_java_bytes
|
18
|
+
message = message.to_java :byte if message.kind_of? Array
|
19
|
+
__setMessage(message, isRequest)
|
20
|
+
end
|
21
|
+
|
22
|
+
# This method is used to retrieve the currently displayed message, which
|
23
|
+
# may have been modified by the user.
|
24
|
+
#
|
25
|
+
# @return [String] The currently displayed HTTP message.
|
26
|
+
#
|
27
|
+
def getMessage
|
28
|
+
String.from_java_bytes __getMessage
|
29
|
+
end
|
30
|
+
|
31
|
+
# This method returns the data that is currently selected by the user.
|
32
|
+
#
|
33
|
+
# @return [String, nil] The data that is currently selected by the user,
|
34
|
+
# or +nil+ if no selection is made.
|
35
|
+
#
|
36
|
+
def getSelectedData
|
37
|
+
ret = __getSelectedData
|
38
|
+
ret ? String.from_java_bytes(ret) : ret
|
39
|
+
end
|
40
|
+
|
41
|
+
# Install ourselves into the current +IMessageEditor+ java class
|
42
|
+
# @param [IMessageEditor] editor
|
43
|
+
#
|
44
|
+
def self.implant(editor)
|
45
|
+
unless editor.implanted? || editor.nil?
|
46
|
+
pp [:implanting, editor, editor.class] if $DEBUG
|
47
|
+
editor.class.class_exec(editor) do |editor|
|
48
|
+
a_methods = %w{
|
49
|
+
setMessage
|
50
|
+
getMessage
|
51
|
+
getSelectedData
|
52
|
+
}
|
53
|
+
a_methods.each do |meth|
|
54
|
+
alias_method "__"+meth.to_s, meth
|
55
|
+
end
|
56
|
+
include Buby::Implants::MessageEditor
|
57
|
+
a_methods.each do |meth|
|
58
|
+
java_class.ruby_names_for_java_method(meth).each do |ruby_meth|
|
59
|
+
define_method ruby_meth, Buby::Implants::MessageEditor.instance_method(meth)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
include Buby::Implants::Proxy
|
63
|
+
end
|
64
|
+
end
|
65
|
+
editor
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
class Buby
|
2
|
+
module Implants
|
3
|
+
# This interface is used by an +IMessageEditor+ to obtain details about the
|
4
|
+
# currently displayed message. Extensions that create instances of Burp's
|
5
|
+
# HTTP message editor can optionally provide an implementation of
|
6
|
+
# +IMessageEditorController+, which the editor will invoke when it requires
|
7
|
+
# further information about the current message (for example, to send it to
|
8
|
+
# another Burp tool). Extensions that provide custom editor tabs via an
|
9
|
+
# +IMessageEditorTabFactory+ will receive a reference to an
|
10
|
+
# +IMessageEditorController+ object for each tab instance they generate,
|
11
|
+
# which the tab can invoke if it requires further information about the
|
12
|
+
# current message.
|
13
|
+
#
|
14
|
+
module MessageEditorController
|
15
|
+
# This method is used to retrieve the HTTP request associated with the
|
16
|
+
# current message (which may itself be a response).
|
17
|
+
#
|
18
|
+
# @return [String] The HTTP request associated with the current message.
|
19
|
+
#
|
20
|
+
def getRequest
|
21
|
+
String.from_java_bytes __getRequest
|
22
|
+
end
|
23
|
+
|
24
|
+
# This method is used to retrieve the HTTP response associated with the
|
25
|
+
# current message (which may itself be a request).
|
26
|
+
#
|
27
|
+
# @return [String] The HTTP response associated with the current message.
|
28
|
+
#
|
29
|
+
def getResponse
|
30
|
+
String.from_java_bytes __getResponse
|
31
|
+
end
|
32
|
+
|
33
|
+
# Install ourselves into the current +IMessageEditorController+ java class
|
34
|
+
# @param [IMessageEditorController] controller
|
35
|
+
#
|
36
|
+
def self.implant(controller)
|
37
|
+
unless controller.implanted? || controller.nil?
|
38
|
+
pp [:implanting, controller, controller.class] if $DEBUG
|
39
|
+
controller.class.class_exec(controller) do |controller|
|
40
|
+
a_methods = %w{
|
41
|
+
getRequest
|
42
|
+
getResponse
|
43
|
+
}
|
44
|
+
a_methods.each do |meth|
|
45
|
+
alias_method "__"+meth.to_s, meth
|
46
|
+
end
|
47
|
+
include Buby::Implants::MessageEditorController
|
48
|
+
a_methods.each do |meth|
|
49
|
+
java_class.ruby_names_for_java_method(meth).each do |ruby_meth|
|
50
|
+
define_method ruby_meth, Buby::Implants::MessageEditorController.instance_method(meth)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
include Buby::Implants::Proxy
|
54
|
+
end
|
55
|
+
end
|
56
|
+
controller
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
class Buby
|
2
|
+
module Implants
|
3
|
+
# This interface is used to hold details about an HTTP request parameter.
|
4
|
+
#
|
5
|
+
module Parameter
|
6
|
+
|
7
|
+
# This method is used to retrieve the start offset of the parameter name
|
8
|
+
# within the HTTP request.
|
9
|
+
#
|
10
|
+
# @return [Fixnum, nil] The start offset of the parameter name within
|
11
|
+
# the HTTP request, or +nil+ if the parameter is not associated with a
|
12
|
+
# specific request.
|
13
|
+
#
|
14
|
+
def getNameStart
|
15
|
+
ret = __getNameStart
|
16
|
+
ret == -1 ? nil : ret
|
17
|
+
end
|
18
|
+
|
19
|
+
# This method is used to retrieve the end offset of the parameter name
|
20
|
+
# within the HTTP request.
|
21
|
+
#
|
22
|
+
# @return [Fixnum, nil] The end offset of the parameter name within the
|
23
|
+
# HTTP request, or +nil+ if the parameter is not associated with a
|
24
|
+
# specific request.
|
25
|
+
#
|
26
|
+
def getNameEnd
|
27
|
+
ret = __getNameEnd
|
28
|
+
ret == -1 ? nil : ret
|
29
|
+
end
|
30
|
+
|
31
|
+
# This method is used to retrieve the start offset of the parameter
|
32
|
+
# value within the HTTP request.
|
33
|
+
#
|
34
|
+
# @return [Fixnum, nil] The start offset of the parameter value within
|
35
|
+
# the HTTP request, or +nil+ if the parameter is not associated with a
|
36
|
+
# specific request.
|
37
|
+
#
|
38
|
+
def getValueStart
|
39
|
+
ret = __getValueStart
|
40
|
+
ret == -1 ? nil : ret
|
41
|
+
end
|
42
|
+
|
43
|
+
# This method is used to retrieve the end offset of the parameter value
|
44
|
+
# within the HTTP request.
|
45
|
+
#
|
46
|
+
# @return [Fixnum, nil] The end offset of the parameter value within the
|
47
|
+
# HTTP request, or +nil+ if the parameter is not associated with a
|
48
|
+
# specific request.
|
49
|
+
#
|
50
|
+
def getValueEnd
|
51
|
+
ret = __getValueEnd
|
52
|
+
ret == -1 ? nil : ret
|
53
|
+
end
|
54
|
+
|
55
|
+
# Install ourselves into the current +IParameter+ java class
|
56
|
+
# @param [IParameter] parameter
|
57
|
+
#
|
58
|
+
def self.implant(parameter)
|
59
|
+
unless parameter.implanted? || parameter.nil?
|
60
|
+
pp [:implanting, parameter, parameter.class] if $DEBUG
|
61
|
+
parameter.class.class_exec(parameter) do |parameter|
|
62
|
+
a_methods = %w{
|
63
|
+
getNameStart
|
64
|
+
getNameEnd
|
65
|
+
getValueEnd
|
66
|
+
getValueStart
|
67
|
+
}
|
68
|
+
a_methods.each do |meth|
|
69
|
+
alias_method "__"+meth.to_s, meth
|
70
|
+
end
|
71
|
+
include Buby::Implants::Parameter
|
72
|
+
a_methods.each do |meth|
|
73
|
+
java_class.ruby_names_for_java_method(meth).each do |ruby_meth|
|
74
|
+
define_method ruby_meth, Buby::Implants::Parameter.instance_method(meth)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
include Buby::Implants::Proxy
|
78
|
+
end
|
79
|
+
end
|
80
|
+
parameter
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
class Buby
|
4
|
+
module Implants
|
5
|
+
# This interface is used to retrieve key details about an HTTP request.
|
6
|
+
# Extensions can obtain an +IRequestInfo+ object for a given request by
|
7
|
+
# calling {Buby#analyzeRequest}.
|
8
|
+
#
|
9
|
+
module RequestInfo
|
10
|
+
|
11
|
+
# This method is used to obtain the parameters contained in the request.
|
12
|
+
#
|
13
|
+
# @return [Array<IParameter>] The parameters contained in the request.
|
14
|
+
#
|
15
|
+
def getParameters
|
16
|
+
__getParameters.tap{|parm| Buby::Implants::Parameter.implant parm.first}
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
# Install ourselves into the current +IRequestInfo+ java class
|
21
|
+
# @param [IRequestInfo] info
|
22
|
+
#
|
23
|
+
def self.implant(info)
|
24
|
+
unless info.implanted? || info.nil?
|
25
|
+
pp [:implanting, info, info.class] if $DEBUG
|
26
|
+
info.class.class_exec(info) do |info|
|
27
|
+
a_methods = %w{
|
28
|
+
getParameters
|
29
|
+
}
|
30
|
+
a_methods.each do |meth|
|
31
|
+
alias_method "__"+meth.to_s, meth
|
32
|
+
end
|
33
|
+
include Buby::Implants::RequestInfo
|
34
|
+
a_methods.each do |meth|
|
35
|
+
java_class.ruby_names_for_java_method(meth).each do |ruby_meth|
|
36
|
+
define_method ruby_meth, Buby::Implants::RequestInfo.instance_method(meth)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
include Buby::Implants::Proxy
|
40
|
+
end
|
41
|
+
end
|
42
|
+
info
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|