Skip to content

Instantly share code, notes, and snippets.

View aeppert's full-sized avatar

Aaron Eppert aeppert

View GitHub Profile
@aeppert
aeppert / force_bind_to_a_specific_local_port_and_ssl.py
Last active February 5, 2016 22:29
Force a binding to a specific local port and then SSL encapsulate everything outbound.
#!/usr/bin/python
import ssl
import socket
def get_outbound_ip():
ret = None
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("gmail.com", 80))
@aeppert
aeppert / extract_smtp_stream.bro
Created February 29, 2016 19:52 — forked from dcode/extract_smtp_stream.bro
Extracts SMTP stream going both directions using Bro. Similar to "Follow TCP Stream" in Wireshark.
event protocol_confirmation (c: connection, atype: Analyzer::Tag, aid: count)
{
if ( atype == Analyzer::ANALYZER_SMTP )
{
local both_file = generate_extraction_filename(Conn::extraction_prefix, c, "both.dat");
local both_f = open(both_file);
set_contents_file(c$id, CONTENTS_BOTH, both_f);
}
}
@aeppert
aeppert / pcap_annotate_influxdb.py
Created March 2, 2016 21:37
Annotate an Influxdb database with a PCAP being played for correlation across test events
#!/usr/bin/python
import sys
from optparse import OptionParser
import ConfigParser
from influxdb import InfluxDBClient
G_VALID_STATUS = ['start', 'stop']
@aeppert
aeppert / sine_wave_test_influxdb.py
Last active March 2, 2016 22:01
Write sine wave points to Influxdb for testing.
#!/usr/bin/python
import argparse
from influxdb import InfluxDBClient
import math
import datetime
import time
USER = 'root'

Keybase proof

I hereby claim:

  • I am aeppert on github.
  • I am aeppert (https://keybase.io/aeppert) on keybase.
  • I have a public key whose fingerprint is 7D23 1BB4 89F1 19A6 59CB 6706 A16D BEB5 10E3 D194

To claim this, I am signing this object:

@aeppert
aeppert / time_elapsed.bro
Last active February 17, 2020 03:25
Calculate elapsed time given two times
export {
type timeSpan: record {
hours: int;
minutes: int;
seconds: int;
};
}
function calc_elapsed_time(t1: time, t2: time) : timeSpan
{
@aeppert
aeppert / service_decorators.py
Created April 18, 2016 17:52
Service Decorators
from functools import partial
class test:
def __init__(self):
pass
@staticmethod
def stop_service(name):
print 'stopping service - %s' % (name)
@staticmethod
def start_service(name):
@aeppert
aeppert / stash_slack_integration.md
Created May 24, 2016 17:52 — forked from molaschi/stash_slack_integration.md
Integrate Stash with Slack using webhooks

This is a short article on how we integrate stash and slack in openmind

First of all i assume you have:

  • a working stash installation
  • a repository you to notify slack on pushes
  • stash user with administration priviledges
  • full access to the server (linux) where stash is installed on
  • a team configured on slack
  • slack user with administration priviledges
let fizzbuzz i = match ((i mod 3), (i mod 5)) with
| (0,0) -> "fizzbuzz"
| (_,0) -> "buzz"
| (0,_) -> "fizz"
| (_,_) -> string_of_int i ;;
let do_fizzbuzz n = for i = 1 to n do
Printf.printf "%s\n" (fizzbuzz i)
done ;;
@aeppert
aeppert / replace_between_two_markers.sh
Created June 14, 2016 17:58
Replace a string between markers using a variable
TLSDATE_CONFIG=" \
\thost 127.0.0.1\n\
\tport 8443\n \
\tproxy none"
sed -i -n "/source/{p;:a;N;/end/!ba;s/.*\n/${TLSDATE_CONFIG}\n/};p" /etc/tlsdate/tlsdated.conf