Skip to content

Instantly share code, notes, and snippets.

View thepacketgeek's full-sized avatar

Mat Wood thepacketgeek

View GitHub Profile
#!/usr/bin/env bash
# change to proper directory
cd /Applications/Google\ Drive.app/Contents/Resources/
# back up the files
sudo mkdir icon-backups
sudo cp mac-animate*.png icon-backups/
sudo cp mac-error*.png icon-backups/
sudo cp mac-inactive*.png icon-backups/
#!/bin/bash
# This script will migrate schema and data from a SQLite3 database to PostgreSQL.
# Schema translation based on http://stackoverflow.com/a/4581921/1303625.
# Some column types are not handled (e.g blobs).
#
# See also:
# - http://stackoverflow.com/questions/4581727/convert-sqlite-sql-dump-file-to-postgresql
# - https://gist.github.com/bittner/7368128
from extensions import db
from celery import Celery
from flask import Flask
from config import config, SELECTED_CONFIG
def create_celery_app(app=None):
app = app or create_app()
celery = Celery(__name__, broker=app.config['CELERY_BROKER_URL'])
celery.conf.update(app.config)
TaskBase = celery.Task
#!/usr/bin/env python
## Tiny Syslog Server in Python.
##
## This is a tiny syslog server that is able to receive UDP based syslog
## entries on a specified port and save them to a file.
## That's it... it does nothing else...
## There are a few configuration parameters.
LOG_FILE = 'youlogfile.log'
@thepacketgeek
thepacketgeek / cleanScapyPacket.py
Created October 4, 2013 16:34
Clean up a scapy packet summary
def cleanPayload(p):
p = str(p)
# Clean up packet payload from scapy output
return p.split('Raw')[0].split("Padding")[0].replace('|','\n').strip('<')\
.strip('bound method Ether.show of ').replace('>','').replace('[<','[')\
.replace('\n<','<').replace('<','\n');

Create a Meteor app and put the client_/server_ files in a client/server directories. Also, create a public dir to save the uploaded files.

@thepacketgeek
thepacketgeek / scapy-CustomAction.py
Last active December 24, 2015 22:59
Run a custom function on every packet sniffed with scapy
## Import Scapy module
from scapy.all import *
## Create a Packet Count var
packetCount = 0
## Define our Custom Action function
def customAction(packet):
global packetCount
packetCount += 1
@thepacketgeek
thepacketgeek / 07-sniff-arp.py
Last active December 25, 2015 04:49
Scapy - Basic ARP sniff
from scapy.all import *
print sniff(filter="arp",count=10).summary()
@thepacketgeek
thepacketgeek / 07-print-ping.py
Last active December 25, 2015 04:49
Ping an IP and print out the summary of the response packets
from scapy.all import *
print sr1(IP(dst="4.2.2.1")/ICMP()).summary()
@thepacketgeek
thepacketgeek / 10-tcp-port-scan.py
Last active December 26, 2015 06:39
TCP port scanner, 1 host for an array of specified ports
from scapy.all import *
import random
# Define end host and TCP port range
host = "www.facebook.com"
portRange = [22,23,80,443,3389]
# Send SYN with random Src Port for each Dst port
for dstPort in portRange:
srcPort = random.randint(1025,65534)
resp = sr1(IP(dst=host)/TCP(sport=srcPort,dport=dstPort,flags="S"),timeout=1,verbose=0)