packetman 0.1.3 → 0.1.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/config/applications.yml +7 -0
- data/lib/packetman/config.rb +12 -0
- data/lib/packetman/filter.rb +1 -1
- data/lib/packetman/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3009b4eaadbac87e9eb30cdfce2b5514dab7e1dd
|
4
|
+
data.tar.gz: 72ac9e408e40c1ca6d8547c4a2761ab0f1f92357
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a8a7307b4d2a614a40bfedddcfb93830222f3942f9a3ba14e6faac6364a3277620569b367ab52999b34800c18421227d94ed0aa0d7f6fb1babf9f83d402eee2
|
7
|
+
data.tar.gz: 3bd51c16765436d178d6b718cfb40e411ba20362f134376fb6ed8f214f1d8e34a38918c48fa1f5b52f9992d6bc6b938a6d1eabd08665386b3234d3627e21be47
|
data/lib/packetman/config.rb
CHANGED
@@ -14,6 +14,10 @@ module Packetman
|
|
14
14
|
@protocols ||= YAML.load(File.read(File.expand_path('../../../config/protocols.yml', __FILE__)))
|
15
15
|
end
|
16
16
|
|
17
|
+
def applications
|
18
|
+
@applications ||= YAML.load(File.read(File.expand_path('../../../config/applications.yml', __FILE__)))
|
19
|
+
end
|
20
|
+
|
17
21
|
def payload_query
|
18
22
|
protocols[transport]['payload_query'] unless start_with_transport
|
19
23
|
end
|
@@ -26,10 +30,18 @@ module Packetman
|
|
26
30
|
end
|
27
31
|
end
|
28
32
|
|
33
|
+
# FIXME figure out a way to do defaults so this can just set defaults
|
34
|
+
def application_override(app_name)
|
35
|
+
applications[app_name].each do |key, value|
|
36
|
+
__send__("#{key}=", value)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
29
40
|
def opts
|
30
41
|
@opts ||= OptionParser.new do |opt|
|
31
42
|
opt.banner = "Usage: #{File.basename($PROGRAM_NAME)} [OPTIONS] FILTER_STRING"
|
32
43
|
opt.on("-p", "--protocol PROTO", protocols.keys, "Transport Protocol (#{protocols.keys.join(',')})") { |v| self.transport = v }
|
44
|
+
opt.on("-a", "--application APPLICATION", applications.keys, "Application Protocol (#{applications.keys.join(',')}) OVERRIDES ALL OTHER SETTINGS") { |v| application_override(v) }
|
33
45
|
opt.on("-t", "--transport", "OFFSET starts at transport header instead of data payload") { |v| self.start_with_transport = v }
|
34
46
|
opt.on("-r", "--radix RADIX", Integer, "Treat FILTER_STRING as RADIX instead of String") { |v| self.radix = v }
|
35
47
|
opt.on("-o", "--offset OFFSET", Integer, "Offset in bits") { |v| self.offset = v }
|
data/lib/packetman/filter.rb
CHANGED
@@ -53,7 +53,7 @@ module Packetman
|
|
53
53
|
|
54
54
|
# Binary string for _chr_ substituting wildcards as necessary
|
55
55
|
def bin_chr(chr)
|
56
|
-
chr =
|
56
|
+
chr = 0 if chr == config.wildcard
|
57
57
|
|
58
58
|
if config.radix
|
59
59
|
raise "invalid character '#{chr}' for radix=#{config.radix}" if chr.downcase != chr.to_i(config.radix).to_s(config.radix).downcase
|
data/lib/packetman/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: packetman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Scholl
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: terminal-table
|
@@ -115,6 +115,7 @@ files:
|
|
115
115
|
- bin/console
|
116
116
|
- bin/setup
|
117
117
|
- circle.yml
|
118
|
+
- config/applications.yml
|
118
119
|
- config/protocols.yml
|
119
120
|
- exe/packetman
|
120
121
|
- lib/packetman.rb
|
@@ -150,3 +151,4 @@ signing_key:
|
|
150
151
|
specification_version: 4
|
151
152
|
summary: Advanced tcpdump and Wiresharp filter generator.
|
152
153
|
test_files: []
|
154
|
+
has_rdoc:
|