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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ee06237cff9b2ffb77984c3d3ed1447e9fe4ba8
4
- data.tar.gz: 58b85bd5f40726dbe58271425c6247556659dcfe
3
+ metadata.gz: 3009b4eaadbac87e9eb30cdfce2b5514dab7e1dd
4
+ data.tar.gz: 72ac9e408e40c1ca6d8547c4a2761ab0f1f92357
5
5
  SHA512:
6
- metadata.gz: cfa7fe1df88846174e93d98003b4399da5b97162b3ccf8c9a23895d87e4d16a69da654c1da5772dd98eb0ce06afe97033b1adbb36913e3e1c470efd3a3dfe964
7
- data.tar.gz: 48890d5a660428531b7d17f6338bcba85f142ec6b76ce09519632fddd2a7536f9079432e89065f817a5de5a1e07fc997bd24e3ee5ec9b45c5d70211314353a68
6
+ metadata.gz: 2a8a7307b4d2a614a40bfedddcfb93830222f3942f9a3ba14e6faac6364a3277620569b367ab52999b34800c18421227d94ed0aa0d7f6fb1babf9f83d402eee2
7
+ data.tar.gz: 3bd51c16765436d178d6b718cfb40e411ba20362f134376fb6ed8f214f1d8e34a38918c48fa1f5b52f9992d6bc6b938a6d1eabd08665386b3234d3627e21be47
@@ -0,0 +1,7 @@
1
+ ---
2
+ dns: # packetman -tbo 21 -p udp -w '.' 'google.com'
3
+ :offset: 21
4
+ :start_with_transport: true
5
+ :offset_type: :bytes
6
+ :wildcard: .
7
+ :transport: udp
@@ -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 }
@@ -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 = '0' if chr == config.wildcard
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
@@ -1,3 +1,3 @@
1
1
  module Packetman
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
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.3
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: 2015-11-30 00:00:00.000000000 Z
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: