wifimap 0.2.1 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6954b6a9459e13bad3bc1ee5b0a41e85e8483b7babbd6f39c164522f4c567b7d
4
- data.tar.gz: 5bcad22af3b701ba63814135aa74c92fbf1ddee53369056ae5df7704883807d1
3
+ metadata.gz: faaa8901db0fadf9f467ec4a447ce877bfbd1f9cc1ccd24785423c7677c5c838
4
+ data.tar.gz: 5b9a580245f96c3ccc6a1254ea0571d82d5afe77d8ff0db360685103b6ea0c01
5
5
  SHA512:
6
- metadata.gz: b47191cb870ac0ed58c5897a778a35c10cdb52be880789b7296e0c0ede1ce415abc47bdfe56a9bbd692ba7fe10dc387089f92fdaf28343956b862bf6f4ed592c
7
- data.tar.gz: f196cea86d4bb6385e1284621a992726367c75058873c671b2c7b5e84482d38ed0e6ad3cb4d91410ab11a1fc875da69584d2689ce8df40f657f2e67b99090bac
6
+ metadata.gz: 7a26c406095c9b9f8627f456ea49cf11d74f645d912df1a496d75c9cd1c55a1eed0083c8559716a6a3b5387c783a72d3ab787e9d752c770c090d354cfea88013
7
+ data.tar.gz: a04a5a7d0121bb09957f97d4b922ae9b5c40bbead9322a222e6631f7f3d0c2acdb7b72595c166031559d02b7d1ce666700df08100ee9527f7555ee86e8b6bcb0
@@ -1,3 +1,6 @@
1
+ # v0.2.2
2
+ - Refactoring.
3
+
1
4
  # v0.2.1
2
5
  - Fix bug with sniff-probes parse method.
3
6
 
data/Gemfile CHANGED
@@ -1,8 +1,11 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in wifimap.gemspec
4
6
  gemspec
5
7
 
6
- gem "rake", "~> 12.3"
7
- gem "rspec", "~> 3.0"
8
- gem 'coveralls', require: false
8
+ gem 'coveralls', require: false
9
+ gem 'guard-rspec'
10
+ gem 'rake', '~> 12.3'
11
+ gem 'rspec', '~> 3.0'
@@ -1,12 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- wifimap (0.2.1)
4
+ wifimap (0.2.2)
5
5
  louis
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
+ coderay (1.1.3)
10
11
  coveralls (0.8.23)
11
12
  json (>= 1.8, < 3)
12
13
  simplecov (~> 0.16.1)
@@ -15,9 +16,40 @@ GEM
15
16
  tins (~> 1.6)
16
17
  diff-lcs (1.3)
17
18
  docile (1.3.2)
19
+ ffi (1.13.1)
20
+ formatador (0.2.5)
21
+ guard (2.16.2)
22
+ formatador (>= 0.2.4)
23
+ listen (>= 2.7, < 4.0)
24
+ lumberjack (>= 1.0.12, < 2.0)
25
+ nenv (~> 0.1)
26
+ notiffany (~> 0.0)
27
+ pry (>= 0.9.12)
28
+ shellany (~> 0.0)
29
+ thor (>= 0.18.1)
30
+ guard-compat (1.2.1)
31
+ guard-rspec (4.7.3)
32
+ guard (~> 2.1)
33
+ guard-compat (~> 1.1)
34
+ rspec (>= 2.99.0, < 4.0)
18
35
  json (2.3.0)
36
+ listen (3.2.1)
37
+ rb-fsevent (~> 0.10, >= 0.10.3)
38
+ rb-inotify (~> 0.9, >= 0.9.10)
19
39
  louis (2.2.4)
40
+ lumberjack (1.2.5)
41
+ method_source (1.0.0)
42
+ nenv (0.3.0)
43
+ notiffany (0.1.3)
44
+ nenv (~> 0.1)
45
+ shellany (~> 0.0)
46
+ pry (0.13.1)
47
+ coderay (~> 1.1)
48
+ method_source (~> 1.0)
20
49
  rake (12.3.3)
50
+ rb-fsevent (0.10.4)
51
+ rb-inotify (0.10.1)
52
+ ffi (~> 1.0)
21
53
  rspec (3.9.0)
22
54
  rspec-core (~> 3.9.0)
23
55
  rspec-expectations (~> 3.9.0)
@@ -31,6 +63,7 @@ GEM
31
63
  diff-lcs (>= 1.2.0, < 2.0)
32
64
  rspec-support (~> 3.9.0)
33
65
  rspec-support (3.9.0)
66
+ shellany (0.0.1)
34
67
  simplecov (0.16.1)
35
68
  docile (~> 1.1)
36
69
  json (>= 1.8, < 3)
@@ -48,6 +81,7 @@ PLATFORMS
48
81
 
49
82
  DEPENDENCIES
50
83
  coveralls
84
+ guard-rspec
51
85
  rake (~> 12.3)
52
86
  rspec (~> 3.0)
53
87
  wifimap!
@@ -0,0 +1,42 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %w(app lib config test spec features) \
6
+ # .select{|d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist")}
7
+
8
+ ## Note: if you are using the `directories` clause above and you are not
9
+ ## watching the project directory ('.'), then you will want to move
10
+ ## the Guardfile to a watched dir and symlink it back, e.g.
11
+ #
12
+ # $ mkdir config
13
+ # $ mv Guardfile config/
14
+ # $ ln -s config/Guardfile .
15
+ #
16
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
+
18
+ # Note: The cmd option is now required due to the increasing number of ways
19
+ # rspec may be run, below are examples of the most common uses.
20
+ # * bundler: 'bundle exec rspec'
21
+ # * bundler binstubs: 'bin/rspec'
22
+ # * spring: 'bin/rspec' (This will use spring if running and you have
23
+ # installed the spring binstubs per the docs)
24
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
25
+ # * 'just' rspec: 'rspec'
26
+
27
+ guard :rspec, cmd: "bundle exec rspec" do
28
+ require "guard/rspec/dsl"
29
+ dsl = Guard::RSpec::Dsl.new(self)
30
+
31
+ # Feel free to open issues for suggestions and improvements
32
+
33
+ # RSpec files
34
+ rspec = dsl.rspec
35
+ watch(rspec.spec_helper) { rspec.spec_dir }
36
+ watch(rspec.spec_support) { rspec.spec_dir }
37
+ watch(rspec.spec_files)
38
+
39
+ # Ruby files
40
+ ruby = dsl.ruby
41
+ dsl.watch_spec_files_for(ruby.lib_files)
42
+ end
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # Wifimap
2
+
2
3
  [![Build Status](https://travis-ci.com/gpaddis/wifimap.svg?branch=master)](https://travis-ci.com/gpaddis/wifimap)
3
4
  [![Coverage Status](https://coveralls.io/repos/github/gpaddis/wifimap/badge.svg?branch=master)](https://coveralls.io/github/gpaddis/wifimap?branch=master)
4
5
 
@@ -67,13 +68,8 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
67
68
 
68
69
  ## Contributing
69
70
 
70
- Bug reports and pull requests are welcome on GitHub at https://github.com/gpaddis/wifimap. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/wifimap/blob/master/CODE_OF_CONDUCT.md).
71
-
71
+ Bug reports and pull requests are welcome on GitHub at https://github.com/gpaddis/wifimap.
72
72
 
73
73
  ## License
74
74
 
75
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
76
-
77
- ## Code of Conduct
78
-
79
- Everyone interacting in the Wifimap project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/wifimap/blob/master/CODE_OF_CONDUCT.md).
75
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
6
- task :default => :spec
8
+ task default: :spec
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "bundler/setup"
4
- require "wifimap"
4
+ require 'bundler/setup'
5
+ require 'wifimap'
5
6
 
6
7
  # You can add fixtures and/or initialization code here to make experimenting
7
8
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +11,5 @@ require "wifimap"
10
11
  # require "pry"
11
12
  # Pry.start
12
13
 
13
- require "irb"
14
+ require 'irb'
14
15
  IRB.start(__FILE__)
@@ -1,26 +1,30 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'wifimap/access_point'
4
+ require 'wifimap/mac'
5
+ require 'wifimap/parsable'
6
+ require 'wifimap/parser_factory'
7
+ require 'wifimap/station'
3
8
  require 'wifimap/version'
4
- require 'wifimap/parser'
9
+
5
10
  require 'wifimap/parser/airodump'
6
11
  require 'wifimap/parser/sniff_probes'
7
12
 
8
13
  module Wifimap
9
14
  class Error < StandardError; end
10
15
 
11
- # Parse the content of a dump file and return a hash of APs, stations and probes.
16
+ # Parse the content of a dump file and return a parser instance.
17
+ #
18
+ # @param [String] file_content
19
+ # @return [Wifimap::Parser::*] a parser instance
12
20
  def self.parse(file_content)
13
- case Wifimap::Parser.dump_format(file_content)
14
- when :airodump
15
- Wifimap::Parser::Airodump.new(file_content)
16
- when :sniff_probes
17
- Wifimap::Parser::SniffProbes.new(file_content)
18
- else
19
- raise Error, 'Unsupported dump format'
20
- end
21
+ Wifimap::ParserFactory.create(file_content)
21
22
  end
22
23
 
23
24
  # A wrapper on .parse to read directly from a file.
25
+ #
26
+ # @param [String] filename
27
+ # @return [Wifimap::Parser::*] a parser instance
24
28
  def self.parse_file(filename)
25
29
  file_content = File.read(filename)
26
30
  parse(file_content)
@@ -11,6 +11,8 @@ module Wifimap
11
11
  end
12
12
 
13
13
  # Get the device manufacturer based on the bssid.
14
+ #
15
+ # @return [String]
14
16
  def manufacturer
15
17
  Mac.manufacturer(bssid)
16
18
  end
@@ -5,11 +5,17 @@ require 'louis'
5
5
  module Wifimap
6
6
  class Mac
7
7
  # Return true if the mac format is correct, false otherwise.
8
+ #
9
+ # @param [String] mac
10
+ # @return [Boolean]
8
11
  def self.valid?(mac)
9
12
  mac =~ /([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})/ ? true : false
10
13
  end
11
14
 
12
15
  # Get the manufacturer for the given mac address.
16
+ #
17
+ # @param [String] mac
18
+ # @return [String]
13
19
  def self.manufacturer(mac)
14
20
  Louis.lookup(mac)['long_vendor']
15
21
  end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Wifimap
4
+ # The parsable module contains some helper methods and must-implement
5
+ # directives for parser classes.
6
+ module Parsable
7
+ # Get the dump property for further processing.
8
+ #
9
+ # @return [String]
10
+ def dump
11
+ raise 'Error: the dump is empty' if @dump.nil?
12
+
13
+ @dump
14
+ end
15
+
16
+ # Split the dump by newline to get an array of all rows.
17
+ #
18
+ # @return [Array]
19
+ def dump_rows
20
+ dump.split("\n")
21
+ end
22
+
23
+ # To be implemented in the class.
24
+ def stations
25
+ raise ::NotImplementedError
26
+ end
27
+
28
+ # To be implemented in the class.
29
+ def access_points
30
+ raise ::NotImplementedError
31
+ end
32
+ end
33
+ end
@@ -1,54 +1,67 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'wifimap/mac'
4
- require 'wifimap/station'
5
- require 'wifimap/access_point'
6
-
7
3
  module Wifimap
8
4
  module Parser
9
5
  # Parse the content of an airodump.csv file.
10
6
  class Airodump
7
+ include Wifimap::Parsable
8
+
11
9
  def initialize(dump)
12
10
  @dump = dump
13
11
  end
14
12
 
15
13
  # Get the list of access points from the dump.
14
+ #
15
+ # @return [Array] of Wifimap::AccessPoint
16
16
  def access_points
17
- aps = @dump.split("\n").filter do |row|
18
- fields = row.split(',')
19
- channel = fields[3].to_i
20
- Mac.valid?(fields.first) && channel.between?(1, 16)
21
- end
22
-
23
- aps.map do |ap|
24
- fields = ap.split(',')
25
- AccessPoint.new(
26
- bssid: fields.first,
27
- privacy: fields[5].strip,
28
- essid: fields[13].strip
29
- )
30
- end
17
+ dump_row_fields
18
+ .filter { |row| valid_access_point?(row) }
19
+ .map do |fields|
20
+ AccessPoint.new(
21
+ bssid: fields.first,
22
+ privacy: fields[5].strip,
23
+ essid: fields[13].strip
24
+ )
25
+ end
31
26
  end
32
27
 
33
28
  # Get the list of stations from the dump.
29
+ #
30
+ # @return [Array] of Wifimap::Station
34
31
  def stations
35
- stations = @dump.split("\n").filter do |row|
36
- fields = row.split(',')
37
- power = fields[3].to_i
38
- Mac.valid?(fields.first) && power.negative?
39
- end
40
-
41
- stations.map do |row|
42
- fields = row.split(',')
43
- station = Station.new(mac: fields.first)
44
- unless fields[5].include?('(not associated)')
45
- station.associations << fields[5].strip
32
+ dump_row_fields
33
+ .filter { |row| valid_station?(row) }
34
+ .map do |fields|
35
+ station = Station.new(mac: fields.first)
36
+ station.associations << fields[5].strip unless fields[5].include?('(not associated)')
37
+ station.probes << fields[6].strip unless fields[6].strip.empty?
38
+ station
46
39
  end
40
+ end
41
+
42
+ # Get an array of all dump rows split by comma.
43
+ #
44
+ # @return [Array]
45
+ private def dump_row_fields
46
+ dump_rows.each.map { |row| row.split(',') }
47
+ end
47
48
 
48
- station.probes << fields[6].strip unless fields[6].strip.empty?
49
+ # Check if the fields correspond to a valid access point.
50
+ #
51
+ # @param [Array] fields
52
+ # @return [Boolean]
53
+ private def valid_access_point?(fields)
54
+ channel = fields[3].to_i
55
+ Mac.valid?(fields.first) && channel.between?(1, 16)
56
+ end
49
57
 
50
- station
51
- end
58
+ # Check if the fields correspond to a valid access station.
59
+ #
60
+ # @param [Array] fields
61
+ # @return [Boolean]
62
+ private def valid_station?(fields)
63
+ power = fields[3].to_i
64
+ Mac.valid?(fields.first) && power.negative?
52
65
  end
53
66
  end
54
67
  end
@@ -1,23 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'wifimap/station'
4
-
5
3
  module Wifimap
6
4
  module Parser
7
5
  # Parse the content of a sniff-probes file.
8
6
  class SniffProbes
7
+ include Wifimap::Parsable
8
+
9
9
  attr_reader :access_points
10
10
 
11
+ # @param [String] dump
11
12
  def initialize(dump)
12
13
  @dump = dump
13
14
  @access_points = []
14
15
  end
15
16
 
16
17
  # Get the list of stations from the dump.
18
+ #
19
+ # @return [Array] of Wifimap::Station
17
20
  def stations
18
21
  unique_macs.map do |mac|
19
22
  station = Station.new(mac: mac)
20
- rows.each do |row|
23
+ dump_rows.each do |row|
21
24
  fields = row.split('"')
22
25
  unless station.probes.include?(fields[1])
23
26
  station.probes << fields[1] if fields[0].include?(mac)
@@ -27,16 +30,11 @@ module Wifimap
27
30
  end
28
31
  end
29
32
 
30
- private
31
-
32
- # Return an array of lines from the dump content.
33
- def rows
34
- @dump.split("\n")
35
- end
36
-
37
33
  # Return all unique mac addresses.
38
- def unique_macs
39
- rows.map { |row| row.split[2] }.uniq
34
+ #
35
+ # @return [Array]
36
+ private def unique_macs
37
+ dump_rows.map { |row| row.split[2] }.uniq
40
38
  end
41
39
  end
42
40
  end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Wifimap
4
+ # Instantiate the correct parser class according to the dump format.
5
+ module ParserFactory
6
+ class << self
7
+ # Instantiate the parser factory or raise an error
8
+ # if the dump is not supported.
9
+ def create(file_content)
10
+ case dump_format(file_content)
11
+ when :airodump
12
+ Wifimap::Parser::Airodump.new(file_content)
13
+ when :sniff_probes
14
+ Wifimap::Parser::SniffProbes.new(file_content)
15
+ else
16
+ raise Error, 'Unsupported dump format'
17
+ end
18
+ end
19
+
20
+ # Check the file content and identify the correct dump format.
21
+ #
22
+ # @param [String] file_content
23
+ # @return [Symbol|Nil]
24
+ def dump_format(file_content)
25
+ return :airodump if airodump_format?(file_content)
26
+ return :sniff_probes if sniff_probes_format?(file_content)
27
+ end
28
+
29
+ # @param [String] file_content
30
+ # @return [Boolean]
31
+ private def airodump_format?(file_content)
32
+ airodump_header = 'BSSID, First time seen, Last time seen, channel, Speed, Privacy, Cipher, Authentication, Power'
33
+ file_content.include?(airodump_header)
34
+ end
35
+
36
+ # @param [String] file_content
37
+ # @return [Boolean]
38
+ private def sniff_probes_format?(file_content)
39
+ file_content.split("\n").all? do |row|
40
+ fields = row.split
41
+ fields[1].include?('dBm') && Wifimap::Mac.valid?(fields[2])
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -5,6 +5,7 @@ module Wifimap
5
5
  attr_reader :mac
6
6
  attr_accessor :associations, :probes
7
7
 
8
+ # @param [String] mac
8
9
  def initialize(mac:)
9
10
  @mac = mac
10
11
  @associations = []
@@ -12,6 +13,8 @@ module Wifimap
12
13
  end
13
14
 
14
15
  # Get the device manufacturer based on the mac.
16
+ #
17
+ # @return [String]
15
18
  def manufacturer
16
19
  Mac.manufacturer(mac)
17
20
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Wifimap
2
- VERSION = "0.2.1"
4
+ VERSION = '0.2.2'
3
5
  end
@@ -6,7 +6,6 @@ Gem::Specification.new do |spec|
6
6
  spec.name = 'wifimap'
7
7
  spec.version = Wifimap::VERSION
8
8
  spec.authors = ['Gianpiero Addis']
9
- spec.email = ['gianpiero.addis@gmail.com']
10
9
 
11
10
  spec.summary = 'Parse wifi sniffer dump files.'
12
11
  spec.homepage = 'https://github.com/gpaddis/wifimap'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wifimap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gianpiero Addis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-18 00:00:00.000000000 Z
11
+ date: 2020-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: louis
@@ -25,8 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  description:
28
- email:
29
- - gianpiero.addis@gmail.com
28
+ email:
30
29
  executables: []
31
30
  extensions: []
32
31
  extra_rdoc_files: []
@@ -35,9 +34,9 @@ files:
35
34
  - ".rspec"
36
35
  - ".travis.yml"
37
36
  - CHANGELOG.md
38
- - CODE_OF_CONDUCT.md
39
37
  - Gemfile
40
38
  - Gemfile.lock
39
+ - Guardfile
41
40
  - LICENSE.txt
42
41
  - README.md
43
42
  - Rakefile
@@ -46,9 +45,10 @@ files:
46
45
  - lib/wifimap.rb
47
46
  - lib/wifimap/access_point.rb
48
47
  - lib/wifimap/mac.rb
49
- - lib/wifimap/parser.rb
48
+ - lib/wifimap/parsable.rb
50
49
  - lib/wifimap/parser/airodump.rb
51
50
  - lib/wifimap/parser/sniff_probes.rb
51
+ - lib/wifimap/parser_factory.rb
52
52
  - lib/wifimap/station.rb
53
53
  - lib/wifimap/version.rb
54
54
  - wifimap.gemspec
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at gianpiero.addis@gmail.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [https://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: https://contributor-covenant.org
74
- [version]: https://contributor-covenant.org/version/1/4/
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'wifimap/mac'
4
-
5
- module Wifimap
6
- module Parser
7
- # Check the file content and identify the correct dump format.
8
- def self.dump_format(file_content)
9
- return :airodump if airodump_format?(file_content)
10
- return :sniff_probes if sniff_probes_format?(file_content)
11
- end
12
-
13
- class << self
14
- private
15
-
16
- def airodump_format?(file_content)
17
- airodump_header = 'BSSID, First time seen, Last time seen, channel, Speed, Privacy, Cipher, Authentication, Power'
18
- file_content.include?(airodump_header)
19
- end
20
-
21
- def sniff_probes_format?(file_content)
22
- file_content.split("\n").all? do |row|
23
- fields = row.split
24
- fields[1].include?('dBm') && Wifimap::Mac.valid?(fields[2])
25
- end
26
- end
27
- end
28
- end
29
- end