crumbl 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +34 -0
- data/.travis.yml +3 -0
- data/Gemfile +7 -0
- data/LICENSE +22 -0
- data/README.md +36 -0
- data/Rakefile +8 -0
- data/crumbl.gemspec +23 -0
- data/lib/crumbl/base.rb +1 -1
- data/lib/crumbl/version.rb +1 -1
- data/test/test_crumbl.rb +56 -0
- metadata +12 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 006098adc496eebb23ab9c02422bad0b71bbd141
|
4
|
+
data.tar.gz: 919397a66ec03e852e7cefc8d61d50e58f3eeb2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0981f5e8bed17773f8fb770fedd2700ff337078fbe8670c2bbacf7f71cd0b208d3752959e9dc9310b77c52618b40409db8aa0e98c02754bb303a83ffd0aa1287
|
7
|
+
data.tar.gz: 79c61c3bbd0c3befd0dcd9263696b463bee18a430be2d33a02063edbd55533da513cb9dc3c2cd84d6f66bbec97ef3310d82364a37bfd0889f3d8def9962e34dc
|
data/.gitignore
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/.bundle/
|
25
|
+
/lib/bundler/man/
|
26
|
+
|
27
|
+
# for a library or gem, you might want to ignore these files since the code is
|
28
|
+
# intended to run in multiple environments; otherwise, check them in:
|
29
|
+
# Gemfile.lock
|
30
|
+
# .ruby-version
|
31
|
+
# .ruby-gemset
|
32
|
+
|
33
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
34
|
+
.rvmrc
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 dlanner
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
crumbl
|
2
|
+
============
|
3
|
+
|
4
|
+
Command line tool for reading and manipulating encoded or encrypted Rails cookies
|
5
|
+
|
6
|
+
# Installation
|
7
|
+
`gem install crumbl`
|
8
|
+
|
9
|
+
# Usage
|
10
|
+
|
11
|
+
#### Decrypt Rails 4 encrypted cookie:
|
12
|
+
|
13
|
+
```
|
14
|
+
$ crumbl decrypt "secret key base" RWRWZ0xHSEsrNmx1TlZFOEpmcCtNVEY4QjdKelNETWlNdVV0TnlCZU0zTnA4ejZka2ZCR2EyQStydGhOaTRySC0tOEQyMFc2SkpLejRidjV5V1ZBUXpEUT09--67e625ac91a2fecc9a3da7146a3a92b667e0ed17
|
15
|
+
{"session_type"=>"user"}
|
16
|
+
```
|
17
|
+
|
18
|
+
#### Encrypt Rails 4 cookie:
|
19
|
+
```
|
20
|
+
$ crumbl encrypt "secret key base" --data session_type:admin
|
21
|
+
QnprY1BXSlI3WFo1MkxlZmJ6REE3b1N2ZExFaHdqYncvYnNTcHZTL0dQbmZ3RVVwU3hxNmpiVkJtQmNOTW4zYy0tNitvbnhGQ0szbWtIOTU4czNzMnJSUT09--4f397df94a66a3449511485c76e130ac10a35f32
|
22
|
+
```
|
23
|
+
|
24
|
+
#### Decode Rails 3 signed cookie:
|
25
|
+
|
26
|
+
```
|
27
|
+
$ crumbl decode BAh7BkkiEXNlc3Npb25fdHlwZQY6BkVUSSIJdXNlcgY7AFQ=--ff2751f14c049e970cd817b6bbb6575b7c8a7bd8
|
28
|
+
{"session_type"=>"user"}
|
29
|
+
```
|
30
|
+
|
31
|
+
#### Encode Rails 3 signed cookie:
|
32
|
+
|
33
|
+
```
|
34
|
+
$ crumbl encode "signing key" --data session_type:admin
|
35
|
+
BAh7BkkiEXNlc3Npb25fdHlwZQY6BkVUSSIKYWRtaW4GOwBU--a44fc16d8c2f185e4b667c4276e790ae1d40c505
|
36
|
+
```
|
data/Rakefile
ADDED
data/crumbl.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "crumbl/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = 'crumbl'
|
8
|
+
s.version = Crumbl::VERSION
|
9
|
+
s.date = '2014-10-08'
|
10
|
+
s.summary = "Read and manipulate encoded or encrypted Rails cookies"
|
11
|
+
s.description = "Command line tool for reading and manipulating encoded or encrypted Rails cookies"
|
12
|
+
s.authors = ["David Lanner"]
|
13
|
+
s.email = 'dhlanner2@gmail.com'
|
14
|
+
s.files = `git ls-files -z`.split("\x0")
|
15
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
16
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
17
|
+
s.require_paths = ["lib", "bin"]
|
18
|
+
s.homepage =
|
19
|
+
'https://github.com/dlanner/crumbl'
|
20
|
+
s.license = 'MIT'
|
21
|
+
s.add_runtime_dependency "rack"
|
22
|
+
s.add_runtime_dependency "activesupport", '~> 4.0.0'
|
23
|
+
end
|
data/lib/crumbl/base.rb
CHANGED
data/lib/crumbl/version.rb
CHANGED
data/test/test_crumbl.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'crumbl'
|
3
|
+
|
4
|
+
class CrumblTest < Minitest::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
@data = {:foo => "bar"}
|
7
|
+
@key_base = "secret key base"
|
8
|
+
@custom_iterations = 1001
|
9
|
+
@custom_encrypted_cookie_salt = @custom_encrypted_signed_cookie_salt = "salty"
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_decrypt_encrypted
|
13
|
+
encrypted = Crumbl.encrypt(@data, @key_base)
|
14
|
+
decrypted = Crumbl.decrypt(encrypted, @key_base)
|
15
|
+
assert_equal @data, decrypted
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_custom_iterations_equal
|
19
|
+
encrypted = Crumbl.encrypt(@data, @key_base, @custom_iterations)
|
20
|
+
decrypted = Crumbl.decrypt(encrypted, @key_base, @custom_iterations)
|
21
|
+
assert_equal @data, decrypted
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_custom_iterations_not_equal
|
25
|
+
encrypted = Crumbl.encrypt(@data, @key_base)
|
26
|
+
assert_raises ActiveSupport::MessageVerifier::InvalidSignature do
|
27
|
+
Crumbl.decrypt(encrypted, @key_base, @custom_iterations)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_custom_encrypted_cookie_salt_equal
|
32
|
+
encrypted = Crumbl.encrypt(@data, @key_base, Crumbl::DEFAULT_ITERATIONS, @custom_encrypted_cookie_salt)
|
33
|
+
decrypted = Crumbl.decrypt(encrypted, @key_base, Crumbl::DEFAULT_ITERATIONS, @custom_encrypted_cookie_salt)
|
34
|
+
assert_equal @data, decrypted
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_custom_encrypted_cookie_salt_not_equal
|
38
|
+
encrypted = Crumbl.encrypt(@data, @key_base)
|
39
|
+
assert_raises ActiveSupport::MessageEncryptor::InvalidMessage do
|
40
|
+
Crumbl.decrypt(encrypted, @key_base, Crumbl::DEFAULT_ITERATIONS, @custom_encrypted_cookie_salt)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_custom_encrypted_signed_cookie_salt_equal
|
45
|
+
encrypted = Crumbl.encrypt(@data, @key_base, Crumbl::DEFAULT_ITERATIONS, Crumbl::DEFAULT_ENCRYPTED_COOKIE_SALT, @custom_encrypted_signed_cookie_salt)
|
46
|
+
decrypted = Crumbl.decrypt(encrypted, @key_base, Crumbl::DEFAULT_ITERATIONS, Crumbl::DEFAULT_ENCRYPTED_COOKIE_SALT, @custom_encrypted_signed_cookie_salt)
|
47
|
+
assert_equal @data, decrypted
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_custom_encrypted_signed_cookie_salt_not_equal
|
51
|
+
encrypted = Crumbl.encrypt(@data, @key_base)
|
52
|
+
assert_raises ActiveSupport::MessageVerifier::InvalidSignature do
|
53
|
+
Crumbl.decrypt(encrypted, @key_base, Crumbl::DEFAULT_ITERATIONS, Crumbl::DEFAULT_ENCRYPTED_COOKIE_SALT, @custom_encrypted_signed_cookie_salt)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crumbl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Lanner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -46,10 +46,18 @@ executables:
|
|
46
46
|
extensions: []
|
47
47
|
extra_rdoc_files: []
|
48
48
|
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- ".travis.yml"
|
51
|
+
- Gemfile
|
52
|
+
- LICENSE
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
49
55
|
- bin/crumbl
|
56
|
+
- crumbl.gemspec
|
50
57
|
- lib/crumbl.rb
|
51
58
|
- lib/crumbl/base.rb
|
52
59
|
- lib/crumbl/version.rb
|
60
|
+
- test/test_crumbl.rb
|
53
61
|
homepage: https://github.com/dlanner/crumbl
|
54
62
|
licenses:
|
55
63
|
- MIT
|
@@ -75,4 +83,5 @@ rubygems_version: 2.4.2
|
|
75
83
|
signing_key:
|
76
84
|
specification_version: 4
|
77
85
|
summary: Read and manipulate encoded or encrypted Rails cookies
|
78
|
-
test_files:
|
86
|
+
test_files:
|
87
|
+
- test/test_crumbl.rb
|