ssh_config_to_vuls_config 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7d5b32bfb56f8547e818da9a18914ba38b0822c0
4
+ data.tar.gz: 33f4315c36ef51374b45a0d3cf7acdf23aec34b0
5
+ SHA512:
6
+ metadata.gz: 7a30cc340776c8d10509cb69f1c2a2a300db07298c354f7808d65d792a80d1ed6bf1e5c00c0c95bb9961f05e414d4a73fb854bd25c52b882519c18d8f1de50f0
7
+ data.tar.gz: 28d0fa06588cd5471e5ef41f61fc5cf3cdef87b5b066cd220bf056e54150b7b890f2e700270106a5520ef6e14054b9454f926537e936c1477b68c13bb43dbca1
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,71 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.1
3
+
4
+ Lint/Eval:
5
+ Enabled: false
6
+
7
+ Lint/HandleExceptions:
8
+ Enabled: false
9
+
10
+ Lint/UselessAssignment:
11
+ Enabled: false
12
+
13
+ Metrics/AbcSize:
14
+ Max: 50
15
+
16
+ Metrics/ClassLength:
17
+ Max: 120
18
+
19
+ Metrics/CyclomaticComplexity:
20
+ Max: 15
21
+
22
+ Metrics/LineLength:
23
+ Max: 120
24
+
25
+ Metrics/MethodLength:
26
+ Max: 30
27
+
28
+ Metrics/PerceivedComplexity:
29
+ Max: 15
30
+
31
+ Performance/StringReplacement:
32
+ Enabled: false
33
+
34
+ Performance/Casecmp:
35
+ Enabled: false
36
+
37
+ Style/Alias:
38
+ Enabled: false
39
+
40
+ Style/BarePercentLiterals:
41
+ Enabled: false
42
+
43
+ Style/ClassAndModuleChildren:
44
+ Enabled: false
45
+
46
+ Style/Documentation:
47
+ Enabled: false
48
+
49
+ Style/MutableConstant:
50
+ Enabled: false
51
+
52
+ Style/MultilineOperationIndentation:
53
+ Enabled: false
54
+
55
+ Style/StabbyLambdaParentheses:
56
+ Enabled: false
57
+
58
+ Style/PercentLiteralDelimiters:
59
+ Enabled: false
60
+
61
+ Style/PredicateName:
62
+ Enabled: false
63
+
64
+ Style/RedundantSelf:
65
+ Enabled: false
66
+
67
+ Style/SymbolProc:
68
+ Enabled: false
69
+
70
+ Style/BracesAroundHashParameters:
71
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.2
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ssh_config_to_vuls_config.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 k1LoW
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # sc2vc: ssh_config to vuls config TOML format
2
+
3
+ ssh_config to [vuls](https://github.com/future-architect/vuls) config TOML format
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'ssh_config_to_vuls_config'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ ```sh
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+
21
+ ```sh
22
+ $ gem install ssh_config_to_vuls_config
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ Convert ssh_config to [vuls](https://github.com/future-architect/vuls) config TOML format.
28
+
29
+ ```sh
30
+ $ cat ~/.ssh/config | sc2vc > vuls_config.toml
31
+ ```
32
+
33
+ Use [sconb](https://github.com/k1LoW/sconb) to filter ~/.ssh/config.
34
+
35
+ ```sh
36
+ $ sconb dump example_* | sconb restore | sc2vc > filtered_config.toml
37
+ ```
38
+
39
+
40
+ ## Contributing
41
+
42
+ 1. Fork it ( https://github.com/[my-github-username]/ssh_config_to_vuls_config/fork )
43
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
44
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
45
+ 4. Push to the branch (`git push origin my-new-feature`)
46
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'octorelease'
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'ssh_config_to_vuls_config'
5
+ require 'pry'
6
+ Pry.start
data/bin/setup ADDED
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
data/exe/sc2vc ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'ssh_config_to_vuls_config'
4
+
5
+ SshConfigToVulsConfig::CLI.start
@@ -0,0 +1,5 @@
1
+ require 'ssh_config_to_vuls_config/version'
2
+ require 'ssh_config_to_vuls_config/cli'
3
+
4
+ module SshConfigToVulsConfig
5
+ end
@@ -0,0 +1,33 @@
1
+ require 'thor'
2
+ require 'sconb'
3
+ require 'toml'
4
+
5
+ module SshConfigToVulsConfig
6
+ class CLI < Thor
7
+ default_command :convert
8
+
9
+ desc 'convert', 'ssh_config to vuls config.toml'
10
+ def convert
11
+ begin
12
+ stdin = timeout(1) { $stdin.read }
13
+ rescue Timeout::Error
14
+ end
15
+ parsed = Sconb::SSHConfig.parse(stdin)
16
+ config = { servers: {} }
17
+ parsed.each do |host, detail|
18
+ next if host =~ /\*/
19
+ next if detail.key?('Match')
20
+ next unless detail.key?('Host')
21
+ next unless detail.key?('IdentityFile')
22
+ key_path = File.expand_path(detail['IdentityFile'].first)
23
+ config[:servers][detail['Host']] = {
24
+ host: detail['Hostname'],
25
+ user: detail['User'] || 'root',
26
+ port: detail['Port'] || '22',
27
+ keyPath: key_path
28
+ }
29
+ end
30
+ puts TOML.dump(config)
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,3 @@
1
+ module SshConfigToVulsConfig
2
+ VERSION = '0.1.0'
3
+ end
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ssh_config_to_vuls_config/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'ssh_config_to_vuls_config'
8
+ spec.version = SshConfigToVulsConfig::VERSION
9
+ spec.authors = ['k1LoW']
10
+ spec.email = ['k1lowxb@gmail.com']
11
+
12
+ spec.summary = 'sc2vc: ssh_config to vuls config TOML format.'
13
+ spec.description = 'sc2vc: ssh_config to vuls config TOML format.'
14
+ spec.homepage = 'https://github.com/k1LoW/ssh_config_to_vuls_config'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = 'exe'
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.add_runtime_dependency 'thor'
23
+ spec.add_runtime_dependency 'toml-rb'
24
+ spec.add_runtime_dependency 'sconb', '~> 1.2'
25
+ spec.add_development_dependency 'bundler', '~> 1.9'
26
+ spec.add_development_dependency 'rake', '~> 10.0'
27
+ spec.add_development_dependency 'rspec'
28
+ spec.add_development_dependency 'rubocop'
29
+ spec.add_development_dependency 'octorelease'
30
+ spec.add_development_dependency 'pry'
31
+ end
metadata ADDED
@@ -0,0 +1,186 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ssh_config_to_vuls_config
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - k1LoW
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-05-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: toml-rb
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sconb
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.2'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.9'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.9'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: octorelease
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ description: 'sc2vc: ssh_config to vuls config TOML format.'
140
+ email:
141
+ - k1lowxb@gmail.com
142
+ executables:
143
+ - sc2vc
144
+ extensions: []
145
+ extra_rdoc_files: []
146
+ files:
147
+ - ".gitignore"
148
+ - ".rspec"
149
+ - ".rubocop.yml"
150
+ - ".travis.yml"
151
+ - Gemfile
152
+ - LICENSE.txt
153
+ - README.md
154
+ - Rakefile
155
+ - bin/console
156
+ - bin/setup
157
+ - exe/sc2vc
158
+ - lib/ssh_config_to_vuls_config.rb
159
+ - lib/ssh_config_to_vuls_config/cli.rb
160
+ - lib/ssh_config_to_vuls_config/version.rb
161
+ - ssh_config_to_vuls_config.gemspec
162
+ homepage: https://github.com/k1LoW/ssh_config_to_vuls_config
163
+ licenses:
164
+ - MIT
165
+ metadata: {}
166
+ post_install_message:
167
+ rdoc_options: []
168
+ require_paths:
169
+ - lib
170
+ required_ruby_version: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ required_rubygems_version: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: '0'
180
+ requirements: []
181
+ rubyforge_project:
182
+ rubygems_version: 2.2.2
183
+ signing_key:
184
+ specification_version: 4
185
+ summary: 'sc2vc: ssh_config to vuls config TOML format.'
186
+ test_files: []