burp_email_dumper 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +6 -0
- data/bin/burp_email_dumper +158 -0
- data/burp_email_dumper.gemspec +37 -0
- data/lib/burp_email_dumper.rb +5 -0
- data/lib/burp_email_dumper/version.rb +3 -0
- data/pkg/burp_email_dumper-0.0.0.gem +0 -0
- metadata +125 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a50a7491b253d71abcae74188f3476516829eaa2
|
4
|
+
data.tar.gz: a417f59d2ed993de9585ae840407f6d4b5af3040
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4e8154a5235fa6c3c84744b49228f4f928c57b7452c534653b8a7145e2317ebd865d78fea0dc0d13d55ddb1c18754c83c7b5a864dc282d94b450bfb71727f45f
|
7
|
+
data.tar.gz: 63fb8601893338c562ea5d91729877d83d5555b6b3f4d5c7ba5a21d154aeeeb766aeecbe79361b8471f6be328eefa056123c1a01159f0a09189857c13834972f
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 arch4ngel
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# BurpEmailDumper
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/burp_email_dumper`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'burp_email_dumper'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install burp_email_dumper
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/burp_email_dumper.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,158 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
require 'nokogiri'
|
3
|
+
require 'base64'
|
4
|
+
require 'thor'
|
5
|
+
|
6
|
+
include Base64
|
7
|
+
|
8
|
+
class String
|
9
|
+
|
10
|
+
def prefix(symbol='+', wrapper=["[","]"], space_char=" ", rep=1)
|
11
|
+
|
12
|
+
return (wrapper[0] + symbol + wrapper[1]) + (space_char * rep) + self
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
def borderize(char='-')
|
17
|
+
|
18
|
+
border = char * self.length
|
19
|
+
return "#{border}\n#{self}\n#{border}"
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
class Interface < Thor
|
26
|
+
|
27
|
+
desc "parse", "Parse a Burp XML and extract email addresses from mailto links"
|
28
|
+
|
29
|
+
option :input_file,
|
30
|
+
aliases: ["-i"],
|
31
|
+
required: true,
|
32
|
+
type: :string,
|
33
|
+
desc: "Burp XML file to parse"
|
34
|
+
|
35
|
+
option :output_file,
|
36
|
+
aliases: ["-o"],
|
37
|
+
required: false,
|
38
|
+
type: :string,
|
39
|
+
desc: "File to capture output"
|
40
|
+
|
41
|
+
def parse()
|
42
|
+
|
43
|
+
infile, outfile = options[:input_file], options[:output_file]
|
44
|
+
|
45
|
+
puts
|
46
|
+
|
47
|
+
if !File::exist?(infile)
|
48
|
+
|
49
|
+
raise "Error: input file doesn't exist (#{infile})"
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
if outfile and File::exist?(outfile)
|
54
|
+
|
55
|
+
print "Output file already exists! Overwrite?(y/n): "
|
56
|
+
resp = STDIN.gets.chomp
|
57
|
+
puts
|
58
|
+
|
59
|
+
if resp == "n"
|
60
|
+
|
61
|
+
puts "Exiting due to presence of output file...".prefix()
|
62
|
+
exit
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
puts "Parsing input file: #{infile}".prefix
|
69
|
+
# parse the file
|
70
|
+
parse_file(infile, outfile)
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
def parse_file(infile, outfile=nil)
|
77
|
+
|
78
|
+
emails = []
|
79
|
+
|
80
|
+
doc = nil
|
81
|
+
File::open(infile) {|f| doc = Nokogiri::XML(f)}
|
82
|
+
|
83
|
+
doc.xpath('//response').each do |response|
|
84
|
+
|
85
|
+
# extract the entire response
|
86
|
+
response = response.children.first.text
|
87
|
+
|
88
|
+
# decode and split the response
|
89
|
+
headers, body = decode64(response).split("\r\n"*2)
|
90
|
+
|
91
|
+
# parse the headers to a hash
|
92
|
+
headers = headers.split("\r\n")
|
93
|
+
headers = headers[1..(headers.count-1)]
|
94
|
+
header_hash = {}
|
95
|
+
headers.each do |header|
|
96
|
+
key, value = header.split(": ")
|
97
|
+
header_hash[key.downcase] = value
|
98
|
+
end
|
99
|
+
headers = header_hash
|
100
|
+
|
101
|
+
# make sure we're about to parse an html file by taking a look at the content-type header
|
102
|
+
if headers["content-type"] and headers["content-type"] =~ /text\/html/i
|
103
|
+
|
104
|
+
rdoc = Nokogiri::HTML(body)
|
105
|
+
|
106
|
+
# Extract all link elements
|
107
|
+
rdoc.xpath('//a').each do |element|
|
108
|
+
|
109
|
+
# Extract the href
|
110
|
+
href = element.attributes["href"]
|
111
|
+
|
112
|
+
# Add the email address to the list if conditions
|
113
|
+
# are met
|
114
|
+
if href and href.value =~ /mailto/i
|
115
|
+
|
116
|
+
email = href.value
|
117
|
+
.downcase
|
118
|
+
.gsub('mailto:','')
|
119
|
+
|
120
|
+
emails << email if !emails.include?(email)
|
121
|
+
|
122
|
+
end
|
123
|
+
|
124
|
+
end
|
125
|
+
|
126
|
+
end
|
127
|
+
|
128
|
+
end
|
129
|
+
|
130
|
+
if !outfile
|
131
|
+
|
132
|
+
puts "Dumping extracted email addresses".prefix
|
133
|
+
puts
|
134
|
+
puts "Extracted Email Addresses".borderize()
|
135
|
+
puts emails
|
136
|
+
puts
|
137
|
+
|
138
|
+
else
|
139
|
+
|
140
|
+
print "Writing email addresses to output file...".prefix()
|
141
|
+
File::open(outfile,'w+') do |outfile|
|
142
|
+
|
143
|
+
emails.each {|email| outfile.puts(email) }
|
144
|
+
|
145
|
+
end
|
146
|
+
puts "done!"
|
147
|
+
|
148
|
+
|
149
|
+
end
|
150
|
+
|
151
|
+
puts "Done parsing!".prefix()
|
152
|
+
puts
|
153
|
+
|
154
|
+
end
|
155
|
+
|
156
|
+
puts
|
157
|
+
Interface.start(ARGV)
|
158
|
+
puts
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "burp_email_dumper/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "burp_email_dumper"
|
8
|
+
spec.version = BurpEmailDumper::VERSION
|
9
|
+
spec.authors = ["arch4ngel"]
|
10
|
+
spec.email = ["justinangel86@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Script that parses HTTP responses and strips emails from mailto links}
|
13
|
+
spec.homepage = "https://github.com/arch4ngel/burp_email_dumper"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
20
|
+
else
|
21
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
22
|
+
"public gem pushes."
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
26
|
+
f.match(%r{^(test|spec|features)/})
|
27
|
+
end
|
28
|
+
spec.bindir = "bin"
|
29
|
+
spec.executables = ["burp_email_dumper"]
|
30
|
+
spec.require_paths = ["lib"]
|
31
|
+
|
32
|
+
spec.add_development_dependency "bundler", "~> 1.15"
|
33
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
34
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
35
|
+
spec.add_dependency("nokogiri","~> 1.8.0")
|
36
|
+
spec.add_dependency("thor","~> 0.20.0")
|
37
|
+
end
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: burp_email_dumper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- arch4ngel
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-09-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.15'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.15'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: nokogiri
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.8.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.8.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: thor
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.20.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.20.0
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- justinangel86@gmail.com
|
86
|
+
executables:
|
87
|
+
- burp_email_dumper
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- Gemfile
|
92
|
+
- LICENSE.txt
|
93
|
+
- README.md
|
94
|
+
- Rakefile
|
95
|
+
- bin/burp_email_dumper
|
96
|
+
- burp_email_dumper.gemspec
|
97
|
+
- lib/burp_email_dumper.rb
|
98
|
+
- lib/burp_email_dumper/version.rb
|
99
|
+
- pkg/burp_email_dumper-0.0.0.gem
|
100
|
+
homepage: https://github.com/arch4ngel/burp_email_dumper
|
101
|
+
licenses:
|
102
|
+
- MIT
|
103
|
+
metadata:
|
104
|
+
allowed_push_host: https://rubygems.org
|
105
|
+
post_install_message:
|
106
|
+
rdoc_options: []
|
107
|
+
require_paths:
|
108
|
+
- lib
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
requirements: []
|
120
|
+
rubyforge_project:
|
121
|
+
rubygems_version: 2.5.2
|
122
|
+
signing_key:
|
123
|
+
specification_version: 4
|
124
|
+
summary: Script that parses HTTP responses and strips emails from mailto links
|
125
|
+
test_files: []
|