hakiri 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile.lock +3 -1
- data/README.md +2 -2
- data/bin/hakiri +3 -3
- data/hakiri.gemspec +1 -0
- data/lib/hakiri.rb +1 -0
- data/lib/hakiri/cli/manifest.rb +2 -2
- data/lib/hakiri/cli/system.rb +5 -6
- data/lib/hakiri/http_client.rb +6 -6
- data/lib/hakiri/stack.rb +18 -18
- data/lib/hakiri/version.rb +1 -1
- metadata +18 -2
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hakiri (0.3.
|
4
|
+
hakiri (0.3.1)
|
5
5
|
active_support
|
6
6
|
commander
|
7
7
|
i18n
|
8
|
+
json_pure
|
8
9
|
rake
|
9
10
|
rest-client
|
10
11
|
terminal-table
|
@@ -19,6 +20,7 @@ GEM
|
|
19
20
|
highline (~> 1.6.11)
|
20
21
|
highline (1.6.19)
|
21
22
|
i18n (0.6.4)
|
23
|
+
json_pure (1.8.0)
|
22
24
|
mime-types (1.23)
|
23
25
|
rake (10.1.0)
|
24
26
|
rest-client (1.6.7)
|
data/README.md
CHANGED
@@ -27,7 +27,7 @@ Hakiri CLI is a Ruby gem that can be installed by
|
|
27
27
|
$ gem install hakiri
|
28
28
|
~~~
|
29
29
|
|
30
|
-
After it's installed, restart your command line and you should be good to go.
|
30
|
+
After it's installed, restart your command line and you should be good to go. Hakiri supports Ruby 1.8.7, 1.9.x and 2.0.x.
|
31
31
|
|
32
32
|
## Test Your System in 2 Minutes
|
33
33
|
|
@@ -121,4 +121,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
121
121
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
122
122
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
123
123
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
124
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
124
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/bin/hakiri
CHANGED
@@ -26,7 +26,7 @@ command 'system:scan' do |c|
|
|
26
26
|
c.option '--manifest STRING', String, 'Path to your manifest JSON file'
|
27
27
|
|
28
28
|
c.action do |args, options|
|
29
|
-
options.default manifest
|
29
|
+
options.default :manifest => './manifest.json'
|
30
30
|
|
31
31
|
cli = Hakiri::System.new(args, options)
|
32
32
|
cli.scan
|
@@ -42,8 +42,8 @@ command 'system:sync' do |c|
|
|
42
42
|
c.option '--force', 'Force syncing without asking for it first.'
|
43
43
|
|
44
44
|
c.action do |args, options|
|
45
|
-
options.default manifest
|
46
|
-
options.default project
|
45
|
+
options.default :manifest => './manifest.json'
|
46
|
+
options.default :project => nil
|
47
47
|
cli = Hakiri::System.new(args, options)
|
48
48
|
cli.sync
|
49
49
|
end
|
data/hakiri.gemspec
CHANGED
data/lib/hakiri.rb
CHANGED
data/lib/hakiri/cli/manifest.rb
CHANGED
@@ -8,7 +8,7 @@ class Hakiri::Manifest < Hakiri::Cli
|
|
8
8
|
FileUtils::copy_file "#{File.dirname(__FILE__)}/manifest.json", "#{Dir.pwd}/manifest.json"
|
9
9
|
File.chmod 0755, "#{Dir.pwd}/manifest.json"
|
10
10
|
say '-----> Generating the manifest file...'
|
11
|
-
say "
|
12
|
-
say "
|
11
|
+
say " Generated the manifest file in #{Dir.pwd}/manifest.json"
|
12
|
+
say " Edit it and run \"hakiri system:scan\""
|
13
13
|
end
|
14
14
|
end
|
data/lib/hakiri/cli/system.rb
CHANGED
@@ -19,7 +19,7 @@ class Hakiri::System < Hakiri::Cli
|
|
19
19
|
|
20
20
|
# GETTING VULNERABILITIES
|
21
21
|
say '-----> Searching for vulnerabilities...'
|
22
|
-
params = ({ technologies
|
22
|
+
params = ({ :technologies => @stack.technologies }.to_param)
|
23
23
|
response = @http_client.get_issues(params)
|
24
24
|
|
25
25
|
if response[:errors]
|
@@ -79,7 +79,7 @@ class Hakiri::System < Hakiri::Cli
|
|
79
79
|
end
|
80
80
|
|
81
81
|
# CHECK VERSIONS ON THE SERVER
|
82
|
-
params = ({ project_id
|
82
|
+
params = ({ :project_id => @options.project, :technologies => @stack.technologies }.to_param)
|
83
83
|
say '-----> Checking software versions on www.hakiriup.com...'
|
84
84
|
response = @http_client.check_versions_diff(params)
|
85
85
|
|
@@ -92,7 +92,7 @@ class Hakiri::System < Hakiri::Cli
|
|
92
92
|
@stack.technologies = {}
|
93
93
|
response[:diffs].each do |diff|
|
94
94
|
if diff[:success]
|
95
|
-
@stack.technologies[diff[:technology][:slug]] = { version
|
95
|
+
@stack.technologies[diff[:technology][:slug]] = { :version => diff[:system_version] }
|
96
96
|
|
97
97
|
if diff[:hakiri_version]
|
98
98
|
if diff[:system_version_newer]
|
@@ -115,7 +115,7 @@ class Hakiri::System < Hakiri::Cli
|
|
115
115
|
|
116
116
|
if update or @options.force
|
117
117
|
say '-----> Syncing versions with www.hakiriup.com...'
|
118
|
-
params = ({ project_id
|
118
|
+
params = ({ :project_id => @options.project, :technologies => @stack.technologies }.to_param)
|
119
119
|
response = @http_client.sync_project_versions(response[:project][:id], params)
|
120
120
|
|
121
121
|
if response[:errors]
|
@@ -193,7 +193,7 @@ class Hakiri::System < Hakiri::Cli
|
|
193
193
|
end
|
194
194
|
|
195
195
|
say '-----> Searching for vulnerabilities...'
|
196
|
-
params = ({ technologies
|
196
|
+
params = ({ :technologies => @stack.technologies }.to_param)
|
197
197
|
response = @http_client.get_issues(params)
|
198
198
|
|
199
199
|
if response[:errors]
|
@@ -209,7 +209,6 @@ class Hakiri::System < Hakiri::Cli
|
|
209
209
|
response[:technologies].each do |technology|
|
210
210
|
unless technology[:issues_count] == 0
|
211
211
|
say "! Found #{technology[:issues_count].to_i} #{'vulnerability'.pluralize if technology[:issues_count].to_i != 1} in #{technology[:name]} #{technology[:version]}"
|
212
|
-
puts ' '
|
213
212
|
end
|
214
213
|
end
|
215
214
|
|
data/lib/hakiri/http_client.rb
CHANGED
@@ -27,9 +27,9 @@ class Hakiri::HttpClient
|
|
27
27
|
RestClient.get "#{@api_url}/issues.json?auth_token=#{@auth_token}&#{params}" do |response, request, result, &block|
|
28
28
|
case response.code
|
29
29
|
when 200
|
30
|
-
JSON.parse(response.to_str, symbolize_names
|
30
|
+
JSON.parse(response.to_str, :symbolize_names => true)
|
31
31
|
else
|
32
|
-
{ errors
|
32
|
+
{ :errors => [response.code] }
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
@@ -47,9 +47,9 @@ class Hakiri::HttpClient
|
|
47
47
|
RestClient.get "#{@api_url}/versions/diffs.json?auth_token=#{@auth_token}&#{params}" do |response, request, result, &block|
|
48
48
|
case response.code
|
49
49
|
when 200
|
50
|
-
JSON.parse(response.to_str, symbolize_names
|
50
|
+
JSON.parse(response.to_str, :symbolize_names => true)
|
51
51
|
else
|
52
|
-
{ errors
|
52
|
+
{ :errors => [response.code] }
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
@@ -67,9 +67,9 @@ class Hakiri::HttpClient
|
|
67
67
|
RestClient.put "#{@api_url}/projects/#{project_id}.json?auth_token=#{@auth_token}", params do |response, request, result, &block|
|
68
68
|
case response.code
|
69
69
|
when 200
|
70
|
-
JSON.parse(response.to_str, symbolize_names
|
70
|
+
JSON.parse(response.to_str, :symbolize_names => true)
|
71
71
|
else
|
72
|
-
{ errors
|
72
|
+
{ :errors => [response.code] }
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
data/lib/hakiri/stack.rb
CHANGED
@@ -42,51 +42,51 @@ class Hakiri::Stack
|
|
42
42
|
# Is Memcached present?
|
43
43
|
#
|
44
44
|
def build_from_input(server, extra_server, db, redis, memcached)
|
45
|
-
@technologies['ruby'] = { command
|
46
|
-
@technologies['ruby-on-rails'] = { command
|
45
|
+
@technologies['ruby'] = { :command => @default_command }
|
46
|
+
@technologies['ruby-on-rails'] = { :command => @default_command }
|
47
47
|
|
48
48
|
case server
|
49
49
|
when 1
|
50
|
-
@technologies['unicorn'] = { command
|
50
|
+
@technologies['unicorn'] = { :command => @default_command }
|
51
51
|
when 2
|
52
|
-
@technologies['phusion-passenger'] = { command
|
52
|
+
@technologies['phusion-passenger'] = { :command => @default_command }
|
53
53
|
when 3
|
54
|
-
@technologies['thin'] = { command
|
54
|
+
@technologies['thin'] = { :command => @default_command }
|
55
55
|
when 4
|
56
|
-
@technologies['trinidad'] = { command
|
57
|
-
@technologies['java'] = { command
|
58
|
-
@technologies['apache-tomcat'] = { command
|
59
|
-
@technologies['jruby'] = { command
|
56
|
+
@technologies['trinidad'] = { :command => @default_command }
|
57
|
+
@technologies['java'] = { :command => @default_command }
|
58
|
+
@technologies['apache-tomcat'] = { :command => @default_command }
|
59
|
+
@technologies['jruby'] = { :command => @default_command }
|
60
60
|
else
|
61
61
|
nil
|
62
62
|
end
|
63
63
|
|
64
64
|
case extra_server
|
65
65
|
when 1
|
66
|
-
@technologies['apache'] = { command
|
66
|
+
@technologies['apache'] = { :command => @default_command }
|
67
67
|
when 2
|
68
|
-
@technologies['nginx'] = { command
|
68
|
+
@technologies['nginx'] = { :command => @default_command }
|
69
69
|
when 3
|
70
|
-
@technologies['apache'] = { command
|
71
|
-
@technologies['nginx'] = { command
|
70
|
+
@technologies['apache'] = { :command => @default_command }
|
71
|
+
@technologies['nginx'] = { :command => @default_command }
|
72
72
|
else
|
73
73
|
nil
|
74
74
|
end
|
75
75
|
|
76
76
|
case db
|
77
77
|
when 1
|
78
|
-
@technologies['mysql'] = { command
|
78
|
+
@technologies['mysql'] = { :command => @default_command }
|
79
79
|
when 2
|
80
|
-
@technologies['postgres'] = { command
|
80
|
+
@technologies['postgres'] = { :command => @default_command }
|
81
81
|
when 3
|
82
|
-
@technologies['mongodb'] = { command
|
82
|
+
@technologies['mongodb'] = { :command => @default_command }
|
83
83
|
else
|
84
84
|
nil
|
85
85
|
end
|
86
86
|
|
87
|
-
@technologies['redis'] = { command
|
87
|
+
@technologies['redis'] = { :command => @default_command } if redis
|
88
88
|
|
89
|
-
@technologies['memcached'] = { command
|
89
|
+
@technologies['memcached'] = { :command => @default_command } if memcached
|
90
90
|
end
|
91
91
|
|
92
92
|
#
|
data/lib/hakiri/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hakiri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -107,6 +107,22 @@ dependencies:
|
|
107
107
|
- - ! '>='
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: json_pure
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
110
126
|
description: Hakiri is a CLI for www.hakiriup.com—a cloud security platform for Ruby
|
111
127
|
on Rails apps.
|
112
128
|
email: vasinov@me.com
|