nessus_console 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 1.9.3
5
+ - 2.2.5
6
+ - 2.3.1
7
+ before_install: gem install bundler
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at kost@linux.hr. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in nessus_console.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Vlatko Kosturjak
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,41 @@
1
+ # NessusConsole
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/nessus_console`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'nessus_console'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install nessus_console
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/nessus_console. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "nessus_console"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,136 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'nessus_console'
4
+
5
+ require 'logger'
6
+ require 'optparse'
7
+ require 'yaml'
8
+
9
+ require 'pry'
10
+ require 'nessus_rest'
11
+
12
+ $PRGNAME='nessus_console'
13
+
14
+ # helpful class for logger
15
+ class MultiDelegator
16
+ def initialize(*targets)
17
+ @targets = targets
18
+ end
19
+
20
+ def self.delegate(*methods)
21
+ methods.each do |m|
22
+ define_method(m) do |*args|
23
+ @targets.map { |t| t.send(m, *args) }
24
+ end
25
+ end
26
+ self
27
+ end
28
+
29
+ class <<self
30
+ alias to new
31
+ end
32
+ end
33
+
34
+ # default $options
35
+ $options = {}
36
+ $options[:loglevel] = 'WARN'
37
+ $options[:logname] = nil
38
+ $options[:url] = 'https://localhost:8834/'
39
+ $options[:username] = 'nessus'
40
+ $options[:autologin] = true
41
+
42
+ $nessusconsoleyaml=ENV['HOME']+'/.nessus_console'
43
+
44
+ begin
45
+ optyaml = YAML::load_file($nessusconsoleyaml)
46
+ rescue # Errno::ENOENT
47
+ end
48
+
49
+ if optyaml != nil then
50
+ $options.merge!(optyaml)
51
+ end
52
+
53
+ # initialize logger
54
+ if $options[:logname] != nil then
55
+ log_file = File.open($options['logname'], 'a')
56
+ @log = Logger.new MultiDelegator.delegate(:write, :close).to(STDERR, log_file)
57
+ else
58
+ @log = Logger.new MultiDelegator.delegate(:write, :close).to(STDERR)
59
+ end
60
+ loglevel = Logger.const_get $options[:loglevel] # Logger::INFO # default is ::WARN
61
+ @log.level = loglevel
62
+
63
+ # pp $options
64
+
65
+ OptionParser.new do |opts|
66
+ opts.banner = "Usage: #{$PRGNAME} [options]"
67
+
68
+
69
+ opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
70
+ $options['verbose'] = v
71
+ @log.level = Logger::INFO
72
+ end
73
+
74
+ opts.on("-d", "--[no-]debug", "Run in debug mode") do |v|
75
+ $options['debug'] = v
76
+ @log.level = Logger::DEBUG
77
+ end
78
+
79
+ opts.on("-h", "--help", "Prints this help") do
80
+ puts opts
81
+ exit
82
+ end
83
+
84
+ opts.on("-a", "--[no-]autologin", "auto login") do |v|
85
+ $options[:autologin] = v
86
+ end
87
+
88
+ opts.on("-u", "--username USERNAME", "specify USERNAME") do |optarg|
89
+ $options[:username] = optarg
90
+ end
91
+
92
+ opts.on("-p", "--password PASSWORD", "specify PASSWORD") do |optarg|
93
+ $options[:password] = optarg
94
+ end
95
+
96
+ opts.on("-o", "--output NAME", "use NAME for output filename") do |optarg|
97
+ $options[:output] = optarg
98
+ end
99
+
100
+ opts.on("-n", "--nessus URL", "use URL for nessus") do |optarg|
101
+ $options[:url] = optarg
102
+ end
103
+
104
+ opts.on("-l", "--log FILE", "log to FILE") do |optarg|
105
+ $options[:logname] = optarg
106
+ end
107
+
108
+ opts.separator ""
109
+ opts.separator "Example #1: #{$PRGNAME} -n https://localhost:8834/ -u nessus -p password"
110
+ end.parse!
111
+
112
+ # pp $options
113
+
114
+ def nessusload
115
+ optyaml = YAML::load_file($nessusconsoleyaml)
116
+ if optyaml != nil then
117
+ $options.merge!(optyaml)
118
+ end
119
+ end
120
+
121
+ def nessussave
122
+ File.open($nessusconsoleyaml, 'w') {|f| f.write $options.to_yaml }
123
+ end
124
+
125
+ # for future use
126
+ if ARGV.empty?
127
+ else
128
+ end
129
+
130
+ n=nil
131
+ if $options.has_key?(:password) and $options[:autologin] then
132
+ n=NessusREST::Client.new($options)
133
+ end
134
+
135
+ # Pry.start
136
+ binding.pry
@@ -0,0 +1,5 @@
1
+ require "nessus_console/version"
2
+
3
+ module NessusConsole
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,3 @@
1
+ module NessusConsole
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'nessus_console/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "nessus_console"
8
+ spec.version = NessusConsole::VERSION
9
+ spec.authors = ["Vlatko Kosturjak"]
10
+ spec.email = ["kost@linux.hr"]
11
+
12
+ spec.summary = %q{Interact with Nessus through terminal: Nessus console with help of pry}
13
+ spec.description = %q{This is simple Nessus console with help of pry: Interact with Nessus through terminal.}
14
+ spec.homepage = "https://github.com/kost/nessus_console-ruby/"
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_development_dependency "bundler", ">= 1.12"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "rspec", "~> 3.0"
25
+
26
+ spec.add_runtime_dependency 'nessus_rest', '>= 0'
27
+ spec.add_runtime_dependency 'pry', '>= 0'
28
+ end
metadata ADDED
@@ -0,0 +1,142 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nessus_console
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Vlatko Kosturjak
9
+ autorequire:
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 2016-08-27 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '1.12'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '1.12'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '10.0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '10.0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '3.0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: nessus_rest
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: pry
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ description: ! 'This is simple Nessus console with help of pry: Interact with Nessus
95
+ through terminal.'
96
+ email:
97
+ - kost@linux.hr
98
+ executables:
99
+ - nessus_console
100
+ extensions: []
101
+ extra_rdoc_files: []
102
+ files:
103
+ - .gitignore
104
+ - .rspec
105
+ - .travis.yml
106
+ - CODE_OF_CONDUCT.md
107
+ - Gemfile
108
+ - LICENSE.txt
109
+ - README.md
110
+ - Rakefile
111
+ - bin/console
112
+ - bin/setup
113
+ - exe/nessus_console
114
+ - lib/nessus_console.rb
115
+ - lib/nessus_console/version.rb
116
+ - nessus_console.gemspec
117
+ homepage: https://github.com/kost/nessus_console-ruby/
118
+ licenses:
119
+ - MIT
120
+ post_install_message:
121
+ rdoc_options: []
122
+ require_paths:
123
+ - lib
124
+ required_ruby_version: !ruby/object:Gem::Requirement
125
+ none: false
126
+ requirements:
127
+ - - ! '>='
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ required_rubygems_version: !ruby/object:Gem::Requirement
131
+ none: false
132
+ requirements:
133
+ - - ! '>='
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ requirements: []
137
+ rubyforge_project:
138
+ rubygems_version: 1.8.23
139
+ signing_key:
140
+ specification_version: 3
141
+ summary: ! 'Interact with Nessus through terminal: Nessus console with help of pry'
142
+ test_files: []