Skip to content

Instantly share code, notes, and snippets.

View picatz's full-sized avatar
Graph Theory

Kent Gruber picatz

Graph Theory
View GitHub Profile
@picatz
picatz / violent_ruby_banner_grabber.rb
Last active April 27, 2017 00:21
Violent Ruby: Banner Grabber - Class
require 'socket'
# This Banner Grabber class is meant to provide a simple
# interface to, well... grab banners from services running
# on a target to determine the potential attack vectors
# avaialable to you.
# @author Kent 'picat' Gruber
#
# @example Basic Usage
# BannerGrabber.new(ip: 'localhost', port: 22).grab do |result|
@picatz
picatz / violent_ruby_banner_grabber_basic_usage.rb
Created April 14, 2017 23:21
Violent Ruby: Banner Grabber - Basic Usage
require 'violent_ruby'
ViolentRuby::BannerGrabber.new(ip: '192.168.0.2', port: 2222).grab do |result|
# Do something with result.
# => {:ip=>"192.168.0.2", :port=>22, :open=>true, :banner=>"SSH-2.0-OpenSSH_6.7p1 Debian-5+deb8u3\r\n"}
result[:ip]
# => "192.168.0.2"
result[:port]
# => 22
result[:open]
@picatz
picatz / violent_ruby_banner_grabber_cli.rb
Last active April 16, 2017 04:41
Violent Ruby: Banner Grabber - Command-line Interface
require 'violent_ruby' # For the banner grabber.
require 'trollop' # For clean option parsing.
require 'colorize' # For beautiful colors.
require 'logoris' # Log to the right standard stream.
logger = Logoris.new
application_name = 'Bannner Grabber'
# Default to a help menu if no argument is given.
ARGV[0] = '-h' if ARGV.empty?
@picatz
picatz / unixPasswdCrack.py
Created April 16, 2017 00:27
Violent Python Example: Unix Password Cracker
#!/usr/bin/python
# -*- coding: utf-8 -*-
import crypt
def testPass(cryptPass):
salt = cryptPass[0:2]
dictFile = open('dictionary.txt', 'r')
for word in dictFile.readlines():
word = word.strip('\n')
@picatz
picatz / unix_password_cracker.rb
Last active April 16, 2017 03:53
Violent Ruby: Basic Unix Password Cracker
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
def test_pass(crypt_pass)
salt = crypt_pass[0, 2]
File.foreach('dictionary.txt').map(&:strip).each do |word|
return puts '[+] Found Password: ' + word if word.crypt(salt) == crypt_pass
end
puts '[-] Password Not Found'
end
@picatz
picatz / violent_ruby_unix_password_cracker_basic_usage.rb
Created April 16, 2017 01:38
Violent Ruby: Unix Password Cracker-- Basic Usage
require 'violent_ruby'
# configs are cool
config = { file: "/etc/passwd", dictionary: "dictionary.txt" }
# create a Unix Password Cracker object, with hte config
upc = ViolentRuby::UnixPasswordCracker.new(config)
# attempt to crack passwords, doing some stuff with the result
upc.crack do |result|
@picatz
picatz / violent_ruby_unix_password_cracker_base.rb
Created April 16, 2017 01:49
Violent Ruby: Unix Password Cracker Base
# Unix Password Cracker
# @author Kent 'picat' Gruber
class UnixPasswordCracker
# @!attribute file
# @return [String] Path to the /etc/passwd file.
attr_accessor :file
# @!attribute dictionary
# @return dictionary [String] Path to dictionary file.
attr_accessor :dictionary
@picatz
picatz / violent_ruby_unix_password_cracker_parse_etc_file.rb
Created April 16, 2017 02:16
Violent Ruby: Unix Password Cracker Parse Etc File Method
# Parse a unix /etc/passwd file into a more mangeable form.
#
# @example Basic Usage
# upc = ViolentRuby::UnixPasswordCracker.new
# upc.parse_etc_file(file: 'passwords.txt')
# # {"victim" => "HX9LLTdc/jiDE", "root" => "DFNFxgW7C05fo"}
#
# @example Super Advanced Usage
# ViolentRuby::UnixPasswordCracker.new.parse_etc_file(file: 'passwords.txt') do |user, pass|
# puts user + ' ' + pass
@picatz
picatz / violent_ruby_unix_password_cracker_parse_etc_file_method_usage.rb
Created April 16, 2017 02:32
Violent Ruby: Unix Password Cracker Parse Etc File Method Usage
upc = ViolentRuby::UnixPasswordCracker.new
upc.parse_etc_file(file: 'passwords.txt')
# {"victim" => "HX9LLTdc/jiDE", "root" => "DFNFxgW7C05fo"}
upc.parse_etc_file(file: 'passwords.txt') do |user, pass|
puts user + ' ' + pass
end
# victim HX9LLTdc/jiDE
# root DFNFxgW7C05fo
@picatz
picatz / violent_ruby_unix_password_cracker_check_password.rb
Created April 16, 2017 02:50
Violent Ruby: Unix Password Cracker Check Password
# Check if a given encrypted password matches a given plaintext
# word when the same crytographic operation is performed on it.
#
# @example Basic Usage
# ViolentRuby::UnixPasswordCracker.new.check_password('HX9LLTdc/jiDE', 'egg')
# # true
#
# @example Advanced Usage
# ViolentRuby::UnixPasswordCracker.new.check_password('HXA82SzTqypHA', 'egg ')
# # false