Skip to content

Instantly share code, notes, and snippets.

View askldjd's full-sized avatar

Alan Ning askldjd

View GitHub Profile
import socket, struct, os, array
from scapy.all import ETH_P_ALL
from scapy.all import select
from scapy.all import MTU
class IPSniff:
def __init__(self, interface_name, on_ip_incoming, on_ip_outgoing):
self.interface_name = interface_name
from scapy.all import *
def pkt_callback(pkt):
pkt.show() # debug statement
sniff(iface="eth0",
prn=pkt_callback, filter="ip", store=0)
@askldjd
askldjd / check-dups.js
Created June 6, 2016 02:18
Check duplicate NPM modules
'use strict';
const _ = require('lodash');
const spawn = require('child_process').spawn;
// Holds a list of all flattened packages used in this module
let packages = [];
/**
* Run through the npm dependencies object and recursively accumulate all
@askldjd
askldjd / socks-proxy.js
Created August 5, 2016 12:57
Quick POC for proxying S3
'use strict';
const socks = require('socksv5');
const srv = socks.createServer(function(info, accept, deny) {
accept();
});
srv.listen(50099, 'localhost', function() {
console.log('SOCKS server listening on port 50099');
});
# Match on all types of devices but tablet devices and joysticks
Section "InputClass"
Identifier "libinput pointer catchall"
MatchIsPointer "on"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
EndSection
Section "InputClass"
Identifier "libinput keyboard catchall"
@askldjd
askldjd / analyze-gen.rb
Created January 11, 2017 18:44
Look for a single generation of ruby heap and print out the allocation source.
require 'json'
class Analyzer
def initialize(filename)
@filename = filename
end
def analyze
data = []
File.open(@filename) do |f|
f.each_line do |line|
@askldjd
askldjd / analyze.rb
Created January 11, 2017 18:45
Perform a top level analysis on the ruby heap dump.
require 'json'
class Analyzer
def initialize(filename)
@filename = filename
end
def analyze
data = []
File.open(@filename) do |f|
f.each_line do |line|
Go to line
- Esc
- Line number
- shift-g
Auto complete
- Ctrl-n
Multi-line-edit
- Esc
@askldjd
askldjd / sh
Created January 30, 2017 21:52
Dump all threads
#!/bin/bash
for i in {0..64}
do
echo displaying $i thread
rbtrace -p 2475 -e "Thread.list[$i].backtrace.join('\n')"
done
@askldjd
askldjd / inventory.py
Created March 17, 2017 20:34
Simple ansible inventory without ec2.py
#!/usr/bin/python
import boto3
import json
import os
client = boto3.client('ec2')
# filter.json
# [