rabid 0.0.1 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +2 -1
  3. data/bin/rabid +3 -10
  4. data/lib/bigipcookie.rb +28 -12
  5. data/lib/bigipcookie/version.rb +1 -1
  6. metadata +24 -77
  7. data/.gitignore +0 -7
  8. data/.rubocop.yml +0 -22
  9. data/.yardopts +0 -4
  10. data/.yardopts-dev +0 -6
  11. data/Gemfile +0 -6
  12. data/Gemfile.lock +0 -56
  13. data/README.md +0 -15
  14. data/Rakefile +0 -10
  15. data/bigipcookie.gemspec +0 -49
  16. data/bin/rabid_setup +0 -6
  17. data/docs/.nojekyll +0 -0
  18. data/docs/About.md +0 -11
  19. data/docs/CHANGELOG.md +0 -1
  20. data/docs/README.md +0 -13
  21. data/docs/_coverpage.md +0 -14
  22. data/docs/_media/logo.png +0 -0
  23. data/docs/_navbar.md +0 -2
  24. data/docs/_sidebar.md +0 -15
  25. data/docs/index.html +0 -31
  26. data/docs/pages/demo.md +0 -3
  27. data/docs/pages/documentation.md +0 -34
  28. data/docs/pages/install.md +0 -60
  29. data/docs/pages/publishing.md +0 -38
  30. data/docs/pages/quick-start.md +0 -30
  31. data/docs/pages/usage.md +0 -53
  32. data/docs/vendor/docsify.js +0 -1
  33. data/docs/vendor/plugins/emoji.min.js +0 -1
  34. data/docs/vendor/plugins/search.min.js +0 -1
  35. data/docs/vendor/prismjs/components/prism-ruby.min.js +0 -1
  36. data/docs/vendor/themes/vue.css +0 -1
  37. data/docs/why.md +0 -46
  38. data/docs/yard/BigIPCookie.html +0 -159
  39. data/docs/yard/BigIPCookie/Decode.html +0 -782
  40. data/docs/yard/Version.html +0 -126
  41. data/docs/yard/_index.html +0 -138
  42. data/docs/yard/class_list.html +0 -51
  43. data/docs/yard/css/common.css +0 -1
  44. data/docs/yard/css/full_list.css +0 -58
  45. data/docs/yard/css/style.css +0 -496
  46. data/docs/yard/file.LICENSE.html +0 -70
  47. data/docs/yard/file.README.html +0 -109
  48. data/docs/yard/file_list.html +0 -61
  49. data/docs/yard/frames.html +0 -17
  50. data/docs/yard/index.html +0 -109
  51. data/docs/yard/js/app.js +0 -303
  52. data/docs/yard/js/full_list.js +0 -216
  53. data/docs/yard/js/jquery.js +0 -4
  54. data/docs/yard/method_list.html +0 -99
  55. data/docs/yard/top-level-namespace.html +0 -112
  56. data/package-lock.json +0 -154
  57. data/test/test_bigipcookie.rb +0 -54
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98987fe496586fce7a2692ffa657b10bab969977ca1ff1cf4db5eac89d13ddc4
4
- data.tar.gz: a3a8430704ea8b58e39a5fbe5f7b10371030261039e5f2874ce0f3104035d3d2
3
+ metadata.gz: a5699f2c4c79f71d44c6e7cd7dc3f89bb424bbcf7069293157ac0555d7270519
4
+ data.tar.gz: 7ec606ba5cd1e482edd19d32d519680137c3817197ae64cd67286b586cb8e721
5
5
  SHA512:
6
- metadata.gz: 5c74ef56c2317560de1f2ebc0432393ee04eacc4a40ed7d2ad02bf47496386950e75b62ecce05fb1e2f635f3c95b795deeebf45cd3d6d094566a13e6199a55be
7
- data.tar.gz: 62f44f2cfc9b1789dcf2dd82c8c5a9c8db302fb5b5a171f39376ab851b3f115844262799d908254633463b8d0647417f86de7204d6e9dd8dc7d6aaf05e46903c
6
+ metadata.gz: 8b062568f80e4d673e4bf99b20c9366cbd77bb0f1196897fe7d81cf6238a30332a32a63acfd2192ffdcaa2250c08cb02520445daf6065ad6af49a7acd7695f0a
7
+ data.tar.gz: 6ddee9719e5e74ca28a7188c5d68c60e44c7783879742fe1089dc7ea72a010b165e3055683f1baf135b9ecb32db4f63293147a1cd02a2f639a475ec5af131743
@@ -1,6 +1,7 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019 Alexandre ZANNI
3
+ Copyright (c) 2020-2020 Alexandre ZANNI
4
+ Copyright (c) 2019-2020 Alexandre ZANNI at Orange Cyberdefense
4
5
 
5
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
7
  of this software and associated documentation files (the "Software"), to deal
data/bin/rabid CHANGED
@@ -30,10 +30,12 @@ doc = <<~DOCOPT
30
30
  rabid 'rd5o00000000000000000000ffffc0000201o80'
31
31
  rabid 'CustomeCookieName=vi20010112000000000000000000000030.20480' --ipv6-long-format
32
32
  rabid 'BIGipServer~SuperPool=rd3o20010112000000000000000000000030o80' --debug
33
+ rabid 'BIGipServerhttp-pool=!LHmYFDA0qZyj4NoylBEaDn0/k2wesiGt0ANZhWaAohjULoWFXRc1b/yfibypy1qfBzD51kqvmwzfcy4='
33
34
  DOCOPT
34
35
 
35
36
  begin
36
37
  args = Docopt.docopt(doc, version: BigIPCookie::VERSION)
38
+ Paint.mode = 0 if args['--no-color']
37
39
  pp args if args['--debug']
38
40
  # use case 1, using the tool
39
41
  if args['<raw_cookie>']
@@ -42,16 +44,7 @@ begin
42
44
  opts[:ipv6compression] = 0 if args['--ipv6-long-format']
43
45
  bip.auto_decode(opts)
44
46
  # Display
45
- if args['--no-color']
46
- if args['--short']
47
- puts bip.decoded_cookie
48
- else
49
- puts "Pool name: #{bip.pool_name}"
50
- puts "Cookie type: #{bip.cookie_type}"
51
- puts "Raw cookie: #{bip.raw_cookie}"
52
- puts "Decoded cookie: #{bip.decoded_cookie}"
53
- end
54
- elsif args['--short']
47
+ if args['--short']
55
48
  puts Paint[bip.decoded_cookie, :green]
56
49
  else
57
50
  puts Paint['Pool name:', :white, :bold] + ' ' + bip.pool_name
@@ -85,15 +85,17 @@ class BigIPCookie
85
85
  opts[:reverse] = 0
86
86
  end
87
87
 
88
- if opts[:ipversion] == 4
88
+ case opts[:ipversion]
89
+ when 4
89
90
  opts[:joinchar] = '.'
90
91
  opts[:scanby] = 2
91
- elsif opts[:ipversion] == 6
92
+ when 6
92
93
  opts[:joinchar] = ':'
93
94
  opts[:scanby] = 4
94
95
  end
95
96
 
96
97
  ip = format('%02x', ip) if opts[:ip2hex] == 1 # ip to hex
98
+ ip = '0' + ip if ip.size.odd? # prepend a 0 when we have an odd number
97
99
  ip = ip.scan(/.{#{opts[:scanby]}}/) # split by n
98
100
  ip.reverse! if opts[:reverse] == 1 # reverse array
99
101
  ip = ip.map { |i| i.to_i(16) } if opts[:hex2ip] == 1 # hex to ip
@@ -164,12 +166,19 @@ class BigIPCookie
164
166
  return "[#{ip}%#{id}]:#{port}"
165
167
  end
166
168
 
169
+ # Return that the cookie is encrypted
170
+ # @param cookie [String] raw cookie value
171
+ # @return [String] Encrypted cookie detection message
172
+ def encrypted(_cookie)
173
+ return 'Unknown:Encrypted'
174
+ end
175
+
167
176
  # Automatically detect the BigIP cookie type
168
177
  # @param cookie [String] raw cookie value
169
178
  # @return [Integer] detected cookie code (mapped with {decode_cookie})
170
179
  def detect_cookie_type(cookie)
171
180
  ## IPv4 pool members
172
- return 400 if /[0-9]{10}\.[0-9]{5}\.0000/.match?(cookie)
181
+ return 400 if /[0-9]{1,10}\.[0-9]{1,7}\.0000/.match?(cookie)
173
182
 
174
183
  ## IPv4 pool members in non-default route domains
175
184
  return 401 if /rd([0-9]+)o00000000000000000000ffff([0-9a-zA-Z]{8})o
@@ -181,6 +190,9 @@ class BigIPCookie
181
190
  ## IPv6 pool members in non-default route domains
182
191
  return 601 if /rd([0-9]+)o([0-9a-zA-Z]{32})o([0-9]{1,5})/.match?(cookie)
183
192
 
193
+ ## Encrypted
194
+ return 999 if %r{!(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?}.match?(cookie)
195
+
184
196
  raise 'Unrecognized cookie'
185
197
  end
186
198
 
@@ -190,18 +202,22 @@ class BigIPCookie
190
202
  # @return [String] the decoded cookie value
191
203
  def decode_cookie(cookie, opts = {})
192
204
  number = detect_cookie_type(cookie)
193
- if number == 400
205
+ case number
206
+ when 400
194
207
  @cookie_type = 'IPv4 pool members'
195
208
  ipv4_pm(cookie)
196
- elsif number == 401
209
+ when 401
197
210
  @cookie_type = 'IPv4 pool members in non-default route domains'
198
211
  ipv4_pm_ndrd(cookie)
199
- elsif number == 600
212
+ when 600
200
213
  @cookie_type = 'IPv6 pool members'
201
214
  ipv6_pm(cookie, opts)
202
- elsif number == 601
215
+ when 601
203
216
  @cookie_type = 'IPv6 pool members in non-default route domains'
204
217
  ipv6_pm_ndrd(cookie, opts)
218
+ when 999
219
+ @cookie_type = 'Encrypted'
220
+ encrypted(cookie)
205
221
  else
206
222
  raise "Wrong cookie type numer: #{number}"
207
223
  end
@@ -211,7 +227,7 @@ class BigIPCookie
211
227
  # cookie name is used or if no cookie key was provided
212
228
  # @return the pool name
213
229
  def retrieve_pool_name
214
- pool_name = /BIGipServer(.+)=.+/.match(@raw_cookie).captures[0]
230
+ pool_name = /BIGipServer(.*?)=.+/.match(@raw_cookie).captures[0]
215
231
  return pool_name
216
232
  end
217
233
 
@@ -221,14 +237,14 @@ class BigIPCookie
221
237
  # @note
222
238
  # .yardopts-dev must be used to get {decode_ip} documentation
223
239
  def auto_decode(opts = {})
224
- if /\=/.match?(@raw_cookie) # if there is a key
240
+ if /=/.match?(@raw_cookie) # if there is a key
225
241
  if /^BIGipServer/.match?(@raw_cookie) # if default cookie name
226
242
  pool_name = retrieve_pool_name
227
- cookie_value = /^BIGipServer.+=(.+)/.match(@raw_cookie).captures[0]
243
+ cookie_value = /^BIGipServer.*?=(.+)/.match(@raw_cookie).captures[0]
228
244
  decoded_cookie = decode_cookie(cookie_value, opts)
229
245
  @pool_name = pool_name
230
246
  else # custom cookie name
231
- cookie_value = /.+=(.+)/.match(@raw_cookie).captures[0]
247
+ cookie_value = /.*?=(.+)/.match(@raw_cookie).captures[0]
232
248
  decoded_cookie = decode_cookie(cookie_value, opts)
233
249
  @pool_name = 'unknown'
234
250
  end
@@ -241,6 +257,6 @@ class BigIPCookie
241
257
 
242
258
  private :retrieve_pool_name, :decode_cookie, :detect_cookie_type,
243
259
  :ipv6_pm_ndrd, :ipv6_pm, :ipv4_pm_ndrd, :ipv4_pm, :decode_port,
244
- :decode_ip
260
+ :decode_ip, :encrypted
245
261
  end
246
262
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Version
4
- VERSION = '0.0.1'
4
+ VERSION = '0.0.6'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre ZANNI
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-16 00:00:00.000000000 Z
11
+ date: 2020-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt
@@ -30,42 +30,42 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.1'
33
+ version: '2.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.1'
40
+ version: '2.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '2.0'
47
+ version: '2.1'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '2.0'
54
+ version: '2.1'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: commonmarker
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.18'
61
+ version: '0.21'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0.18'
68
+ version: '0.21'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: github-markup
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '12.3'
103
+ version: '13.0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '12.3'
110
+ version: '13.0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: redcarpet
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '0.63'
131
+ version: '0.80'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '0.63'
138
+ version: '0.80'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: yard
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -155,77 +155,25 @@ email: alexandre.zanni@engineer.com
155
155
  executables:
156
156
  - rabid
157
157
  - rabid_console
158
- - rabid_setup
159
158
  extensions: []
160
159
  extra_rdoc_files: []
161
160
  files:
162
- - ".gitignore"
163
- - ".rubocop.yml"
164
- - ".yardopts"
165
- - ".yardopts-dev"
166
- - Gemfile
167
- - Gemfile.lock
168
161
  - LICENSE.txt
169
- - README.md
170
- - Rakefile
171
- - bigipcookie.gemspec
172
162
  - bin/rabid
173
163
  - bin/rabid_console
174
- - bin/rabid_setup
175
- - docs/.nojekyll
176
- - docs/About.md
177
- - docs/CHANGELOG.md
178
- - docs/README.md
179
- - docs/_coverpage.md
180
- - docs/_media/logo.png
181
- - docs/_navbar.md
182
- - docs/_sidebar.md
183
- - docs/index.html
184
- - docs/pages/demo.md
185
- - docs/pages/documentation.md
186
- - docs/pages/install.md
187
- - docs/pages/publishing.md
188
- - docs/pages/quick-start.md
189
- - docs/pages/usage.md
190
- - docs/vendor/docsify.js
191
- - docs/vendor/plugins/emoji.min.js
192
- - docs/vendor/plugins/search.min.js
193
- - docs/vendor/prismjs/components/prism-ruby.min.js
194
- - docs/vendor/themes/vue.css
195
- - docs/why.md
196
- - docs/yard/BigIPCookie.html
197
- - docs/yard/BigIPCookie/Decode.html
198
- - docs/yard/Version.html
199
- - docs/yard/_index.html
200
- - docs/yard/class_list.html
201
- - docs/yard/css/common.css
202
- - docs/yard/css/full_list.css
203
- - docs/yard/css/style.css
204
- - docs/yard/file.LICENSE.html
205
- - docs/yard/file.README.html
206
- - docs/yard/file_list.html
207
- - docs/yard/frames.html
208
- - docs/yard/index.html
209
- - docs/yard/js/app.js
210
- - docs/yard/js/full_list.js
211
- - docs/yard/js/jquery.js
212
- - docs/yard/method_list.html
213
- - docs/yard/top-level-namespace.html
214
164
  - lib/bigipcookie.rb
215
165
  - lib/bigipcookie/version.rb
216
- - package-lock.json
217
- - test/test_bigipcookie.rb
218
- homepage: https://orange-cyberdefense.github.io/rabid/
166
+ homepage: https://noraj.github.io/rabid/
219
167
  licenses:
220
168
  - MIT
221
169
  metadata:
222
170
  yard.run: yard
223
- bug_tracker_uri: https://github.com/Orange-Cyberdefense/rabid/issues
224
- changelog_uri: https://github.com/Orange-Cyberdefense/rabid/blob/master/docs/CHANGELOG.md
225
- documentation_uri: https://orange-cyberdefense.github.io/rabid/
226
- homepage_uri: https://orange-cyberdefense.github.io/rabid/
227
- source_code_uri: https://github.com/Orange-Cyberdefense/rabid/
228
- post_install_message:
171
+ bug_tracker_uri: https://github.com/noraj/rabid/issues
172
+ changelog_uri: https://github.com/noraj/rabid/blob/master/docs/CHANGELOG.md
173
+ documentation_uri: https://noraj.github.io/rabid/
174
+ homepage_uri: https://noraj.github.io/rabid/
175
+ source_code_uri: https://github.com/noraj/rabid/
176
+ post_install_message:
229
177
  rdoc_options: []
230
178
  require_paths:
231
179
  - lib
@@ -233,16 +181,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
233
181
  requirements:
234
182
  - - "~>"
235
183
  - !ruby/object:Gem::Version
236
- version: '2.4'
184
+ version: '2.7'
237
185
  required_rubygems_version: !ruby/object:Gem::Requirement
238
186
  requirements:
239
187
  - - ">="
240
188
  - !ruby/object:Gem::Version
241
189
  version: '0'
242
190
  requirements: []
243
- rubygems_version: 3.0.1
244
- signing_key:
191
+ rubygems_version: 3.1.2
192
+ signing_key:
245
193
  specification_version: 4
246
194
  summary: RApid Big IP Decoder
247
- test_files:
248
- - test/test_bigipcookie.rb
195
+ test_files: []
data/.gitignore DELETED
@@ -1,7 +0,0 @@
1
- .yardoc
2
- *.gem
3
- /pkg
4
- /doc
5
- /vendor
6
- .bundle/
7
- /node_modules
@@ -1,22 +0,0 @@
1
- # Metrics
2
- AllCops:
3
- TargetRubyVersion: 2.4
4
-
5
- Layout/AlignHash:
6
- Include:
7
- - 'lib/**/*.rb'
8
- Metrics/AbcSize:
9
- Enabled: false
10
- Metrics/ClassLength:
11
- Max: 200
12
- Metrics/CyclomaticComplexity:
13
- Enabled: false
14
- Metrics/LineLength:
15
- Include:
16
- - 'lib/**/*.rb'
17
- Metrics/MethodLength:
18
- Max: 25
19
- Metrics/PerceivedComplexity:
20
- Max: 10
21
- Style/RedundantReturn:
22
- Enabled: false
data/.yardopts DELETED
@@ -1,4 +0,0 @@
1
- --output-dir docs/yard
2
- -
3
- --main README.md
4
- LICENSE.txt
@@ -1,6 +0,0 @@
1
- --output-dir docs/yard
2
- --protected
3
- --private
4
- -
5
- --main README.md
6
- LICENSE.txt
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- # Specify your gem's dependencies in .gemspec
6
- gemspec
@@ -1,56 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- rabid (0.0.1)
5
- docopt (~> 0.6)
6
- paint (~> 2.1)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- ast (2.4.0)
12
- commonmarker (0.20.1)
13
- ruby-enum (~> 0.5)
14
- concurrent-ruby (1.1.5)
15
- docopt (0.6.1)
16
- github-markup (3.0.4)
17
- i18n (1.6.0)
18
- concurrent-ruby (~> 1.0)
19
- jaro_winkler (1.5.3)
20
- minitest (5.11.3)
21
- paint (2.1.0)
22
- parallel (1.17.0)
23
- parser (2.6.3.0)
24
- ast (~> 2.4.0)
25
- rainbow (3.0.0)
26
- rake (12.3.2)
27
- redcarpet (3.4.0)
28
- rubocop (0.73.0)
29
- jaro_winkler (~> 1.5.1)
30
- parallel (~> 1.10)
31
- parser (>= 2.6)
32
- rainbow (>= 2.2.2, < 4.0)
33
- ruby-progressbar (~> 1.7)
34
- unicode-display_width (>= 1.4.0, < 1.7)
35
- ruby-enum (0.7.2)
36
- i18n
37
- ruby-progressbar (1.10.1)
38
- unicode-display_width (1.6.0)
39
- yard (0.9.20)
40
-
41
- PLATFORMS
42
- ruby
43
-
44
- DEPENDENCIES
45
- bundler (~> 2.0)
46
- commonmarker (~> 0.18)
47
- github-markup (~> 3.0)
48
- minitest (~> 5.11)
49
- rabid!
50
- rake (~> 12.3)
51
- redcarpet (~> 3.4)
52
- rubocop (~> 0.63)
53
- yard (~> 0.9)
54
-
55
- BUNDLED WITH
56
- 2.0.1