Socket
Book a DemoInstallSign in
Socket

ronin-db

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ronin-db

0.2.1
bundlerRubygems
Version published
Maintainers
1
Created
Source

ronin-db

CI Code Climate Gem Version

Description

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.

Features

  • 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.

Synopsis

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://user:pass@vpn.example.com/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

Examples

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.

Requirements

Install

$ gem install ronin-db

Gemfile

gem 'ronin-db', '~> 0.1'

gemspec

gem.add_dependency 'ronin-db', '~> 0.1'

Development

  • 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.

License

Copyright (c) 2006-2025 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/.

FAQs

Package last updated on 15 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.