packetgen 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/bin/pgconsole +50 -13
- data/lib/packetgen/version.rb +1 -1
- data/packetgen.gemspec +0 -1
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e814826688f3a780a9c222dcc6fd5a2a3ae7daf0
|
4
|
+
data.tar.gz: ccb268a111976248f6dd932c3556874c0f639938
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d2b48c08caafa50c4ee4ce3812bc3e7122ca69ccc00a91dc2c75b448dd78fb85cd18c8e352773b81e27e6f7b69b05417a3b953e131a2bd5b775c924b3da1ef3
|
7
|
+
data.tar.gz: e1c2317f4d950c8b78bec81dd4944af29f0faa5ee21a949dd32422827689e752c43acbde5c12784ddd82fa56bfdf99f60449ed90faba2c530f2daadf3658c9a3
|
data/README.md
CHANGED
@@ -132,7 +132,7 @@ pkt.myheader.field2.read 0x01
|
|
132
132
|
```
|
133
133
|
|
134
134
|
## Interactive console
|
135
|
-
PacketGen provides an interactive console
|
135
|
+
PacketGen provides an interactive console: `pgconsole`.
|
136
136
|
|
137
137
|
In this console, context includes PacketGen module to give direct access to PacketGen
|
138
138
|
classes. A special `config` object gives local network configuration:
|
@@ -146,6 +146,8 @@ classes. A special `config` object gives local network configuration:
|
|
146
146
|
pg(main)> packets = capture(max: 5)
|
147
147
|
pg(main)> exit
|
148
148
|
|
149
|
+
If `pry` gem is installed, it is used as backend for `pgconsole`, else IRB is used.
|
150
|
+
|
149
151
|
## Pull requests?
|
150
152
|
|
151
153
|
yes
|
data/bin/pgconsole
CHANGED
@@ -1,9 +1,17 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'bundler/setup'
|
4
3
|
require 'packetgen'
|
5
4
|
require 'packetgen/config'
|
6
|
-
|
5
|
+
|
6
|
+
use_pry = false
|
7
|
+
begin
|
8
|
+
require 'pry'
|
9
|
+
use_pry = true
|
10
|
+
puts "use Pry!"
|
11
|
+
rescue LoadError
|
12
|
+
require 'irb'
|
13
|
+
require 'irb/completion'
|
14
|
+
end
|
7
15
|
|
8
16
|
include PacketGen
|
9
17
|
|
@@ -23,19 +31,48 @@ def write(filename, packets)
|
|
23
31
|
Packet.write filename, packets
|
24
32
|
end
|
25
33
|
|
26
|
-
@config = Config.new
|
34
|
+
@config = PacketGen::Config.new
|
27
35
|
|
28
36
|
def config
|
29
37
|
@config
|
30
38
|
end
|
31
39
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
Pry.
|
40
|
+
def start_message(use_pry)
|
41
|
+
print "\npgconsole uses #{use_pry ? 'Pry' : 'IRB'}\n\n"
|
42
|
+
end
|
43
|
+
|
44
|
+
start_message use_pry
|
45
|
+
|
46
|
+
if use_pry
|
47
|
+
Pry.config.prompt = [
|
48
|
+
proc { |target_self, nest_level, pry|
|
49
|
+
"#{pry.config.prompt_name}(#{Pry.view_clip(target_self)})#{":#{nest_level}" unless nest_level.zero?}> "
|
50
|
+
},
|
51
|
+
proc { |target_self, nest_level, pry|
|
52
|
+
"#{pry.config.prompt_name}(#{Pry.view_clip(target_self)})#{":#{nest_level}" unless nest_level.zero?}* "
|
53
|
+
}
|
54
|
+
]
|
55
|
+
Pry.config.prompt_name = 'pg'
|
56
|
+
Pry.start
|
57
|
+
else
|
58
|
+
IRB.setup nil
|
59
|
+
irb = IRB::Irb.new(IRB::WorkSpace.new(binding))
|
60
|
+
IRB.conf[:MAIN_CONTEXT] = irb.context
|
61
|
+
irb.context.auto_indent_mode = true
|
62
|
+
irb.context.prompt_i = "pg(%m)>"
|
63
|
+
irb.context.prompt_s = "pg(%m)*"
|
64
|
+
irb.context.prompt_c = "pg(%m)*"
|
65
|
+
|
66
|
+
trap("SIGINT") do
|
67
|
+
irb.signal_handle
|
68
|
+
end
|
69
|
+
|
70
|
+
begin
|
71
|
+
catch(:IRB_EXIT) do
|
72
|
+
irb.eval_input
|
73
|
+
end
|
74
|
+
ensure
|
75
|
+
IRB.irb_at_exit
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
data/lib/packetgen/version.rb
CHANGED
data/packetgen.gemspec
CHANGED
@@ -24,7 +24,6 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.required_ruby_version = '>= 2.1.0'
|
25
25
|
|
26
26
|
spec.add_dependency 'pcaprub', '~>0.12.4'
|
27
|
-
spec.add_dependency 'pry', '~>0.10'
|
28
27
|
spec.add_dependency 'network_interface'
|
29
28
|
spec.add_dependency 'net-proto', '~>1.2'
|
30
29
|
spec.add_dependency 'rasn1', '~>0.3', '>= 0.3.1'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: packetgen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvain Daubert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pcaprub
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.12.4
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: pry
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0.10'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0.10'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: network_interface
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -261,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
261
247
|
version: '0'
|
262
248
|
requirements: []
|
263
249
|
rubyforge_project:
|
264
|
-
rubygems_version: 2.
|
250
|
+
rubygems_version: 2.6.13
|
265
251
|
signing_key:
|
266
252
|
specification_version: 4
|
267
253
|
summary: Network packet generator and analyzor
|