pstream 0.1.8 → 0.1.9

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pstream.rb +12 -14
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1ee81e7ea543491338bb800254b0b2cc4c0850c3
4
- data.tar.gz: d877d6ff3c9deca5cc7b3ef7e07531e9e1f587de
3
+ metadata.gz: 9b5ec9929e9bd48fecc32ce9e9f5ce1703675390
4
+ data.tar.gz: 95bf28528095b9f9df126d69777411e3f0687a56
5
5
  SHA512:
6
- metadata.gz: f65be907ced9b779793e85607d5b0e7a80306d8527dd7981890c0585da482cd4ab35a2de2ede23aa53b5c73b3ed224ec02e20aa76bc6c6a7f4a5a42d23ee5447
7
- data.tar.gz: 6cace69f3b2e5eaa02ffc81dffb7a90bda72cd9dfe6413547f532f4ed289916fa2ca92558853679a9e442e2858300963e456e7e75eb7e628f351641174f0cdca
6
+ metadata.gz: f2fda90d6e63ab41c12c92a6e7f602c5cce20cb335334c09db4d179affeb6d23ba98c94aa742bf32089005ff95284d4eced38b3bfff8036004d1bcda42376975
7
+ data.tar.gz: ffe879ba24f2b9baec9e6d69b7fe5fc3067986fc0a13cbbc1543fe1aa6845f9c3c1cf065f7d91ed2d990b458c8161acec593b3848f0db5a16361190cf0d0a4ad
data/lib/pstream.rb CHANGED
@@ -6,16 +6,14 @@ class PStream
6
6
 
7
7
  def cipher_negotiations
8
8
  negotiations = Hash.new
9
+ negotiation = nil
10
+ hello = nil
9
11
 
10
12
  # List ciphers during ssl handshake
11
- out = %x(
13
+ %x(
12
14
  tshark -r #{@pcap} -Y ssl.handshake.ciphersuite -V 2>&1 \
13
15
  | \grep -E "(Handshake|Internet) Prot|Cipher Suite"
14
- )
15
-
16
- negotiation = nil
17
- hello = nil
18
- out.split("\n").each do |line|
16
+ ).split("\n").each do |line|
19
17
  case line.gsub(/^ +/, "")
20
18
  when /^Cipher Suite:/
21
19
  m = line.match(/Cipher Suite: ([^ ]+) (.*)$/)
@@ -154,13 +152,11 @@ class PStream
154
152
 
155
153
  streams = Array.new
156
154
 
157
- out = %x(
155
+ count = 0
156
+ %x(
158
157
  tshark -r #{@pcap} -z conv,#{prot} 2>&1 | \grep -E "<->" \
159
158
  | awk '{print $1, $2, $3, "|", $8, "Frames"}'
160
- )
161
-
162
- count = 0
163
- out.split("\n").each do |line|
159
+ ).split("\n").each do |line|
164
160
  desc, frames = line.split(" | ")
165
161
  streams.push(
166
162
  Stream.new(
@@ -205,7 +201,7 @@ class PStream
205
201
 
206
202
  # List streams
207
203
  ["tcp", "udp"].each do |prot|
208
- ret.push(colorize_header("#{prot} streams:"))
204
+ ret.push(colorize_header("#{prot.upcase} streams:"))
209
205
  @streams[prot].each do |stream|
210
206
  ret.push(colorize_stream(stream))
211
207
  end
@@ -214,8 +210,10 @@ class PStream
214
210
 
215
211
  # List ciphers that were actually selected
216
212
  ret.push(colorize_header("Ciphers in use:"))
217
- cipher_negotiations.each do |negotiation|
218
- ret.push(colorize_cipher_suite(negotiation.suite))
213
+ cipher_negotiations.map do |negotiation|
214
+ negotiation.suite
215
+ end.uniq.each do |suite|
216
+ ret.push(colorize_cipher_suite(suite))
219
217
  end
220
218
 
221
219
  return ret.join("\n")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pstream
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Whittaker