Class: Baffle::Options
- Inherits:
-
Object
- Object
- Baffle::Options
- Defined in:
- lib/baffle/options.rb
Instance Attribute Summary collapse
-
#bssid ⇒ Object
Returns the value of attribute bssid.
-
#capture ⇒ Object
Returns the value of attribute capture.
-
#channel ⇒ Object
Returns the value of attribute channel.
-
#driver ⇒ Object
Returns the value of attribute driver.
-
#essid ⇒ Object
Returns the value of attribute essid.
-
#fpdiagram ⇒ Object
Returns the value of attribute fpdiagram.
-
#gui ⇒ Object
Returns the value of attribute gui.
-
#inject ⇒ Object
Returns the value of attribute inject.
-
#plot_prefix ⇒ Object
Returns the value of attribute plot_prefix.
-
#train ⇒ Object
Returns the value of attribute train.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
Class Method Summary collapse
Instance Method Summary collapse
- #gui? ⇒ Boolean
-
#initialize ⇒ Options
constructor
A new instance of Options.
- #interface=(value) ⇒ Object
- #train? ⇒ Boolean
- #verbose? ⇒ Boolean
Constructor Details
#initialize ⇒ Options
Returns a new instance of Options.
16 17 18 19 20 21 22 23 24 |
# File 'lib/baffle/options.rb', line 16 def initialize @inject = 'ath0' @capture = 'ath0' @driver = 'madwifing' @channel = 11 @train = false @verbose = false @gui = false end |
Instance Attribute Details
#bssid ⇒ Object
Returns the value of attribute bssid.
13 14 15 |
# File 'lib/baffle/options.rb', line 13 def bssid @bssid end |
#capture ⇒ Object
Returns the value of attribute capture.
6 7 8 |
# File 'lib/baffle/options.rb', line 6 def capture @capture end |
#channel ⇒ Object
Returns the value of attribute channel.
8 9 10 |
# File 'lib/baffle/options.rb', line 8 def channel @channel end |
#driver ⇒ Object
Returns the value of attribute driver.
7 8 9 |
# File 'lib/baffle/options.rb', line 7 def driver @driver end |
#essid ⇒ Object
Returns the value of attribute essid.
13 14 15 |
# File 'lib/baffle/options.rb', line 13 def essid @essid end |
#fpdiagram ⇒ Object
Returns the value of attribute fpdiagram.
11 12 13 |
# File 'lib/baffle/options.rb', line 11 def fpdiagram @fpdiagram end |
#gui ⇒ Object
Returns the value of attribute gui.
14 15 16 |
# File 'lib/baffle/options.rb', line 14 def gui @gui end |
#inject ⇒ Object
Returns the value of attribute inject.
5 6 7 |
# File 'lib/baffle/options.rb', line 5 def inject @inject end |
#plot_prefix ⇒ Object
Returns the value of attribute plot_prefix.
12 13 14 |
# File 'lib/baffle/options.rb', line 12 def plot_prefix @plot_prefix end |
#train ⇒ Object
Returns the value of attribute train.
9 10 11 |
# File 'lib/baffle/options.rb', line 9 def train @train end |
#verbose ⇒ Object
Returns the value of attribute verbose.
10 11 12 |
# File 'lib/baffle/options.rb', line 10 def verbose @verbose end |
Class Method Details
.parse(args) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/baffle/options.rb', line 31 def self.parse(args) = Options.new opts = OptionParser.new do |opts| opts.program_name = "baffle" opts.version = "0.2.0" opts. = "Usage: #{opts.program_name} [options] bssid essid" opts.separator("") opts.separator("Fingerprinting options:") opts.on("-i INTERFACE", "--interface INTERFACE", "The INTERFACE to use for both injection and capture (default: ath0)") { |interface| .interface = interface } opts.on("-j INTERFACE", "--inject INTERFACE", "The INTERFACE to use for injection (default: ath0)") { |interface| .inject = interface } opts.on("-c INTERFACE", "--capture INTERFACE", "The INTERFACE to use for capture (default: ath0)") { |interface| .capture = interface } opts.on("-d DRIVER", "--driver DRIVER", "The driver used for injection (default: madwifing)") { |driver| .driver = driver } opts.on("-h CHANNEL", "--channel CHANNEL", "The channel to listen on (default: 11)") { |channel| .channel = channel.to_i } opts.separator("") opts.separator("Output options:") opts.on("-f SVGPREFIX", "--fpdiagram SVGPREFIX", "Write a fingerprint diagram for each probe used, using SVGPREFIX") { |svgprefix| .fpdiagram = svgprefix } opts.on("-p SVGPREFIX", "--plot SVGPREFIX", "Write a plot file for each probe used, using SVGPREFIX") { |svgprefix| .plot_prefix = svgprefix } opts.separator("") opts.separator("Training options:") opts.on("-t", "--train", "Train baffle with a new device fingerprint") { .train = true } opts.separator("") opts.separator("Common options:") opts.on("-v", "--verbose", "More detailed output") { .verbose = true } opts.on("-?", "--help", "Show this message") { puts opts.help; exit } opts.on("--version", "Print the version") { puts opts.ver; exit } opts.separator("") opts.separator("Other options:") opts.on("-g", "--gui", "Show gui") { .gui = true } end bssid, essid = opts.parse!(args) if bssid =~ /^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$/ .bssid = bssid end .essid = essid unless .gui? || (.bssid && .essid) puts opts.help exit end end |
Instance Method Details
#gui? ⇒ Boolean
28 |
# File 'lib/baffle/options.rb', line 28 def gui?; @gui == true; end |
#interface=(value) ⇒ Object
29 |
# File 'lib/baffle/options.rb', line 29 def interface=(value); self.inject = value; self.capture = value; end |
#train? ⇒ Boolean
26 |
# File 'lib/baffle/options.rb', line 26 def train?; @train == true; end |
#verbose? ⇒ Boolean
27 |
# File 'lib/baffle/options.rb', line 27 def verbose?; @verbose == true; end |