ronin-db is a common database library for managing and querying security data. ronin-db provides common ORM models for interacting with the database's SQL tables and inserting/querying security data, such as URLs, email addresses, host names, IPs, ports, etc. ronin-db also provides CLI commands for managing the database(s).
ronin-db is part of the ronin-rb project, a Ruby toolkit for security research and development.
- Uses a sqlite database by default.
- Provides common ActiveRecord models for interacting with the database tables.
- Provides a
ronin-db
command for easy management of the database(s). - Provides additional commands for querying, inserting, deleting entries from various database tables.
Usage: ronin-db [options] [COMMAND [ARGS...]]
Options:
-h, --help Print help information
Arguments:
[COMMAND] The command name to run
[ARGS ...] Additional arguments for the command
Commands:
add
asn
certs
completion
creds
edit
emails
help
hosts
ips
irb, console
list
migrate
open-ports
oses
passwords
people
phone-numbers
ports
remove
services
software
street-addresses
urls
web-vulns
List available Databases:
$ ronin-db list
Add a new Database:
$ ronin-db add team-db --uri postgres:https://user:[email protected]/db
Remove a Database:
$ ronin-db remove team-db
Add a host name to the database:
$ ronin-db hosts --add example.com
$ ronin-db hosts --add www.example.com
List host names in the database:
$ ronin-db hosts
example.com
www.example.com
...
Queries only certain host names:
$ ronin-db hosts --domain example.com
example.com
www.example.com
...
Imports a file of host names:
$ ronin-db hosts --import targets.txt
Manually creating the database:
require 'ronin/db'
Ronin::DB.connect(migrate: true)
Connecting to the default database:
require 'ronin/db'
Ronin::DB.connect
Creating a custom database:
require 'ronin/db'
Ronin::DB.connect('sqlite3:path/to/db.sqlite3', migrate: true)
Connecting to a custom database:
require 'ronin/db'
Ronin::DB.connect('sqlite3:path/to/db.sqlite3')
Interacting with the Ronin::DB models:
require 'ronin/db'
Ronin::DB.connect
Ronin::DB::HostName.create(name: 'www.example.com')
# =>
# #<Ronin::DB::HostName:0x00007f3275cc93f0
# id: 1,
# name: "www.example.com",
# last_scanned_at: nil,
# created_at: 2022-09-30 05:06:25.633087551 UTC>
Ronin::DB::HostName.create(name: 'www.example.org')
# =>
# #<Ronin::DB::HostName:0x00007f32768b60a0
# id: 2,
# name: "www.example.org",
# last_scanned_at: nil,
# created_at: 2022-09-30 05:07:00.996736126 UTC>
host_name = Ronin::DB::HostName.find(2)
# =>
# #<Ronin::DB::HostName:0x00007f32758072e0
# id: 2,
# name: "www.example.org",
# last_scanned_at: nil,
# created_at: 2000-01-01 05:07:00.996736 UTC>
host_name = Ronin::DB::HostName.first
# =>
# #<Ronin::DB::HostName:0x00007f3275cc93f0
# id: 1,
# name: "www.example.com",
# last_scanned_at: nil,
# created_at: 2022-09-30 05:06:25.633087551 UTC>
host_names = Ronin::DB::HostName.where(name: 'www.example.com')
# =>
# [#<Ronin::DB::HostName:0x00007f327597b4c8
# id: 1,
# name: "www.example.com",
# last_scanned_at: nil,
# created_at: 2000-01-01 05:06:25.633087 UTC>]
host_names = Ronin::DB::HostName.where(name: 'www.example.com')
# =>
# [#<Ronin::DB::HostName:0x00007f327597b4c8
# id: 1,
# name: "www.example.com",
# last_scanned_at: nil,
# created_at: 2000-01-01 05:06:25.633087 UTC>]
For more information on how to query the database models, see Active Record Query Interface and ronin-db-activerecord.
- Ruby >= 3.0.0
- libsqlite3
- sqlite3 (or activerecord-jdbcsqlite3-adapter ~> 70.0 on JRuby)
- ronin-db-activerecord ~> 0.2
- ronin-support ~> 1.0
- ronin-core ~> 0.2
$ gem install ronin-db
gem 'ronin-db', '~> 0.1'
gem.add_dependency 'ronin-db', '~> 0.1'
- Fork It!
- Clone It!
cd ronin-db
./scripts/setup
git checkout -b my_feature
- Code It!
bundle exec rake spec
git push origin my_feature
If you want to test your changes locally, run rake db:console
to start a
local database console.
Copyright (c) 2006-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
ronin-db is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
ronin-db is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with ronin-db. If not, see https://www.gnu.org/licenses/.