made a separate console and fixed an issue with the size_for method in scansioindex parser
This commit is contained in:
parent
5c04cfc11e
commit
567355f7b7
4 changed files with 34 additions and 22 deletions
16
.pryrc
16
.pryrc
|
@ -1,5 +1,3 @@
|
||||||
require 'require_all'
|
|
||||||
|
|
||||||
class Array
|
class Array
|
||||||
# group elements by their identity, and count each distinct item
|
# group elements by their identity, and count each distinct item
|
||||||
def counts
|
def counts
|
||||||
|
@ -18,17 +16,3 @@ end
|
||||||
Pry::Commands.command /^$/, "repeat last command" do
|
Pry::Commands.command /^$/, "repeat last command" do
|
||||||
_pry_.run_command Pry.history.to_a.last
|
_pry_.run_command Pry.history.to_a.last
|
||||||
end
|
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)
|
|
||||||
|
|
||||||
|
|
14
Dockerfile
14
Dockerfile
|
@ -1,7 +1,15 @@
|
||||||
# uncomment the version of ruby that you want to run
|
# uncomment the version of ruby that you want to run
|
||||||
#FROM ruby:2.4
|
#FROM ruby:2.4
|
||||||
#FROM ruby:2.5
|
#FROM ruby:2.5
|
||||||
FROM ruby:2.6
|
#FROM ruby:2.6
|
||||||
|
FROM quay.io/kennasecurity/ruby
|
||||||
|
#---
|
||||||
|
# FEDORA with kennasecurity/ruby
|
||||||
|
USER root
|
||||||
|
RUN dnf install less -y && dnf clean all -y
|
||||||
|
#---
|
||||||
|
|
||||||
|
ENV PAGER less
|
||||||
|
|
||||||
RUN mkdir /usr/src/misc_rbtools
|
RUN mkdir /usr/src/misc_rbtools
|
||||||
ADD . /usr/src/misc_rbtools/
|
ADD . /usr/src/misc_rbtools/
|
||||||
|
@ -13,8 +21,6 @@ RUN gem install rest-client
|
||||||
RUN gem install require_all
|
RUN gem install require_all
|
||||||
RUN gem install pry
|
RUN gem install pry
|
||||||
|
|
||||||
RUN apt -y install less
|
|
||||||
|
|
||||||
WORKDIR /usr/src/misc_rbtools
|
WORKDIR /usr/src/misc_rbtools
|
||||||
|
|
||||||
CMD pry
|
CMD command_line/console.rb
|
||||||
|
|
|
@ -59,7 +59,11 @@ module ScansIoTools
|
||||||
end
|
end
|
||||||
|
|
||||||
def size_for(study_name)
|
def size_for(study_name)
|
||||||
file_info(study_name).first['size']
|
if file_info(study_name).count >= 2
|
||||||
|
file_info(study_name).select {|name| name['size']}
|
||||||
|
else
|
||||||
|
file_info(study_name).first['size']
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
18
command_line/console.rb
Executable file
18
command_line/console.rb
Executable file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
require "require_all"
|
||||||
|
require "pry"
|
||||||
|
|
||||||
|
# Obtain the present woking directory
|
||||||
|
current_dir = Dir.pwd
|
||||||
|
|
||||||
|
if current_dir =~ /^(.*?\/misc_rbtools)/
|
||||||
|
require_all '../modules'
|
||||||
|
require_all '../classes'
|
||||||
|
end
|
||||||
|
|
||||||
|
# different downloading tools
|
||||||
|
nvd_downloader = NvdTools::NvdDownloader.new
|
||||||
|
scans_io_downloader = ScansIoTools::ScansIoDownloader.new
|
||||||
|
scans_io_parser = ScansIoTools::ScansIoIndexParser.new(scans_io_downloader.get_json_index.body)
|
||||||
|
|
||||||
|
Pry.start
|
Loading…
Add table
Reference in a new issue