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 / install_crystal.sh
Created August 6, 2017 21:40
Install Crystal Lang
function install_crystal() {
curl https://dist.crystal-lang.org/apt/setup.sh | sudo bash
sudo apt-get install build-essential
sudo apt-get install crystal
}
@picatz
picatz / install_rvm.sh
Last active August 13, 2017 13:51
Intall Ruby 2.4.1 with RVM and BASH
# Install the Ruby Version Manager
function install_rvm() {
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL https://get.rvm.io | bash -s stable
source /home/$USER/.rvm/scripts/rvm
echo "source /home/$USER/.rvm/scripts/rvm" >> /home/$USER/.bashrc
rvm install 2.4.1
}
# call the function
@picatz
picatz / install_tito.sh
Created August 6, 2017 21:50
Example install tito bot
function install_tito() {
mkdir /home/$USER/tito
curl https://raw.githubusercontent.com/picatz/Tito-Slack-Bot/master/tito-bot.rb > /home/$USER/tito/tito.rb
curl https://raw.githubusercontent.com/picatz/Tito-Slack-Bot/master/tito-quotes.txt > /home/$USER/tito/tito-quotes.txt
gem install slack-ruby-client faye-websocket
}
function start_tito() {
ruby /home/$USER/tito/tito.rb -s &
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@picatz
picatz / hello_world.rb
Created August 27, 2017 00:26
Command Lion -- Hello World Application
require 'command_lion'
CommandLion::App.run do
name "Hello World"
command :hello_world do
flag "--hello-world"
action do
puts "Hello World!"
end
end
@picatz
picatz / hello_world_expanded.rb
Last active August 27, 2017 16:50
Command Lion -- Hello World Expanded
require 'command_lion'
CommandLion::App.run do
name "Hello There!"
version "1.0.0"
description "A more complex 'hello' application!"
command :hello do
flag "hello"
type :strings
module Blocks
NUMBERS = [1,2,3]
def self.require_block(&block)
NUMBERS.each do |number|
yield number
end
end
@picatz
picatz / capture.rb
Created October 6, 2017 19:49
Simple Packet Analysis with Ruby
require "pry"
require "packetgen"
capture = Pcap.open_live(Pcap.lookupdev, 65535, true, 1)
loop do
while packet = capture.next
begin
parsed = PacketGen.parse(packet)
binding.pry # exit to go to next packet
@picatz
picatz / pcap2curl__http.rb
Created October 6, 2017 20:55
Watch network traffic for curlable HTTP requests that could can replayed.
require "pcaprub"
capture = Pcap.open_live(Pcap.lookupdev, 65535, true, 1)
loop do
while packet = capture.next
if data = /\b(GET|POST|PUT|PATCH|DELETE|HEAD|CONNECT|OPTIONS|TRACE) ([^ ]+) (HTTP\/[0-9\/]+)/.match(packet)
method, path, version = data.captures
headers = packet.scan(/\S+\b:\s.+/).map(&:strip)
url = (headers.grep /\bHost:\s.+/).first.split(":").last.strip
# ran as non-root user with sudo privs for the yolo
sudo yum install wget -y
wget http://ardownload.adobe.com/pub/adobe/reader/unix/9.x/9.5.5/enu/AdbeRdr9.5.5-1_i486linux_enu.rpm
sudo yum localinstall http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
sudo yum localinstall AdbeRdr9.5.5-1_i486linux_enu.rpm -y