Skip to content

Instantly share code, notes, and snippets.

@jantore
jantore / define-strings.py
Created July 9, 2017 18:07
IDAPython script for defining identified strings
import idc
import idautils
strings = idautils.Strings()
strings.setup(strtypes=idautils.Strings.STR_C, ignore_instructions=True, minlen=8)
strings.refresh(ea1=MinEA())
for s in strings:
if not idc.GetStringType(s.ea):
idc.MakeStr(s.ea, s.ea + s.length)
@jantore
jantore / ppc-functions.py
Created July 9, 2017 18:05
IDAPython script for finding functions in PPC code
import idc
# When setting up a new stack frame, r0 is used to store the old link
# register, and r1 is the stack pointer. Some compilers create the
# following function prologue:
# stwu r1, d(r1)
# mflr r0
prologue = "94 21 ? ? 7C 08 02 A6"
ea = MinEA()
@jantore
jantore / ferm.conf
Created July 31, 2016 19:07
NAT-PMP hole punching with natpmpc and ferm
def &FORWARD($interface, $port, $dest) = {
table nat chain PREROUTING interface $interface proto tcp dport $port mod comment comment "forward $port" DNAT to $dest;
table filter chain FORWARD interface $interface proto tcp dport $port daddr $dest ACCEPT;
}
@hook post "pmp-request-forwards 86400";
&FORWARD(eth0, 49152, 192.0.2.1);
&FORWARD(eth0, 49153, 192.0.2.2);
@jantore
jantore / ep.pl
Last active December 6, 2015 14:10
Render Mojolicious Embedded Perl templates from the command line
#!/usr/bin/env perl
use warnings;
use strict;
use Mojo::Template;
my $out = Mojo::Template->new->render_file(shift // '/dev/stdin', @ARGV);
if(ref $out) {
#define _GNU_SOURCE
#include <dlfcn.h>
#include <netdb.h>
#include <string.h>
typedef int (*getaddrinfo_t)(const char *node, const char *service,
const struct addrinfo *hints,
struct addrinfo **res);
int getaddrinfo(const char *node, const char *service,
@jantore
jantore / jensen-autowpa.py
Last active August 29, 2015 14:18
AirLink 89300 AutoWPA PSK generator
#!/usr/bin/env python
import sys, re
if len(sys.argv) != 2:
sys.exit("Usage: {0} <MAC address>".format(sys.argv[0]))
mac = bytearray(sys.argv[1].lower().translate(None, '-:'))
# straight from /bin/AutoWPA
alphabet = bytearray("2345679abcdefghjklmnopqrstuvwxyzACDEFGHIJKLMNPQRSTUVWXYZ")
@jantore
jantore / mcproxy.go
Created November 3, 2014 19:00
Multicast to HTTP in Go
package main
import (
"log"
"net"
"net/http"
"regexp"
"io"
"strconv"
)
@jantore
jantore / app.pl
Last active August 29, 2015 14:04
mojitude
#!/usr/bin/perl
use strict;
use warnings;
package Positioner;
use Mojo::Base 'Mojo::EventEmitter';
use Mojo::IOLoop;
This file has been truncated, but you can view the full file.
# File dates extracted from ZIP archives and sorted. Some garbage data
# is likely, note the first and last few entries.
19800101.000000 ah_dream.xm
19800101.000000 ah_move.xm
19800101.000000 creacion.it
19800101.000000 cypress_mill.mod
19800101.000000 DANCEDAY.MOD
19800101.000000 ENDLESS.MOD
19800101.000000 fsx-alk1.mod
19800101.000000 fsx-alk2.mod
#!/usr/bin/env python
import sys
from struct import Struct
from argparse import ArgumentParser, FileType, Action
from collections import namedtuple
from zlib import crc32
from time import time
from shutil import copyfileobj