This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mongo' | |
require 'trollop' | |
require 'colorize' | |
foo = ARGV[0] || ARGV[0] = '-h' | |
opts = Trollop::options do | |
banner "Mongo Mauler".red.blue + " | " + "NoSQL? No Problem!".white.bold | |
version "Mongo Mauler v 1.0" | |
opt :ip, "Specify a host ip address to work with", :type => :string, :default => '127.0.0.1' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mongo' # must have this to work | |
def connect_to_db(args={}) | |
ip = args[:ip] || '127.0.0.1' | |
port = args[:port].to_s || '27017' | |
begin | |
client = Mongo::Client.new(["#{ip}:#{port}"]) | |
rescue Mongo::Auth::Unauthorized, Mongo::Error => e | |
puts "Error #{e.class}: #{e.message}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'pi_charts' | |
def bake_pie | |
chart = PiCharts::Pie.new | |
chart.add_dataset(label: "cats", data: 80) | |
chart.add_dataset(label: "dogs", data: 50) | |
chart.hover | |
chart.responsive | |
"<head>" + chart.cdn + "</head>" + "<body>" + chart.html(width: 60) + "</body>" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var chartInstance = new Chart(ctx, { | |
type: 'line', | |
data: data, | |
options: { | |
responsive: false | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "pi_charts" | |
# create a new line chart | |
chart = PiCharts::Line.new | |
# add labels ( x values ) | |
chart.add_labels(["January", "February", "March", "April", "May"]) | |
# add datasets | |
chart.add_dataset(label: "cats", data: [3, 1, 3, 3, 7]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "pi_charts" | |
# create a new line chart | |
chart = PiCharts::Bar.new | |
# add labels ( x values ) | |
chart.add_labels(["January", "February", "March", "April", "May"]) | |
# add datasets | |
chart.add_dataset(label: "cats", data: [ 2, 0, 4, 7, 3 ]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
# Basic socket usage to grab a banner. | |
# @author Kent 'picat' Gruber | |
require 'socket' | |
# Grab the banner of a given +ip+ address and +port+ | |
# to attempt to connect to. | |
# | |
# @param ip [String] Target IP address. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
# Basic socket usage to grab a banner. | |
# @author Kent 'picat' Gruber | |
require 'socket' | |
# Grab the banner of a given +ip+ address and +port+ | |
# to attempt to connect to. | |
# | |
# @param ip [String] Target IP address. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
# Basic socket usage to grab a banner. | |
# @author Kent 'picat' Gruber | |
require 'socket' | |
# Target ports... a range of all of the possible ports lol. | |
target_ports = 1..65535 | |
# Grab the banner of a given +ip+ address and +port+ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
# Basic socket usage to grab a banner. | |
# @author Kent 'picat' Gruber | |
require 'socket' | |
# Target ports... a range of all of the possible ports lol. | |
target_ports = 1..65535 | |
target_ips = ['10.0.0.2', '10.0.0.3', '10.0.0.4'] |