Skip to content

Instantly share code, notes, and snippets.

@sh4t
sh4t / steam.py
Created August 27, 2015 01:45
Parse GMAIL via IMAP, within steam (label/folder) for emails containing IPv4 address and write to a file. My attempt to deal with brute forcing.
#!/usr/bin/env python
#
#
import sys
import imaplib
import getpass
import email
import email.header
import datetime
@sh4t
sh4t / keybase.md
Created April 7, 2014 18:32
Keybase is forcing me to write this gist for validity of my identity, stupid but doing it. Forced to do this pisses me off.

Keybase proof

I hereby claim:

  • I am sh4t on github.
  • I am shat (https://keybase.io/shat) on keybase.
  • I have a public key whose fingerprint is AC1E 378D 0A70 49EE F592 2134 9729 5FA5 CCA6 B271

To claim this, I am signing this object:

@sh4t
sh4t / mxlookup.py
Created June 24, 2014 17:25
Command-line script for querying MX records using Python Twisted Framework, adapted from example in Twisted documentation.
#!/usr/bin/env python
# encoding: utf-8
"""Command-line script for querying MX records.
Usage:
mxlookup.py example.com # Uses DNS servers in /etc/resolv.conf
or
mxlookup.py example.com 8.8.8.8 # Uses DNS server 8.8.8.8
@sh4t
sh4t / cleanup.py
Created June 24, 2014 19:49
Command-line script for cleaning up paths, specifically my gloriously over-stuffed log paths.
#!/usr/bin/env python
# encoding: utf-8
"""Command-line script for cleaning up log paths.
Usage:
cleanup.py [NUM_OF_DAYS] # Removes anything older than NUM_OF_DAYS, including empty paths.
"""
@sh4t
sh4t / ec2_ip_eth0.md
Created July 8, 2014 22:22
Amazon AWS EC2 Elastic IP Addresses and Interfaces for EC2 Instances

Instance Type|Maximum Interfaces|Maximum IP Addresses c1.medium|2|6 c1.xlarge|4|15 c3.large|3|10 c3.xlarge|4|15 c3.2xlarge|4|15 c3.4xlarge|8|30 c3.8xlarge|8|30 cc2.8xlarge|8|30 cg1.4xlarge|8|30

@sh4t
sh4t / sd-custom-metric.py
Last active August 29, 2015 14:03
Posting a custom data metric to stackdriver.com app api using Python. This counts the number of files within my_path and publishes that count to Stackdriver via their API endpoint.
#!/usr/bin/env python
# encoding: utf-8
import requests
import json
import time
import os
def submit_my_data_count():
# path to files we want to count, that count gets submitted to stackdriver's API.
require 'facter'
if Facter.value("ec2_instance_id") != nil
instance_id = Facter.value("ec2_instance_id")
region = Facter.value("ec2_placement_availability_zone")[0..-2]
tags = Facter::Util::Resolution.exec("ec2dtag --filter \"resource-id=#{instance_id}\" --region #{region} | cut -f 4-|awk 'BEGIN{FS=\" \";OFS=\"|\"} {$1=$1; print $0}'")
tags.scan(/(.*)\|+(.*)/) do |key, value|
fact = "ec2_tag_#{key}"
Facter.add(fact) { setcode { value } }
end
@sh4t
sh4t / rybysyn.rb
Created October 29, 2014 20:09
Ruby syn packet flood test tool *USE AT OWN RISK*
#!/usr/bin/ruby
require 'rubygems'
require 'racket'
require 'monitor'
require 'optparse'
require 'ostruct'
include Racket
@sh4t
sh4t / slow_them_agents.tcl
Created July 17, 2015 00:50
push pesky bots/user-agents to slower pools in LTM
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::header User-Agent]] {
"*scooter*" -
"*slurp*" -
"*msnbot*" -
"*fast-*" -
"*teoma*" -
"*googlebot*" {
# Send bots to the bot pool
pool slow_webbot_pool