Skip to content

Instantly share code, notes, and snippets.

View aeppert's full-sized avatar

Aaron Eppert aeppert

View GitHub Profile
@aeppert
aeppert / itimer_test.c
Created October 12, 2017 20:13
ITIMER with sigaction example
#include <stdio.h>
#include <signal.h>
#include <sys/time.h>
static volatile sig_atomic_t g_called;
void g(int sig)
{
g_called += 1;
printf("g called - %d times\n", g_called);
@aeppert
aeppert / hexdump.pac
Last active October 26, 2017 23:35
Hexdump in Binpac
%extern{
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <sstream>
%}
function dump_message(msg: const_bytestring): bool
%{
int i;
@aeppert
aeppert / lsmod.go
Last active September 29, 2017 14:27
/ Aaron Eppert - 2017
// golang wrapper around libkmod with lsmod as an example
//
package main
/*
#cgo pkg-config: libkmod
#include <libkmod.h>
*/
import "C"
package main
import (
"fmt"
"syscall"
)
func UtsArrayToStr(in []int8) string {
i, out := 0, make([]byte, 0, len(in))
for ; i < len(in); i++ {
package main
import (
"encoding/json"
"fmt"
"net"
)
type netifs struct {
Addrs []string
@aeppert
aeppert / af_packet_rx_ring.c
Created September 19, 2017 17:37 — forked from pavel-odintsov/af_packet_rx_ring.c
af_packet_rx_ring_habrahabr.c
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <unistd.h>
#include <boost/thread.hpp>
#include <sys/mman.h>
#include <poll.h>
#include <arpa/inet.h>
@aeppert
aeppert / vin_check.cc
Last active August 18, 2017 19:17
Verify VIN
#include <vector>
#include <iostream>
#include <map>
#include <functional>
#include <numeric>
using namespace std;
#define VIN_LEN 17
#define VIN_CHECKDIGIT_POS 8
@aeppert
aeppert / sym_test.cc
Created August 8, 2017 18:31
Enumerate and demangle symbols within an executable's own symbol table.
#include <stdio.h>
#include <stdlib.h>
#include <cxxabi.h>
#include <link.h>
#include <string>
#include <vector>
#include <iostream>
using namespace std;
@aeppert
aeppert / resize_chrome_720.applescript
Created August 7, 2017 13:20
Resize Chrome to 720p
set theApp to "Chrome"
set appHeight to 720
set appWidth to 1280
tell application "Finder"
set screenResolution to bounds of window of desktop
end tell
set screenWidth to item 3 of screenResolution
set screenHeight to item 4 of screenResolution
@aeppert
aeppert / pcap_stats.sh
Created August 3, 2017 20:47
Generate PCAP protocol statistics
#!/bin/bash
for i in `find . -type f -name "$1"`
do
mv $i $i.pcap
tshark -r $i.pcap -q -z io,phs > $i-summary.txt
done