bettercap 1.3.3 → 1.3.4
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.
- checksums.yaml +4 -4
- data/bin/bettercap +1 -38
- data/lib/bettercap.rb +2 -1
- data/lib/bettercap/context.rb +93 -31
- data/lib/bettercap/discovery/thread.rb +1 -1
- data/lib/bettercap/network/servers/dnsd.rb +127 -0
- data/lib/bettercap/{httpd/server.rb → network/servers/httpd.rb} +7 -3
- data/lib/bettercap/options.rb +37 -23
- data/lib/bettercap/proxy/proxy.rb +1 -1
- data/lib/bettercap/proxy/response.rb +8 -1
- data/lib/bettercap/version.rb +1 -1
- metadata +25 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b8517e99862edfe8f3472280ccfd8e340436054
|
4
|
+
data.tar.gz: dfeb4b57db59af6fb71cc2ed4f81ed0284bcf21f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6db3475b1b3311b317dafe674239a32bfe1ea03c89461c4b722775be121c0d3eb6ac132a641d5714b825261ee2bf1e796aa55f5819d990a1d38759035f92bbd7
|
7
|
+
data.tar.gz: a82cc75c27c49a844b19b57a849b2ea64c90d822fc63c6b1a9f3d5dfeb3325e9b588fa1e7c65db1f30587995f363ae6a778c223dbfd92809157d4c5fef14fac1
|
data/bin/bettercap
CHANGED
@@ -26,44 +26,7 @@ begin
|
|
26
26
|
# error checking.
|
27
27
|
ctx = BetterCap::Options.parse!
|
28
28
|
|
29
|
-
|
30
|
-
if ctx.options.target.nil?
|
31
|
-
BetterCap::Logger.info( "Targeting the whole subnet #{ctx.ifconfig[:ip4_obj].to_range} ..." ) unless ctx.options.has_spoofer?
|
32
|
-
ctx.discovery.start
|
33
|
-
# give some time to the discovery thread to spawn its workers,
|
34
|
-
# this will prevent 'Too many open files' errors to delay host
|
35
|
-
# discovery.
|
36
|
-
sleep 1.5
|
37
|
-
end
|
38
|
-
|
39
|
-
# Start network spoofers if any.
|
40
|
-
ctx.spoofer.each do |spoofer|
|
41
|
-
spoofer.start
|
42
|
-
end
|
43
|
-
|
44
|
-
# Start proxies and setup port redirection.
|
45
|
-
if ctx.options.proxy
|
46
|
-
if ctx.options.has_http_sniffer_enabled?
|
47
|
-
BetterCap::Logger.warn "WARNING: Both HTTP transparent proxy and URL parser are enabled, you're gonna see duplicated logs."
|
48
|
-
end
|
49
|
-
ctx.create_proxies
|
50
|
-
end
|
51
|
-
|
52
|
-
ctx.enable_port_redirection!
|
53
|
-
|
54
|
-
# Start local HTTP server.
|
55
|
-
if ctx.options.httpd
|
56
|
-
ctx.httpd = BetterCap::HTTPD::Server.new( ctx.options.httpd_port, ctx.options.httpd_path )
|
57
|
-
ctx.httpd.start
|
58
|
-
end
|
59
|
-
|
60
|
-
# Start network sniffer.
|
61
|
-
if ctx.options.sniffer
|
62
|
-
BetterCap::Sniffer.start ctx
|
63
|
-
elsif ctx.options.has_spoofer?
|
64
|
-
BetterCap::Logger.warn 'WARNING: Sniffer module was NOT enabled ( -X argument ), this '\
|
65
|
-
'will cause the MITM to run but no data to be collected.' unless ctx.options.has_spoofer?
|
66
|
-
end
|
29
|
+
ctx.start!
|
67
30
|
|
68
31
|
loop do
|
69
32
|
sleep 10
|
data/lib/bettercap.rb
CHANGED
@@ -60,4 +60,5 @@ require 'bettercap/proxy/proxy'
|
|
60
60
|
require 'bettercap/proxy/streamer'
|
61
61
|
require 'bettercap/proxy/module'
|
62
62
|
require 'bettercap/proxy/certstore'
|
63
|
-
require 'bettercap/httpd
|
63
|
+
require 'bettercap/network/servers/httpd'
|
64
|
+
require 'bettercap/network/servers/dnsd'
|
data/lib/bettercap/context.rb
CHANGED
@@ -31,8 +31,10 @@ class Context
|
|
31
31
|
attr_accessor :discovery
|
32
32
|
# A list of BetterCap::Spoofers class instances.
|
33
33
|
attr_accessor :spoofer
|
34
|
-
# Instance of BetterCap::HTTPD
|
34
|
+
# Instance of BetterCap::Network::Servers::HTTPD class.
|
35
35
|
attr_accessor :httpd
|
36
|
+
# Instance of BetterCap::Network::Servers::DNSD class.
|
37
|
+
attr_accessor :dnsd
|
36
38
|
# Instance of OpenSSL::X509::Certificate class used
|
37
39
|
# for the HTTPS transparent proxy.
|
38
40
|
attr_accessor :certificate
|
@@ -71,6 +73,7 @@ class Context
|
|
71
73
|
@proxy_processor = nil
|
72
74
|
@spoofer = nil
|
73
75
|
@httpd = nil
|
76
|
+
@dnsd = nil
|
74
77
|
@certificate = nil
|
75
78
|
@proxies = []
|
76
79
|
@redirections = []
|
@@ -115,6 +118,82 @@ class Context
|
|
115
118
|
nil
|
116
119
|
end
|
117
120
|
|
121
|
+
# Start everything!
|
122
|
+
def start!
|
123
|
+
# Start targets auto discovery if needed.
|
124
|
+
if @options.target.nil?
|
125
|
+
BetterCap::Logger.info( "Targeting the whole subnet #{@ifconfig[:ip4_obj].to_range} ..." ) unless @options.has_spoofer? or @options.arpcache
|
126
|
+
@discovery.start
|
127
|
+
# give some time to the discovery thread to spawn its workers,
|
128
|
+
# this will prevent 'Too many open files' errors to delay host
|
129
|
+
# discovery.
|
130
|
+
sleep 1.5
|
131
|
+
end
|
132
|
+
|
133
|
+
# Start network spoofers if any.
|
134
|
+
@spoofer.each do |spoofer|
|
135
|
+
spoofer.start
|
136
|
+
end
|
137
|
+
|
138
|
+
# Start proxies and setup port redirection.
|
139
|
+
if @options.proxy
|
140
|
+
if @options.has_http_sniffer_enabled?
|
141
|
+
BetterCap::Logger.warn "WARNING: Both HTTP transparent proxy and URL parser are enabled, you're gonna see duplicated logs."
|
142
|
+
end
|
143
|
+
create_proxies!
|
144
|
+
end
|
145
|
+
|
146
|
+
enable_port_redirection!
|
147
|
+
|
148
|
+
create_servers!
|
149
|
+
|
150
|
+
# Start network sniffer.
|
151
|
+
if @options.sniffer
|
152
|
+
Sniffer.start ctx
|
153
|
+
elsif @options.has_spoofer?
|
154
|
+
Logger.warn 'WARNING: Sniffer module was NOT enabled ( -X argument ), this '\
|
155
|
+
'will cause the MITM to run but no data to be collected.' unless @options.has_spoofer?
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
# Stop every running daemon that was started and reset system state.
|
160
|
+
def finalize
|
161
|
+
@running = false
|
162
|
+
|
163
|
+
# Logger is silent if @running == false
|
164
|
+
puts "\nShutting down, hang on ...\n"
|
165
|
+
|
166
|
+
Logger.debug 'Stopping target discovery manager ...'
|
167
|
+
@discovery.stop
|
168
|
+
|
169
|
+
Logger.debug 'Stopping spoofers ...'
|
170
|
+
@spoofer.each do |spoofer|
|
171
|
+
spoofer.stop
|
172
|
+
end
|
173
|
+
|
174
|
+
# Spoofer might be sending some last packets to restore the targets,
|
175
|
+
# the packet queue must be stopped here.
|
176
|
+
@packets.stop
|
177
|
+
|
178
|
+
Logger.debug 'Stopping proxies ...'
|
179
|
+
@proxies.each do |proxy|
|
180
|
+
proxy.stop
|
181
|
+
end
|
182
|
+
|
183
|
+
Logger.debug 'Disabling port redirections ...'
|
184
|
+
@redirections.each do |r|
|
185
|
+
@firewall.del_port_redirection( r )
|
186
|
+
end
|
187
|
+
|
188
|
+
Logger.debug 'Restoring firewall state ...'
|
189
|
+
@firewall.restore
|
190
|
+
|
191
|
+
@dnsd.stop unless @dnsd.nil?
|
192
|
+
@httpd.stop unless @httpd.nil?
|
193
|
+
end
|
194
|
+
|
195
|
+
private
|
196
|
+
|
118
197
|
# Apply needed BetterCap::Firewalls::Redirection objects.
|
119
198
|
def enable_port_redirection!
|
120
199
|
@redirections = @options.to_redirections @ifconfig
|
@@ -126,7 +205,7 @@ class Context
|
|
126
205
|
|
127
206
|
# Initialize the needed transparent proxies and the processor routined which
|
128
207
|
# is needed in order to run proxy modules.
|
129
|
-
def create_proxies
|
208
|
+
def create_proxies!
|
130
209
|
if @options.has_proxy_module?
|
131
210
|
Proxy::Module.register_modules
|
132
211
|
|
@@ -181,39 +260,22 @@ class Context
|
|
181
260
|
end
|
182
261
|
end
|
183
262
|
|
184
|
-
#
|
185
|
-
def
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
puts "\nShutting down, hang on ...\n"
|
190
|
-
|
191
|
-
Logger.debug 'Stopping target discovery manager ...'
|
192
|
-
@discovery.stop
|
263
|
+
# Initialize and start the needed servers.
|
264
|
+
def create_servers!
|
265
|
+
# Start local DNS server.
|
266
|
+
if @options.dnsd
|
267
|
+
Logger.warn "Starting DNS server with spoofing disabled, bettercap will only reply to local DNS queries." unless @options.has_spoofer?
|
193
268
|
|
194
|
-
|
195
|
-
|
196
|
-
spoofer.stop
|
269
|
+
@dnsd = Network::Servers::DNSD.new( @options.dnsd_file, @ifconfig[:ip_saddr], @options.dnsd_port )
|
270
|
+
@dnsd.start
|
197
271
|
end
|
198
272
|
|
199
|
-
#
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
Logger.debug 'Stopping proxies ...'
|
204
|
-
@proxies.each do |proxy|
|
205
|
-
proxy.stop
|
273
|
+
# Start local HTTP server.
|
274
|
+
if @options.httpd
|
275
|
+
@httpd = Network::Servers::HTTPD.new( @options.httpd_port, @options.httpd_path )
|
276
|
+
@httpd.start
|
206
277
|
end
|
207
|
-
|
208
|
-
Logger.debug 'Disabling port redirections ...'
|
209
|
-
@redirections.each do |r|
|
210
|
-
@firewall.del_port_redirection( r )
|
211
|
-
end
|
212
|
-
|
213
|
-
Logger.debug 'Restoring firewall state ...'
|
214
|
-
@firewall.restore
|
215
|
-
|
216
|
-
@httpd.stop unless @httpd.nil?
|
217
278
|
end
|
279
|
+
|
218
280
|
end
|
219
281
|
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
=begin
|
3
|
+
|
4
|
+
BETTERCAP
|
5
|
+
|
6
|
+
Author : Simone 'evilsocket' Margaritelli
|
7
|
+
Email : evilsocket@gmail.com
|
8
|
+
Blog : http://www.evilsocket.net/
|
9
|
+
|
10
|
+
This project is released under the GPL 3 license.
|
11
|
+
|
12
|
+
=end
|
13
|
+
require 'rubydns'
|
14
|
+
|
15
|
+
module BetterCap
|
16
|
+
module Network
|
17
|
+
module Servers
|
18
|
+
|
19
|
+
# Class to wrap RubyDNS::RuleBasedServer and add some utility methods.
|
20
|
+
class DnsWrapper < RubyDNS::RuleBasedServer
|
21
|
+
# Instantiate a server with a block.
|
22
|
+
def initialize(options = {}, &block)
|
23
|
+
super(options,&block)
|
24
|
+
@rules = options[:rules]
|
25
|
+
end
|
26
|
+
# Give a name and a record type, try to match a rule and use it for processing the given arguments.
|
27
|
+
def process(name, resource_class, transaction)
|
28
|
+
Logger.debug "[#{'DNS'.green}] Received #{resource_class.name} request for #{name} ..."
|
29
|
+
super
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# Simple DNS server class used for DNS spoofing.
|
34
|
+
class DNSD
|
35
|
+
# Initialize the DNS server with the specified +address+ and tcp/udp +port+.
|
36
|
+
# The server will load +hosts_filename+ composed by 'regexp -> ip' entries
|
37
|
+
# to do custom DNS spoofing/resolution.
|
38
|
+
def initialize( hosts_filename, address = '0.0.0.0', port = 5300 )
|
39
|
+
@port = port
|
40
|
+
@address = address
|
41
|
+
@server = nil
|
42
|
+
@rules = []
|
43
|
+
@thread = nil
|
44
|
+
@ifaces = [
|
45
|
+
[:udp, address, port],
|
46
|
+
[:tcp, address, port]
|
47
|
+
]
|
48
|
+
|
49
|
+
DNSD.parse_hosts( hosts_filename ).each do |exp,addr|
|
50
|
+
block = Proc.new do |transaction|
|
51
|
+
Logger.info "[#{transaction.options[:peer]} > #{'DNS'.green}] Received request for '#{transaction.question.to_s.yellow}', sending spoofed reply #{addr.yellow} ..."
|
52
|
+
transaction.respond!(addr)
|
53
|
+
end
|
54
|
+
|
55
|
+
@rules << RubyDNS::RuleBasedServer::Rule.new( [ exp, Resolv::DNS::Resource::IN::A ], block )
|
56
|
+
end
|
57
|
+
|
58
|
+
Logger.warn "Empty hosts file for DNS server." if @rules.empty?
|
59
|
+
end
|
60
|
+
|
61
|
+
# Start the server.
|
62
|
+
def start
|
63
|
+
Logger.info "[#{'DNS'.green}] Starting on #{@address}:#{@port} ( #{@rules.size} redirection rule#{if @rules.size > 1 then 's' else '' end} ) ..."
|
64
|
+
|
65
|
+
@thread = Thread.new {
|
66
|
+
RubyDNS::run_server(:listen => @ifaces, :asynchronous => true, :server_class => DnsWrapper, :rules => @rules ) do
|
67
|
+
# Suppress RubyDNS logging.
|
68
|
+
@logger.level = ::Logger::ERROR
|
69
|
+
@upstream ||= RubyDNS::Resolver.new([[:udp, "8.8.8.8", 53], [:tcp, "8.8.8.8", 53]])
|
70
|
+
|
71
|
+
# Default DNS handler
|
72
|
+
otherwise do |transaction|
|
73
|
+
Logger.debug "[#{transaction.options[:peer]} > #{'DNS'.green}] Received request for '#{transaction.question.to_s.yellow}' -> upstream DNS"
|
74
|
+
transaction.passthrough!(@upstream)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
}
|
78
|
+
end
|
79
|
+
|
80
|
+
# Stop the server.
|
81
|
+
def stop
|
82
|
+
Logger.info "Stopping DNS server ..."
|
83
|
+
begin
|
84
|
+
@thread.kill
|
85
|
+
rescue; end
|
86
|
+
end
|
87
|
+
|
88
|
+
# Parse hosts from +filename+, example host file:
|
89
|
+
#
|
90
|
+
# # *.google.com will point to the attacker's computer.
|
91
|
+
# local .*google\.com
|
92
|
+
#
|
93
|
+
# # a custom redirection
|
94
|
+
# 12.12.12.12 wtf.idontexist.com
|
95
|
+
def self.parse_hosts( filename )
|
96
|
+
raise BetterCap::Error, "File '#{filename}' does not exist." unless File.exist?(filename)
|
97
|
+
|
98
|
+
hosts = {}
|
99
|
+
File.open(filename).each_with_index do |line,lineno|
|
100
|
+
line = line.strip
|
101
|
+
# skip empty lines and comments
|
102
|
+
next if line.empty? or line[0] == '#'
|
103
|
+
if line =~ /^([^\s]+)\s+(.+)$/
|
104
|
+
address = $1
|
105
|
+
expression = $2
|
106
|
+
|
107
|
+
if address == 'local'
|
108
|
+
address = Context.get.ifconfig[:ip_saddr].to_s
|
109
|
+
end
|
110
|
+
|
111
|
+
raise BetterCap::Error, "Invalid IPv4 address '#{address}' on line #{lineno + 1} of '#{filename}'." unless Network.is_ip?(address)
|
112
|
+
|
113
|
+
begin
|
114
|
+
hosts[ Regexp.new(expression) ] = address
|
115
|
+
rescue RegexpError
|
116
|
+
raise BetterCap::Error, "Invalid expression '#{expression}' on line #{lineno + 1} of '#{filename}'."
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
hosts
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
@@ -15,9 +15,11 @@ require 'webrick'
|
|
15
15
|
require 'bettercap/logger'
|
16
16
|
|
17
17
|
module BetterCap
|
18
|
-
module
|
18
|
+
module Network
|
19
|
+
module Servers
|
20
|
+
|
19
21
|
# Simple HTTP server class used to serve static assets when needed.
|
20
|
-
class
|
22
|
+
class HTTPD
|
21
23
|
# Initialize the HTTP server with the specified tcp +port+ using
|
22
24
|
# +path+ as the document root.
|
23
25
|
def initialize( port = 8081, path = './' )
|
@@ -33,7 +35,7 @@ class Server
|
|
33
35
|
|
34
36
|
# Start the server.
|
35
37
|
def start
|
36
|
-
Logger.info "Starting
|
38
|
+
Logger.info "[#{'HTTPD'.green}] Starting on port #{@port} and path #{@path} ..."
|
37
39
|
@thread = Thread.new {
|
38
40
|
@server.start
|
39
41
|
}
|
@@ -47,5 +49,7 @@ class Server
|
|
47
49
|
@thread.join
|
48
50
|
end
|
49
51
|
end
|
52
|
+
|
53
|
+
end
|
50
54
|
end
|
51
55
|
end
|
data/lib/bettercap/options.rb
CHANGED
@@ -79,12 +79,18 @@ class Options
|
|
79
79
|
attr_accessor :custom_https_proxy
|
80
80
|
# Custom HTTPS transparent proxy port.
|
81
81
|
attr_accessor :custom_https_proxy_port
|
82
|
-
# If true, BetterCap::HTTPD
|
82
|
+
# If true, BetterCap::Network::Servers::HTTPD will be enabled.
|
83
83
|
attr_accessor :httpd
|
84
|
-
# The port to bind
|
84
|
+
# The port to bind HTTP server to.
|
85
85
|
attr_accessor :httpd_port
|
86
|
-
# Web root of the
|
86
|
+
# Web root of the HTTP server.
|
87
87
|
attr_accessor :httpd_path
|
88
|
+
# If true, BetterCap::Network::Servers::DNSD will be enabled.
|
89
|
+
attr_accessor :dnsd
|
90
|
+
# The port to bind DNS server to.
|
91
|
+
attr_accessor :dnsd_port
|
92
|
+
# The host resolution file to use with the DNS server.
|
93
|
+
attr_accessor :dnsd_file
|
88
94
|
# If true, bettercap will check for updates then exit.
|
89
95
|
attr_accessor :check_updates
|
90
96
|
# If true, targets NBNS hostname resolution won't be performed.
|
@@ -114,6 +120,10 @@ class Options
|
|
114
120
|
@https_ports = [ 443 ]
|
115
121
|
@ignore = nil
|
116
122
|
|
123
|
+
@dnsd = false
|
124
|
+
@dnsd_port = 5300
|
125
|
+
@dnsd_file = nil
|
126
|
+
|
117
127
|
@sniffer = false
|
118
128
|
@sniffer_pcap = nil
|
119
129
|
@sniffer_filter = nil
|
@@ -311,6 +321,15 @@ class Options
|
|
311
321
|
ctx.options.httpd_port = v.to_i
|
312
322
|
end
|
313
323
|
|
324
|
+
opts.on( '--dns FILE', 'Enable DNS server and use this file as a hosts resolution table.' ) do |v|
|
325
|
+
ctx.options.dnsd = true
|
326
|
+
ctx.options.dnsd_file = File.expand_path v
|
327
|
+
end
|
328
|
+
|
329
|
+
opts.on( '--dns-port PORT', 'Set DNS server port, default to ' + ctx.options.dnsd_port.to_s + '.' ) do |v|
|
330
|
+
ctx.options.dnsd_port = v.to_i
|
331
|
+
end
|
332
|
+
|
314
333
|
opts.on( '--httpd-path PATH', 'Set HTTP server path, default to ' + ctx.options.httpd_path + '.' ) do |v|
|
315
334
|
ctx.options.httpd = true
|
316
335
|
ctx.options.httpd_path = v
|
@@ -478,48 +497,42 @@ class Options
|
|
478
497
|
spoofers
|
479
498
|
end
|
480
499
|
|
500
|
+
# Helper method to create a Firewalls::Redirection object.
|
501
|
+
def redir( address, port, to, proto = 'TCP' )
|
502
|
+
Firewalls::Redirection.new( @iface, proto, port, address, to )
|
503
|
+
end
|
504
|
+
|
481
505
|
# Create a list of BetterCap::Firewalls::Redirection objects which are needed
|
482
506
|
# given the specified command line arguments.
|
483
507
|
def to_redirections ifconfig
|
484
508
|
redirections = []
|
485
509
|
|
510
|
+
if @dnsd
|
511
|
+
redirections << redir( ifconfig[:ip_saddr], 53, @dnsd_port )
|
512
|
+
redirections << redir( ifconfig[:ip_saddr], 53, @dnsd_port, 'UDP' )
|
513
|
+
end
|
514
|
+
|
486
515
|
if @proxy
|
487
516
|
@http_ports.each do |port|
|
488
|
-
redirections <<
|
489
|
-
'TCP',
|
490
|
-
port,
|
491
|
-
ifconfig[:ip_saddr],
|
492
|
-
@proxy_port )
|
517
|
+
redirections << redir( ifconfig[:ip_saddr], port, @proxy_port )
|
493
518
|
end
|
494
519
|
end
|
495
520
|
|
496
521
|
if @proxy_https
|
497
522
|
@https_ports.each do |port|
|
498
|
-
redirections <<
|
499
|
-
'TCP',
|
500
|
-
port,
|
501
|
-
ifconfig[:ip_saddr],
|
502
|
-
@proxy_https_port )
|
523
|
+
redirections << redir( ifconfig[:ip_saddr], port, @proxy_https_port )
|
503
524
|
end
|
504
525
|
end
|
505
526
|
|
506
527
|
if @custom_proxy
|
507
528
|
@http_ports.each do |port|
|
508
|
-
redirections <<
|
509
|
-
'TCP',
|
510
|
-
port,
|
511
|
-
@custom_proxy,
|
512
|
-
@custom_proxy_port )
|
529
|
+
redirections << redir( @custom_proxy, port, @custom_proxy_port )
|
513
530
|
end
|
514
531
|
end
|
515
532
|
|
516
533
|
if @custom_https_proxy
|
517
534
|
@https_ports.each do |port|
|
518
|
-
redirections <<
|
519
|
-
'TCP',
|
520
|
-
port,
|
521
|
-
@custom_https_proxy,
|
522
|
-
@custom_https_proxy_port )
|
535
|
+
redirections << redir( @custom_https_proxy, port, @custom_https_proxy_port )
|
523
536
|
end
|
524
537
|
end
|
525
538
|
|
@@ -538,6 +551,7 @@ class Options
|
|
538
551
|
'https-proxy' => if proxy_https then on else off end,
|
539
552
|
'sslstrip' => if proxy and sslstrip then on else off end,
|
540
553
|
'http-server' => if httpd then on else off end,
|
554
|
+
'dns-server' => if dnsd then on else off end
|
541
555
|
}
|
542
556
|
|
543
557
|
msg = "Starting [ "
|
@@ -91,7 +91,7 @@ class Proxy
|
|
91
91
|
# Main server thread, will accept incoming connections and push them to
|
92
92
|
# the thread pool.
|
93
93
|
def server_thread
|
94
|
-
Logger.info "#{@type} Proxy
|
94
|
+
Logger.info "[#{@type.green}] Proxy starting on #{@address}:#{@port} ...\n"
|
95
95
|
|
96
96
|
@running = true
|
97
97
|
|
@@ -124,14 +124,21 @@ class Response
|
|
124
124
|
""
|
125
125
|
end
|
126
126
|
|
127
|
-
# If the header with +name+ is found, then a +value+ is assigned to it
|
127
|
+
# If the header with +name+ is found, then a +value+ is assigned to it,
|
128
|
+
# otherwise it's created.
|
128
129
|
def []=(name, value)
|
130
|
+
found = false
|
129
131
|
@headers.each_with_index do |header,i|
|
130
132
|
if header =~ /^#{name}:\s*.+$/i
|
131
133
|
@headers[i] = "#{name}: #{value}"
|
134
|
+
found = true
|
132
135
|
break
|
133
136
|
end
|
134
137
|
end
|
138
|
+
|
139
|
+
unless found
|
140
|
+
@headers << "#{name}: #{value}"
|
141
|
+
end
|
135
142
|
end
|
136
143
|
|
137
144
|
# Return a string representation of this response object, patching the
|
data/lib/bettercap/version.rb
CHANGED
@@ -12,7 +12,7 @@ This project is released under the GPL 3 license.
|
|
12
12
|
=end
|
13
13
|
module BetterCap
|
14
14
|
# Current version of bettercap.
|
15
|
-
VERSION = '1.3.
|
15
|
+
VERSION = '1.3.4'
|
16
16
|
# Program banner.
|
17
17
|
BANNER = File.read( File.dirname(__FILE__) + '/banner' ).gsub( '#VERSION#', "v#{VERSION}")
|
18
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bettercap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simone Margaritelli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -86,8 +86,28 @@ dependencies:
|
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: 0.8.0
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: rubydns
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '1.0'
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 1.0.3
|
99
|
+
type: :runtime
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - "~>"
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '1.0'
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: 1.0.3
|
89
109
|
description: BetterCap is the state of the art, modular, portable and easily extensible
|
90
|
-
MITM framework featuring ARP and ICMP spoofing, sslstripping, credentials harvesting
|
110
|
+
MITM framework featuring ARP, DNS and ICMP spoofing, sslstripping, credentials harvesting
|
91
111
|
and more.
|
92
112
|
email: evilsocket@gmail.com
|
93
113
|
executables:
|
@@ -115,7 +135,6 @@ files:
|
|
115
135
|
- lib/bettercap/firewalls/linux.rb
|
116
136
|
- lib/bettercap/firewalls/osx.rb
|
117
137
|
- lib/bettercap/firewalls/redirection.rb
|
118
|
-
- lib/bettercap/httpd/server.rb
|
119
138
|
- lib/bettercap/loader.rb
|
120
139
|
- lib/bettercap/logger.rb
|
121
140
|
- lib/bettercap/monkey/packetfu/utils.rb
|
@@ -123,6 +142,8 @@ files:
|
|
123
142
|
- lib/bettercap/network/hw-prefixes
|
124
143
|
- lib/bettercap/network/network.rb
|
125
144
|
- lib/bettercap/network/packet_queue.rb
|
145
|
+
- lib/bettercap/network/servers/dnsd.rb
|
146
|
+
- lib/bettercap/network/servers/httpd.rb
|
126
147
|
- lib/bettercap/network/target.rb
|
127
148
|
- lib/bettercap/options.rb
|
128
149
|
- lib/bettercap/proxy/certstore.rb
|