Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added nil trap incase no bnat found

  • Loading branch information...
commit 803722192210ec9de9c6aa95b88b6ffc11c0c9f9 1 parent c96a141
Jonathan Claudius claudijd authored
Showing with 5 additions and 4 deletions.
  1. +5 −4 bnat-scan.rb
9 bnat-scan.rb
@@ -32,7 +32,6 @@
def usage
puts "\nUsage: ruby bnat-scan.rb <ipaddress OR CIDR netblock>\n"
- puts "\nWARNING: do not initiate any outbound traffic while performing a scan to ensure accurate results\n"
puts "\nWARNING: your scanning host must be directly connected to the Internet w/o firewall/router/nat service\n\n"
@@ -80,7 +79,7 @@ def scanip(target)
:iface => $config[:iface],
:start => true,
#Prod Filter (bnat ports)
- :filter => "tcp and not host #{target} and tcp[13] == 18 and #{seqbpf}"
+ :filter => "tcp and not host #{target} and tcp[13] == 18 and #{bpf}"
#Debug Filter (open ports)
#:filter => "tcp and host #{target} and tcp[13] == 18 and #{bpf}"
@@ -148,8 +147,10 @@ def scanip(target)
puts "\nCompleted BNAT scan\n"
puts "\nWe found #{$bnatarray.length} instance(s) of BNAT\n"
-$bnatarray.each do |b|
- puts "#{b}\n"
+if $bnatarray != nil
+ $bnatarray.each do |b|
+ puts "#{b}\n"
+ end
puts "\n"
Please sign in to comment.
Something went wrong with that request. Please try again.