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
func FindInPath(targets []string) <-chan string {
messages := make(chan string)
go func() {
defer close(messages)
var paths = EnviromentPaths()
for _, target := range targets {
for _, path := range paths {
var target = path + "/" + target
if Exists(target) {
messages <- target
func main() {
if len(os.Args) > 1 {
found := FindInPath(os.Args[1:])
for path := range found {
fmt.Println(path)
}
} else {
fmt.Println("usage: which program ...")
os.Exit(1)
}
package main
import (
"fmt"
"os"
"strings"
)
func EnviromentPaths() []string {
val, ok := os.LookupEnv("PATH")
@picatz
picatz / data
Created January 30, 2018 18:52
This file has been truncated, but you can view the full file.
jOFPeRMsKIZukh7gVtDKgAbYAvQhKUuLMKHy8NbrB9B+JdW+Vxf9xrdxV3XQhU6diPWQkRND
pgsYKgWOlUnVxsf9IP6oFSfYj13wjncONO11yWEpwENIl4p4ny5+JDQfH/Vh+7K7rGkTFHOQ
kAeakwFTkuJU9oTmE+kGOz2OKfLV6XGePjZc1spzm1htXLacFHXheR2rSUcbhmPyvcXAHeMw
xOB2q1/PIRPkZZmTzVdg8BBLoFEGf15M6RdpQLn6KPM0NoHvgo/sgb1LzcPRFR9z2CHhvXTO
Bv9FOPtelG3UpUnziT8p80iTULpkoztUtHmZB3+iI1m9Br1EaLnI41++eyzXT4veHl+bf9pJ
dRQGEEfGD1rDYoxLDHJ1MUk+6C/TMHOdWCT0/irBA+cmE84DWD4E9lstD8dSoTJDWL6kbEW+
z866wyTKl7TdADKYoAAoE+O8rihCZD/4rwv5u2/cABXskAoDOVIqJOD2+ZJeoQ22e25UIDcd
d9hj3wbXRGy/miOG9ZcvJtSgjIY5y1wgdvte0/+k7GgsTlQcMxgbd1NC3MFiaxIlMRH0o7MP
iY5aMHcT1BMOWRCCuOzFxovd6Y5yjwA7w6i0QcdIdy5K7rXe8jhjfdMifPKPBkQJOQm04laK
lL22xVIQsOZVE3gUwP9MhoqEoLCNbGbntzqsCGLGNOl3qWKFCKBtBhm9RtRQTd/fuXNYX5Cq
@picatz
picatz / bcap.js
Created February 10, 2018 01:45
example client-side javascript code to communicate with bettercap API
var session
var credentials
var resp
function encodeBasicAuthorizationCredentials(options = {}) {
return 'Basic ' + btoa(options.username + ":" + options.password)
}
function setCredentials(options = {}) {
credentials = encodeBasicAuthorizationCredentials(options)
require 'slack-ruby-client'
require 'net/http'
require 'logger'
# random logging for later analysis
logger = Logger.new('bot.log')
# public ip address for connecting to
PUBLIC_IP = Net::HTTP.get(URI "https://api.ipify.org").strip
FROM ruby:2.5.0
RUN gem install slack-ruby-client faye-websocket eventmachine
COPY kumo_dojo_bot.rb /kumo_dojo_bot.rb
CMD ["ruby", "kumo_dojo_bot.rb"]
provider "aws" {}
data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-*"]
}
@picatz
picatz / packet_parsing_process_pool.rb
Last active March 27, 2018 17:12
Process Pool Packet Parsing
require 'packetgen'
class Worker
attr_accessor :reader
attr_accessor :writer
def initialize
@reader, @writer = IO.pipe
@output_reader, @output_writer = IO.pipe
@process = fork do
trap "SIGINT" do
@picatz
picatz / flareon.rb
Created April 3, 2018 14:30
Cloudflare DNS over HTTPs Example
require 'httparty'
url = "https://cloudflare-dns.com/dns-query"
query = { name: "microsoft.com", type: "MX", ct: "application/dns-json" }
headers = {'Content-Type': 'application/json'}
buffer = StringIO.new
response = HTTParty.get(url, stream_body: true, query: query, headers: headers) do |fragment|
buffer << fragment