ronin-rb / ronin-db

A common database library for managing and querying security data
https://ronin-rb.dev
GNU Lesser General Public License v3.0
14 stars 4 forks source link

Ronin fails to create a new DB with sqlite3 argument #62

Closed Sh3llSp4wn closed 11 months ago

Sh3llSp4wn commented 11 months ago

Failing command in question is as follows. Looks, by the error that the config/ronin-db does not exist in the default install. May be worth adding a init command or letting ronin create the directory by default.

ronin-db add htb_targets --sqlite3 ~/.local/share/my_ronin_dbs/htb.sql
ronin-db add: /usr/lib/ruby/3.0.0/pstore.rb:124:in `initialize': directory /home/shellspawn/.config/ronin-db does not exist (PStore::Error)
        from /usr/lib/ruby/3.0.0/yaml/store.rb:58:in `initialize'
        from /usr/lib/ruby/gems/3.0.0/gems/ronin-db-0.1.2/lib/ronin/db/config_file.rb:127:in `new'
        from /usr/lib/ruby/gems/3.0.0/gems/ronin-db-0.1.2/lib/ronin/db/config_file.rb:127:in `edit'
        from /usr/lib/ruby/gems/3.0.0/gems/ronin-db-0.1.2/lib/ronin/db/cli/commands/add.rb:175:in `run'
        from /usr/lib/ruby/gems/3.0.0/gems/command_kit-0.4.0/lib/command_kit/main.rb:95:in `main'
        from /usr/lib/ruby/gems/3.0.0/gems/command_kit-0.4.0/lib/command_kit/arguments.rb:194:in `main'
        from /usr/lib/ruby/gems/3.0.0/gems/command_kit-0.4.0/lib/command_kit/options/parser.rb:101:in `main'
        from /usr/lib/ruby/gems/3.0.0/gems/command_kit-0.4.0/lib/command_kit/exception_handler.rb:39:in `main'
        from /usr/lib/ruby/gems/3.0.0/gems/command_kit-0.4.0/lib/command_kit/commands.rb:257:in `invoke'
        from /usr/lib/ruby/gems/3.0.0/gems/command_kit-0.4.0/lib/command_kit/commands.rb:304:in `run'
        from /usr/lib/ruby/gems/3.0.0/gems/command_kit-0.4.0/lib/command_kit/main.rb:95:in `main'
        from /usr/lib/ruby/gems/3.0.0/gems/command_kit-0.4.0/lib/command_kit/arguments.rb:194:in `main'
        from /usr/lib/ruby/gems/3.0.0/gems/command_kit-0.4.0/lib/command_kit/options/parser.rb:101:in `main'
        from /usr/lib/ruby/gems/3.0.0/gems/command_kit-0.4.0/lib/command_kit/main.rb:77:in `main'
        from /usr/lib/ruby/gems/3.0.0/gems/command_kit-0.4.0/lib/command_kit/main.rb:52:in `start'
        from /usr/lib/ruby/gems/3.0.0/gems/ronin-db-0.1.2/bin/ronin-db:34:in `<top (required)>'
        from /usr/bin/ronin-db:25:in `load'
        from /usr/bin/ronin-db:25:in `<main>'
postmodern commented 11 months ago

Seems like ConfigFile.edit should also do a FileUtils.mkdir_p if the file does not exist yet.