diff --git a/.pryrc b/.pryrc index e69de29..0d985d2 100644 --- a/.pryrc +++ b/.pryrc @@ -0,0 +1,34 @@ +require 'require_all' + +class Array + # group elements by their identity, and count each distinct item + def counts + group_by(&:itself).map {|k,v| [k, v.count] } + end +end + +if defined?(PryByebug) + Pry.commands.alias_command 'c', 'continue' + Pry.commands.alias_command 's', 'step' + Pry.commands.alias_command 'n', 'next' + Pry.commands.alias_command 'f', 'finish' +end + +# Hit Enter to repeat last command +Pry::Commands.command /^$/, "repeat last command" do + _pry_.run_command Pry.history.to_a.last +end + + +# Obtain the present woking directory +current_dir = Dir.pwd + +if current_dir =~ /^(.*?\/misc_rbtools)/ + require_all './modules' + require_all './classes' +end + +nvd_downloader = NvdTools::NvdDownloader.new +scans_io_downloader = ScansIoTools::ScansIoDownloader.new +scans_io_parser = ScansIoTools::ScansIoIndexParser.new(scans_io_downloader.get_json_index.body) + diff --git a/Dockerfile b/Dockerfile index c69e0a3..f7d5a55 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,14 +3,18 @@ #FROM ruby:2.5 FROM ruby:2.6 -RUN mkdir /usr/src/app -ADD . /usr/src/app/ -WORKDIR /usr/src/app/ +RUN mkdir /usr/src/misc_rbtools +ADD . /usr/src/misc_rbtools/ +WORKDIR /usr/src/misc_rbtools/ RUN gem update --system RUN gem install bundler +RUN gem install rest-client +RUN gem install require_all RUN gem install pry -WORKDIR /usr/src/app +RUN apt -y install less + +WORKDIR /usr/src/misc_rbtools CMD pry diff --git a/classes/cve_info.rb b/classes/cve_info.rb index c585a16..e35f7b4 100644 --- a/classes/cve_info.rb +++ b/classes/cve_info.rb @@ -13,4 +13,4 @@ class CveReport # this should look in the returned array of cve information from self.cves # and return the given information for the cve_id end -end \ No newline at end of file +end diff --git a/classes/nvd_client.rb b/classes/nvd_client.rb index c58c57a..c193bca 100644 --- a/classes/nvd_client.rb +++ b/classes/nvd_client.rb @@ -1,4 +1,4 @@ -require '../modules/nvd_tools' +#require '../modules/nvd_tools' require 'rest-client' module NvdTools diff --git a/classes/nvd_downloader.rb b/classes/nvd_downloader.rb index 3342d3e..7b2923c 100644 --- a/classes/nvd_downloader.rb +++ b/classes/nvd_downloader.rb @@ -1,7 +1,7 @@ require 'rest-client' require 'zlib' require 'json' -require '../modules/nvd_tools' +#require '../modules/nvd_tools' module NvdTools class NvdDownloader @@ -86,4 +86,4 @@ module NvdTools # if there is a change, return true, if not return false end end -end \ No newline at end of file +end diff --git a/classes/scans_io_downloader.rb b/classes/scans_io_downloader.rb index a17131d..8e14ba2 100644 --- a/classes/scans_io_downloader.rb +++ b/classes/scans_io_downloader.rb @@ -1,4 +1,4 @@ -require '../modules/scans_io_tools' +#require '../modules/scans_io_tools' require 'json' require 'restclient' diff --git a/classes/scans_io_index_parser.rb b/classes/scans_io_index_parser.rb index 925b484..bba4788 100644 --- a/classes/scans_io_index_parser.rb +++ b/classes/scans_io_index_parser.rb @@ -62,4 +62,4 @@ module ScansIoTools file_info(study_name).first['size'] end end -end \ No newline at end of file +end diff --git a/modules/nvd_tools.rb b/modules/nvd_tools.rb index 5a22758..f839688 100644 --- a/modules/nvd_tools.rb +++ b/modules/nvd_tools.rb @@ -1,2 +1,2 @@ module NvdTools -end +end \ No newline at end of file