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
@@ -0,0 +1,44 @@
|
|
1
|
+
class Buby
|
2
|
+
module Implants
|
3
|
+
# This interface is used to retrieve key details about an HTTP response.
|
4
|
+
# Extensions can obtain an +IResponseInfo+ object for a given response by calling
|
5
|
+
# <code>IExtensionHelpers.analyzeResponse()</code>.
|
6
|
+
#
|
7
|
+
module ResponseInfo
|
8
|
+
# This method is used to obtain details of the HTTP cookies set in the
|
9
|
+
# response.
|
10
|
+
#
|
11
|
+
# @return [ICookie] A list of +ICookie+ objects representing the cookies
|
12
|
+
# set in the response, if any.
|
13
|
+
#
|
14
|
+
def getCookies
|
15
|
+
__getCookies.tap{|cookies| Buby::Implants::Cookie.implant(cookies.first)}
|
16
|
+
end
|
17
|
+
|
18
|
+
# Install ourselves into the current +IResponseInfo+ java class
|
19
|
+
# @param [IResponseInfo] info
|
20
|
+
#
|
21
|
+
def self.implant(info)
|
22
|
+
unless info.implanted? || info.nil?
|
23
|
+
pp [:implanting, info, info.class] if $DEBUG
|
24
|
+
info.class.class_exec(info) do |info|
|
25
|
+
a_methods = %w{
|
26
|
+
getCookies
|
27
|
+
}
|
28
|
+
a_methods.each do |meth|
|
29
|
+
alias_method "__"+meth.to_s, meth
|
30
|
+
end
|
31
|
+
include Buby::Implants::ResponseInfo
|
32
|
+
a_methods.each do |meth|
|
33
|
+
java_class.ruby_names_for_java_method(meth).each do |ruby_meth|
|
34
|
+
define_method ruby_meth, Buby::Implants::ResponseInfo.instance_method(meth)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
include Buby::Implants::Proxy
|
38
|
+
end
|
39
|
+
end
|
40
|
+
info
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -1,15 +1,14 @@
|
|
1
1
|
require 'uri'
|
2
2
|
|
3
3
|
class Buby
|
4
|
-
|
5
4
|
class ScanIssuesList < BubyArrayWrapper
|
6
5
|
def initialize(obj)
|
7
6
|
ScanIssueHelper.implant(obj[0]) if obj.size > 0
|
8
7
|
super(obj)
|
9
8
|
end
|
10
|
-
|
11
9
|
end
|
12
10
|
|
11
|
+
# @deprecated this will change to the new style in the next release
|
13
12
|
module ScanIssueHelper
|
14
13
|
# Returns a Ruby URI object derived from the java.net.URL object
|
15
14
|
def uri
|
@@ -0,0 +1,53 @@
|
|
1
|
+
class Buby
|
2
|
+
module Implants
|
3
|
+
|
4
|
+
# This interface is used to retrieve details of items in the Burp Scanner
|
5
|
+
# active scan queue. Extensions can obtain references to scan queue items by
|
6
|
+
# calling {Buby#doActiveScan}.
|
7
|
+
#
|
8
|
+
module ScanQueueItem
|
9
|
+
|
10
|
+
# This method returns details of the issues generated for the scan queue
|
11
|
+
# item.
|
12
|
+
# @note different items within the scan queue may contain duplicated
|
13
|
+
# versions of the same issues - for example, if the same request has
|
14
|
+
# been scanned multiple times. Duplicated issues are consolidated in the
|
15
|
+
# main view of scan results. Extensions can register a
|
16
|
+
# {Buby::ScannerListener} to get details only of unique, newly
|
17
|
+
# discovered Scanner issues post-consolidation.
|
18
|
+
#
|
19
|
+
# @return [Array<IScanIssue>] Details of the issues generated for the scan
|
20
|
+
# queue item.
|
21
|
+
#
|
22
|
+
def getIssues
|
23
|
+
__getIssues.tap{|issues| Buby::ScanIssueHelper.implant issues.first}
|
24
|
+
end
|
25
|
+
|
26
|
+
# Install ourselves into the current +IScanQueueItem+ java class
|
27
|
+
# @param [IScanQueueItem] item
|
28
|
+
#
|
29
|
+
def self.implant(item)
|
30
|
+
unless item.implanted? || item.nil?
|
31
|
+
pp [:implanting, item, item.class] if $DEBUG
|
32
|
+
item.class.class_exec(item) do |item|
|
33
|
+
a_methods = %w{
|
34
|
+
getIssues
|
35
|
+
}
|
36
|
+
a_methods.each do |meth|
|
37
|
+
alias_method "__"+meth.to_s, meth
|
38
|
+
end
|
39
|
+
include Buby::Implants::ScanQueueItem
|
40
|
+
a_methods.each do |meth|
|
41
|
+
java_class.ruby_names_for_java_method(meth).each do |ruby_meth|
|
42
|
+
define_method ruby_meth, Buby::Implants::ScanQueueItem.instance_method(meth)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
include Buby::Implants::Proxy
|
46
|
+
end
|
47
|
+
end
|
48
|
+
item
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
class Buby
|
2
|
+
module Implants
|
3
|
+
|
4
|
+
# This interface is used to define an insertion point for use by active
|
5
|
+
# Scanner checks. Extensions can obtain instances of this interface by
|
6
|
+
# registering an +IScannerCheck+, or can create instances for use by Burp's
|
7
|
+
# own scan checks by registering an +IScannerInsertionPointProvider+.
|
8
|
+
#
|
9
|
+
module ScannerInsertionPoint
|
10
|
+
INS_PARAM_URL = 0x00;
|
11
|
+
INS_PARAM_BODY = 0x01;
|
12
|
+
INS_PARAM_COOKIE = 0x02;
|
13
|
+
INS_PARAM_XML = 0x03;
|
14
|
+
INS_PARAM_XML_ATTR = 0x04;
|
15
|
+
INS_PARAM_MULTIPART_ATTR = 0x05;
|
16
|
+
INS_PARAM_JSON = 0x06;
|
17
|
+
INS_PARAM_AMF = 0x07;
|
18
|
+
INS_HEADER = 0x20;
|
19
|
+
INS_URL_REST = 0x21;
|
20
|
+
INS_PARAM_NAME_URL = 0x22;
|
21
|
+
INS_PARAM_NAME_BODY = 0x23;
|
22
|
+
INS_USER_PROVIDED = 0x40;
|
23
|
+
INS_EXTENSION_PROVIDED = 0x41;
|
24
|
+
INS_UNKNOWN = 0x7f;
|
25
|
+
|
26
|
+
# This method is used to build a request with the specified payload placed
|
27
|
+
# into the insertion point. Any necessary adjustments to the
|
28
|
+
# Content-Length header will be made by the Scanner itself when the
|
29
|
+
# request is issued, and there is no requirement for the insertion point
|
30
|
+
# to do this.
|
31
|
+
#
|
32
|
+
# @note Burp's built-in scan checks do not apply any payload encoding
|
33
|
+
# (such as URL-encoding) when dealing with an extension-provided
|
34
|
+
# insertion point. Custom insertion points are responsible for
|
35
|
+
# performing any data encoding that is necessary given the nature and
|
36
|
+
# location of the insertion point.
|
37
|
+
#
|
38
|
+
# @param [String] payload The payload that should be placed into the
|
39
|
+
# insertion point.
|
40
|
+
# @return [String] The resulting request.
|
41
|
+
#
|
42
|
+
def buildRequest(payload)
|
43
|
+
String.from_java_bytes(__buildRequest(payload.to_java_bytes))
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
# This method is used to determine the offsets of the payload value within
|
48
|
+
# the request, when it is placed into the insertion point. Scan checks may
|
49
|
+
# invoke this method when reporting issues, so as to highlight the
|
50
|
+
# relevant part of the request within the UI.
|
51
|
+
#
|
52
|
+
# @param [String, Array<byte>] payload The payload that should be placed
|
53
|
+
# into the insertion point.
|
54
|
+
# @return [Array<Fixnum>, nil] An int[2] array containing the start and
|
55
|
+
# end offsets of the payload within the request, or +nil+ if this is not
|
56
|
+
# applicable (for example, where the insertion point places a payload
|
57
|
+
# into a serialized data structure, the raw payload may not literally
|
58
|
+
# appear anywhere within the resulting request).
|
59
|
+
#
|
60
|
+
def getPayloadOffsets(payload)
|
61
|
+
payload = payload.to_java_bytes if payload.respond_to? :to_java_bytes
|
62
|
+
__getPayloadOffsets(payload)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Install ourselves into the current +IScannerInsertionPoint+ java class
|
66
|
+
# @param [IScannerInsertionPoint] point
|
67
|
+
#
|
68
|
+
def self.implant(point)
|
69
|
+
unless point.implanted? || point.nil?
|
70
|
+
pp [:implanting, point, point.class] if $DEBUG
|
71
|
+
point.class.class_exec(point) do |point|
|
72
|
+
a_methods = %w{
|
73
|
+
buildRequest
|
74
|
+
getPayloadOffsets
|
75
|
+
}
|
76
|
+
a_methods.each do |meth|
|
77
|
+
alias_method "__"+meth.to_s, meth
|
78
|
+
end
|
79
|
+
include Buby::Implants::ScannerInsertionPoint
|
80
|
+
a_methods.each do |meth|
|
81
|
+
java_class.ruby_names_for_java_method(meth).each do |ruby_meth|
|
82
|
+
define_method ruby_meth, Buby::Implants::ScannerInsertionPoint.instance_method(meth)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
include Buby::Implants::Proxy
|
86
|
+
end
|
87
|
+
end
|
88
|
+
point
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
class Buby
|
2
|
+
module Implants
|
3
|
+
# This interface is used to hold details of a temporary file that has been
|
4
|
+
# created via a call to {Buby#saveToTempFile}.
|
5
|
+
#
|
6
|
+
module TempFile
|
7
|
+
# This method is used to retrieve the contents of the buffer that was
|
8
|
+
# saved in the temporary file.
|
9
|
+
#
|
10
|
+
# @return [String] The contents of the buffer that was saved in the
|
11
|
+
# temporary file.
|
12
|
+
#
|
13
|
+
def getBuffer
|
14
|
+
String.from_java_bytes __getBuffer
|
15
|
+
end
|
16
|
+
|
17
|
+
# Install ourselves into the current +ITempFile+ java class
|
18
|
+
# @param [ITempFile] file
|
19
|
+
#
|
20
|
+
def self.implant(file)
|
21
|
+
unless file.implanted? || file.nil?
|
22
|
+
pp [:implanting, file, file.class] if $DEBUG
|
23
|
+
file.class.class_exec(file) do |file|
|
24
|
+
a_methods = %w{
|
25
|
+
getBuffer
|
26
|
+
}
|
27
|
+
a_methods.each do |meth|
|
28
|
+
alias_method "__"+meth.to_s, meth
|
29
|
+
end
|
30
|
+
include Buby::Implants::TempFile
|
31
|
+
a_methods.each do |meth|
|
32
|
+
java_class.ruby_names_for_java_method(meth).each do |ruby_meth|
|
33
|
+
define_method ruby_meth, Buby::Implants::TempFile.instance_method(meth)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
include Buby::Implants::Proxy
|
37
|
+
end
|
38
|
+
end
|
39
|
+
file
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
class Buby
|
2
|
+
module Implants
|
3
|
+
# This interface is used to provide extensions with an instance of Burp's
|
4
|
+
# raw text editor, for the extension to use in its own UI. Extensions should
|
5
|
+
# call {Buby#createTextEditor} to obtain an instance of this interface.
|
6
|
+
#
|
7
|
+
module TextEditor
|
8
|
+
|
9
|
+
# This method is used to update the currently displayed text in the editor.
|
10
|
+
#
|
11
|
+
# @param txt [String] The text to be displayed.
|
12
|
+
# @return [void]
|
13
|
+
#
|
14
|
+
def setText(txt)
|
15
|
+
__setText(txt.to_java_bytes)
|
16
|
+
end
|
17
|
+
|
18
|
+
# This method is used to retrieve the currently displayed text.
|
19
|
+
#
|
20
|
+
# @return [String] The currently displayed text.
|
21
|
+
#
|
22
|
+
def getText
|
23
|
+
String.from_java_bytes __getText
|
24
|
+
end
|
25
|
+
|
26
|
+
# This method is used to obtain the currently selected text.
|
27
|
+
#
|
28
|
+
# @return [String, nil] The currently selected text, or +nil+ if the user
|
29
|
+
# has not made any selection.
|
30
|
+
#
|
31
|
+
def getSelectedText
|
32
|
+
String.from_java_bytes __getSelectedText
|
33
|
+
end
|
34
|
+
|
35
|
+
# Install ourselves into the current +ITextEditor+ java class
|
36
|
+
# @param [ITextEditor] editor
|
37
|
+
#
|
38
|
+
def self.implant(editor)
|
39
|
+
unless editor.implanted? || editor.nil?
|
40
|
+
pp [:implanting, editor, editor.class] if $DEBUG
|
41
|
+
editor.class.class_exec(editor) do |editor|
|
42
|
+
a_methods = %w{
|
43
|
+
setText
|
44
|
+
getText
|
45
|
+
getSelectedText
|
46
|
+
}
|
47
|
+
a_methods.each do |meth|
|
48
|
+
alias_method "__"+meth.to_s, meth
|
49
|
+
end
|
50
|
+
include Buby::Implants::TextEditor
|
51
|
+
a_methods.each do |meth|
|
52
|
+
java_class.ruby_names_for_java_method(meth).each do |ruby_meth|
|
53
|
+
define_method ruby_meth, Buby::Implants::TextEditor.instance_method(meth)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
include Buby::Implants::Proxy
|
57
|
+
end
|
58
|
+
end
|
59
|
+
editor
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class Buby
|
2
|
+
module Implants
|
3
|
+
module Proxy
|
4
|
+
def implanted?
|
5
|
+
true
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'buby/implants/jruby'
|
12
|
+
require 'buby/implants/buby_array_wrapper'
|
13
|
+
require 'buby/implants/context_menu_invocation'
|
14
|
+
require 'buby/implants/cookie'
|
15
|
+
require 'buby/implants/extension_helpers'
|
16
|
+
require 'buby/implants/http_request_response'
|
17
|
+
require 'buby/implants/intercepted_proxy_message'
|
18
|
+
require 'buby/implants/intruder_attack'
|
19
|
+
require 'buby/implants/message_editor'
|
20
|
+
require 'buby/implants/message_editor_controller'
|
21
|
+
require 'buby/implants/parameter'
|
22
|
+
require 'buby/implants/request_info'
|
23
|
+
require 'buby/implants/response_info'
|
24
|
+
require 'buby/implants/scanner_insertion_point'
|
25
|
+
require 'buby/implants/scan_issue'
|
26
|
+
require 'buby/implants/scan_queue_item'
|
27
|
+
require 'buby/implants/temp_file'
|
28
|
+
require 'buby/implants/text_editor'
|
@@ -0,0 +1,60 @@
|
|
1
|
+
class Buby
|
2
|
+
# This interface is used for custom Intruder payload generators. Extensions
|
3
|
+
# that have registered an +IIntruderPayloadGeneratorFactory+ must return a new
|
4
|
+
# instance of this interface when required as part of a new Intruder attack.
|
5
|
+
#
|
6
|
+
class IntruderPayloadGenerator
|
7
|
+
include Java::Burp::IIntruderPayloadGenerator
|
8
|
+
include Java::Burp::IIntruderPayloadGeneratorFactory
|
9
|
+
|
10
|
+
# (see Buby::IntruderPayloadGeneratorFactory#getGeneratorName)
|
11
|
+
def self.getGeneratorName; self.name.to_java_string; end
|
12
|
+
|
13
|
+
# {include:Buby::IntruderPayloadGeneratorFactory#createNewInstance}
|
14
|
+
# @param (see Buby::IntruderPayloadGeneratorFactory#createNewInstance)
|
15
|
+
# @return (see #initialize)
|
16
|
+
def self.createNewInstance(attack)
|
17
|
+
Buby::Implants::IntruderAttack.implant(attack)
|
18
|
+
self.new(attack)
|
19
|
+
end
|
20
|
+
|
21
|
+
# @param (see Buby::IntruderPayloadGeneratorFactory#createNewInstance)
|
22
|
+
def initialize(attack)
|
23
|
+
@attack = attack
|
24
|
+
end
|
25
|
+
|
26
|
+
# This method is used by Burp to determine whether the payload generator is
|
27
|
+
# able to provide any further payloads.
|
28
|
+
#
|
29
|
+
# @return [Boolean] Extensions should return +false+ when all the available
|
30
|
+
# payloads have been used up, otherwise +true+.
|
31
|
+
#
|
32
|
+
# @abstract
|
33
|
+
def hasMorePayloads; end
|
34
|
+
# (see #hasMorePayloads)
|
35
|
+
def more_payloads?; hasMorePayloads; end
|
36
|
+
|
37
|
+
# This method is used by Burp to obtain the value of the next payload.
|
38
|
+
#
|
39
|
+
# @param [Array<byte>] baseValue The base value of the current payload
|
40
|
+
# position. This value may be +nil+ if the concept of a base value is not
|
41
|
+
# applicable (e.g. in a battering ram attack).
|
42
|
+
# @return [Array<byte>] The next payload to use in the attack.
|
43
|
+
#
|
44
|
+
# @abstract Call super to get +baseValue+ as a +String+. Implementation's
|
45
|
+
# responsibility to return byte array.
|
46
|
+
def getNextPayload(baseValue)
|
47
|
+
ret = baseValue
|
48
|
+
baseValue = String.from_java_bytes(baseValue) if baseValue
|
49
|
+
ret
|
50
|
+
end
|
51
|
+
|
52
|
+
# This method is used by Burp to reset the state of the payload generator so
|
53
|
+
# that the next call to {#getNextPayload} returns the first payload again.
|
54
|
+
# This method will be invoked when an attack uses the same payload generator
|
55
|
+
# for more than one payload position, for example in a sniper attack.
|
56
|
+
#
|
57
|
+
# @abstract
|
58
|
+
def reset; end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class Buby
|
2
|
+
|
3
|
+
# Extensions can implement this interface and then call
|
4
|
+
# {Buby#registerIntruderPayloadGeneratorFactory} to register a factory for
|
5
|
+
# custom Intruder payloads.
|
6
|
+
#
|
7
|
+
# @see IntruderPayloadGenerator
|
8
|
+
class IntruderPayloadGeneratorFactory
|
9
|
+
include Java::Burp::IIntruderPayloadGeneratorFactory
|
10
|
+
|
11
|
+
# This method is used by Burp to obtain the name of the payload generator.
|
12
|
+
# This will be displayed as an option within the Intruder UI when the user
|
13
|
+
# selects to use extension-generated payloads.
|
14
|
+
#
|
15
|
+
# @return [String] The name of the payload generator.
|
16
|
+
#
|
17
|
+
def getGeneratorName; self.class.name.to_java_string; end
|
18
|
+
|
19
|
+
# This method is used by Burp when the user starts an Intruder attack that
|
20
|
+
# uses this payload generator.
|
21
|
+
#
|
22
|
+
# @param [IIntruderAttack] attack object that can be queried to obtain
|
23
|
+
# details about the attack in which the payload generator will be used.
|
24
|
+
# @return [IIntruderPayloadGenerator] A new payload generator for the
|
25
|
+
# attack.
|
26
|
+
#
|
27
|
+
# @abstract
|
28
|
+
def createNewInstance(attack)
|
29
|
+
Buby::Implants::IntruderAttack.implant(attack)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class Buby
|
2
|
+
# Extensions can implement this interface and then call
|
3
|
+
# {Buby#registerIntruderPayloadProcessor} to register a custom Intruder
|
4
|
+
# payload processor.
|
5
|
+
#
|
6
|
+
# @todo voodoo function wrapping?
|
7
|
+
class IntruderPayloadProcessor
|
8
|
+
include Java::Burp::IIntruderPayloadProcessor
|
9
|
+
|
10
|
+
# This method is used by Burp to obtain the name of the payload processor.
|
11
|
+
# This will be displayed as an option within the Intruder UI when the user
|
12
|
+
# selects to use an extension-provided payload processor.
|
13
|
+
#
|
14
|
+
# @return [String] The name of the payload processor.
|
15
|
+
#
|
16
|
+
def getProcessorName; self.class.name; end
|
17
|
+
|
18
|
+
# This method is invoked by Burp each time the processor should be applied
|
19
|
+
# to an Intruder payload.
|
20
|
+
#
|
21
|
+
# @param [Array[byte]] currentPayload The value of the payload to be
|
22
|
+
# processed.
|
23
|
+
# @param [Array[byte]] originalPayload The value of the original payload
|
24
|
+
# prior to processing by any already-applied processing rules.
|
25
|
+
# @param [Array[byte]] baseValue The base value of the payload position,
|
26
|
+
# which will be replaced with the current payload.
|
27
|
+
# @return The value of the processed payload. This may be +nil+ to
|
28
|
+
# indicate that the current payload should be skipped, and the attack
|
29
|
+
# will move directly to the next payload.
|
30
|
+
#
|
31
|
+
def processPayload(currentPayload, originalPayload, baseValue)
|
32
|
+
currentPayload = String.from_java_bytes currentPayload
|
33
|
+
originalPayload = String.from_java_bytes originalPayload
|
34
|
+
baseValue = String.from_java_bytes baseValue
|
35
|
+
nil
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|