emonti-buby 1.1.2 → 1.1.3
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.
- data/History.txt +8 -0
- data/buby.gemspec +2 -2
- data/java/buby.jar +0 -0
- data/lib/buby.rb +123 -8
- metadata +3 -4
data/History.txt
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
== 1.1.3 / 2009-08-25
|
2
|
+
* 1 enhancement
|
3
|
+
* new convenience methods added for iterating and searching through
|
4
|
+
proxy history, scan history, etc.
|
5
|
+
* 1 fix
|
6
|
+
* The gem now includes a buby.jar which should be usable with Java 1.5+
|
7
|
+
(previously the jar had been compiled only for Java 1.6)
|
8
|
+
|
1
9
|
== 1.1.2 / 2009-08-20
|
2
10
|
* 1 enhancement
|
3
11
|
* Support added for the new getScanIssues extender method exposed in v1.2.15
|
data/buby.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{buby}
|
5
|
-
s.version = "1.1.
|
5
|
+
s.version = "1.1.3"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Eric Monti - Matasano Security"]
|
9
|
-
s.date = %q{2009-08-
|
9
|
+
s.date = %q{2009-08-25}
|
10
10
|
s.default_executable = %q{buby}
|
11
11
|
s.description = %q{Buby is a mashup of JRuby with the popular commercial web security testing tool Burp Suite from PortSwigger. Burp is driven from and tied to JRuby with a Java extension using the BurpExtender API. This extension aims to add Ruby scriptability to Burp Suite with an interface comparable to the Burp's pure Java extension interface.}
|
12
12
|
s.email = %q{emonti@matasano.com}
|
data/java/buby.jar
CHANGED
Binary file
|
data/lib/buby.rb
CHANGED
@@ -37,8 +37,11 @@ include_class 'BurpExtender'
|
|
37
37
|
# * sendToRepeater
|
38
38
|
# * sendToSpider
|
39
39
|
#
|
40
|
-
# Buby also provides front-end ruby methods for the
|
41
|
-
#
|
40
|
+
# Buby also provides front-end ruby methods for the various callback methods
|
41
|
+
# supported by Burp. New callbacks have been cropping up in newer Burp versions
|
42
|
+
# frequently.
|
43
|
+
#
|
44
|
+
# Available since Burp 1.2.09:
|
42
45
|
# * getProxyHistory
|
43
46
|
# * getSiteMap
|
44
47
|
# * restoreState
|
@@ -46,6 +49,9 @@ include_class 'BurpExtender'
|
|
46
49
|
# * getParameters
|
47
50
|
# * getHeaders
|
48
51
|
#
|
52
|
+
# Available since Burp 1.2.15:
|
53
|
+
# * getScanIssues
|
54
|
+
#
|
49
55
|
# If you wish to access any of the IBurpExtenderCallbacks methods directly.
|
50
56
|
# You can use 'burp_callbacks' to obtain a reference.
|
51
57
|
#
|
@@ -72,7 +78,7 @@ include_class 'BurpExtender'
|
|
72
78
|
class Buby
|
73
79
|
|
74
80
|
# :stopdoc:
|
75
|
-
VERSION = '1.1.
|
81
|
+
VERSION = '1.1.3'
|
76
82
|
LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
|
77
83
|
PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
|
78
84
|
# :startdoc:
|
@@ -238,16 +244,19 @@ class Buby
|
|
238
244
|
alias get_proxy_history getProxyHistory
|
239
245
|
|
240
246
|
# Returns a Java array of IHttpRequestResponse objects pulled directly from
|
241
|
-
# the Burp site map.
|
242
|
-
|
247
|
+
# the Burp site map for all urls matching the specified literal prefix.
|
248
|
+
# The prefix can be nil to return all objects.
|
249
|
+
def getSiteMap(urlprefix=nil)
|
243
250
|
_check_and_callback(:getSiteMap, urlprefix)
|
244
251
|
end
|
245
252
|
alias site_map getSiteMap
|
246
253
|
alias get_site_map getSiteMap
|
247
254
|
|
248
255
|
# This method returns all of the current scan issues for URLs matching the
|
249
|
-
# specified literal prefix. The prefix can be
|
250
|
-
|
256
|
+
# specified literal prefix. The prefix can be nil to match all issues.
|
257
|
+
#
|
258
|
+
# IMPORTANT: This method is only available with Burp 1.2.15 and higher.
|
259
|
+
def getScanIssues(urlprefix=nil)
|
251
260
|
_check_and_callback(:getScanIssues, urlprefix)
|
252
261
|
end
|
253
262
|
alias scan_issues getScanIssues
|
@@ -531,6 +540,111 @@ class Buby
|
|
531
540
|
pp([:got_app_close]) if $DEBUG
|
532
541
|
end
|
533
542
|
|
543
|
+
### Sugar/Convenience methods
|
544
|
+
|
545
|
+
# This is a convenience wrapper which can load a given burp state file and
|
546
|
+
# lets its caller to perform actions inside of a block on the site map
|
547
|
+
# contained in the loaded session.
|
548
|
+
#
|
549
|
+
# If a statefile argument isn't specified current burp session state is used.
|
550
|
+
#
|
551
|
+
# Yields each entry in the site map to a block (which is required)
|
552
|
+
def with_site_map(urlprefix=nil, statefile=nil)
|
553
|
+
with_statefile(statefile) do |this|
|
554
|
+
this.site_map(urlprefix).to_a.each {|h| yield h}
|
555
|
+
end
|
556
|
+
end
|
557
|
+
|
558
|
+
# This is a convenience wrapper which can load a given burp state file and
|
559
|
+
# lets its caller to perform actions inside of a block on the proxy history
|
560
|
+
# contained in the loaded session.
|
561
|
+
#
|
562
|
+
# If a statefile argument isn't specified current burp session state is used.
|
563
|
+
#
|
564
|
+
# Yields each entry in the proxy history to a block (which is required)
|
565
|
+
def with_proxy_history(statefile=nil)
|
566
|
+
with_statefile(statefile) do |this|
|
567
|
+
this.proxy_history.to_a.each {|h| yield h }
|
568
|
+
end
|
569
|
+
end
|
570
|
+
|
571
|
+
# This is a convenience wrapper which loads a given burp statefile and lets
|
572
|
+
# its caller to perform actions with burp on it inside of a block.
|
573
|
+
# It expects a block to yield 'self' is yielded for the duration
|
574
|
+
# of the statefile load.
|
575
|
+
#
|
576
|
+
# It can safely be used without a statefile argument, in which case the
|
577
|
+
# current session state is used.
|
578
|
+
#
|
579
|
+
# It can safely be run without a statefile argument in which the
|
580
|
+
# current burp session state is used.
|
581
|
+
def with_statefile(statefile=nil)
|
582
|
+
if statefile
|
583
|
+
# save current state:
|
584
|
+
old_state=".#{$$}.#{Time.now.to_i}.state.bak"
|
585
|
+
self.alert "Saving current state to temp statefile: #{old_state}"
|
586
|
+
self.save_state old_state
|
587
|
+
|
588
|
+
self.alert "Restoring state: #{statefile}"
|
589
|
+
self.restore_state statefile
|
590
|
+
end
|
591
|
+
|
592
|
+
yield self
|
593
|
+
|
594
|
+
if statefile
|
595
|
+
# restore original state
|
596
|
+
self.alert "Restoring temp statefile: #{old_state}"
|
597
|
+
self.restore_state old_state
|
598
|
+
self.alert "Deleting temp state file: #{old_state}"
|
599
|
+
File.unlink old_state
|
600
|
+
end
|
601
|
+
end
|
602
|
+
|
603
|
+
# Searches the proxy history for the url's matched by the specified
|
604
|
+
# regular expression (returns them all if urlrx is nil).
|
605
|
+
#
|
606
|
+
# A statefile to search in can optionally be specified or the existing
|
607
|
+
# state will be used if statefile is nil.
|
608
|
+
#
|
609
|
+
# This method also accepts an optional block which is passed each of the
|
610
|
+
# matched history members.
|
611
|
+
def search_proxy_history(statefile=nil, urlrx=nil)
|
612
|
+
ret = nil
|
613
|
+
with_statefile(statefile) do |this|
|
614
|
+
ret = this.proxy_history.to_a.select do |r|
|
615
|
+
if urlrx
|
616
|
+
true if r.url.to_s =~ urlrx
|
617
|
+
else
|
618
|
+
true
|
619
|
+
end
|
620
|
+
end
|
621
|
+
if block_given?
|
622
|
+
ret.each {|r| yield r }
|
623
|
+
end
|
624
|
+
end
|
625
|
+
return ret
|
626
|
+
end
|
627
|
+
|
628
|
+
# Harvest cookies from a session's proxy history.
|
629
|
+
#
|
630
|
+
# Params:
|
631
|
+
# cookie = optional: name of cookie to harvest
|
632
|
+
# urlrx = optional: regular expression to match urls against
|
633
|
+
# statefile = optional: filename for a burp session file to temporarily load
|
634
|
+
# and harvest from.
|
635
|
+
def harvest_cookies_from_history(cookie=nil, urlrx=nil, statefile=nil)
|
636
|
+
ret = []
|
637
|
+
search_proxy_history(statefile, urlrx) do |msg|
|
638
|
+
rsp = String.from_java_bytes(msg.response)
|
639
|
+
found = []
|
640
|
+
find_cookie_in_response(rsp, cookie) {|c| found << c}
|
641
|
+
ret += found.map {|f| f << msg }
|
642
|
+
end
|
643
|
+
return ret
|
644
|
+
end
|
645
|
+
|
646
|
+
### Startup stuff
|
647
|
+
|
534
648
|
# Prepares the java BurpExtender implementation with a reference
|
535
649
|
# to self as the module handler and launches burp suite.
|
536
650
|
def start_burp(args=[])
|
@@ -610,7 +724,8 @@ class Buby
|
|
610
724
|
def self.version
|
611
725
|
VERSION
|
612
726
|
end
|
613
|
-
|
727
|
+
|
728
|
+
end # Buby
|
614
729
|
|
615
730
|
# Try requiring 'burp.jar' from the Ruby lib-path
|
616
731
|
unless Buby.burp_loaded?
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emonti-buby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Monti - Matasano Security
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-08-
|
12
|
+
date: 2009-08-25 00:00:00 -07:00
|
13
13
|
default_executable: buby
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -66,7 +66,6 @@ files:
|
|
66
66
|
- test/test_buby.rb
|
67
67
|
has_rdoc: false
|
68
68
|
homepage: http://emonti.github.com/buby
|
69
|
-
licenses:
|
70
69
|
post_install_message:
|
71
70
|
rdoc_options:
|
72
71
|
- --main
|
@@ -89,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
88
|
requirements: []
|
90
89
|
|
91
90
|
rubyforge_project: buby
|
92
|
-
rubygems_version: 1.
|
91
|
+
rubygems_version: 1.2.0
|
93
92
|
signing_key:
|
94
93
|
specification_version: 3
|
95
94
|
summary: Buby is a mashup of JRuby with the popular commercial web security testing tool Burp Suite from PortSwigger
|