This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HelloJNI { | |
static { | |
System.loadLibrary("hello"); // loads libhello.so | |
} | |
private native void sayHello(String name); | |
public static void main(String[] args) { | |
new HelloJNI().sayHello("Dave"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!C:\Python27\python.exe | |
# The MIT License (MIT) | |
# | |
# Copyright © 2014-2016 Santoso Wijaya <santoso.wijaya@gmail.com> | |
# | |
# Permission is hereby granted, free of charge, to any person | |
# obtaining a copy of this software and associated documentation files | |
# (the "Software"), to deal in the Software without restriction, | |
# including without limitation the rights to use, copy, modify, merge, | |
# publish, distribute, sub-license, and/or sell copies of the Software, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scapy.all import * | |
# change this to your test machine's MAC address | |
SELF_MAC = '00:0c:29:67:22:c2' | |
BCAST_MAC = 'ff:ff:ff:ff:ff:ff' | |
# this will send a PROBE ARP request packet to the supplied IP address argument |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a hack to patch slow socket.getfqdn calls that | |
# BaseHTTPServer (and its subclasses) make. | |
# See: http://bugs.python.org/issue6085 | |
# See: http://www.answermysearches.com/xmlrpc-server-slow-in-python-how-to-fix/2140/ | |
import BaseHTTPServer | |
def _bare_address_string(self): | |
host, port = self.client_address[:2] | |
return str(host) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC = gcc | |
CFLAGS = -Wall -g -x c++ | |
LFLAGS = -lstdc++ -lm -lboost_unit_test_framework | |
DEFINES = -D TOPDOWN -D USE_BOOST_UT | |
OBJDIR = obj | |
BINDIR = bin | |
TARGET = main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://notmysock.org/blog/hacks/a-twisted-dns-story.html | |
# https://gist.github.com/johnboxall/1147973 | |
# twistd -y dnsfuzz.py | |
import sys | |
import socket | |
from twisted.python import log | |
from twisted.internet.protocol import Factory, Protocol | |
from twisted.internet import reactor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Crypto.Cipher import AES, XOR # from pycrypto library (https://www.dlitz.net/software/pycrypto/) | |
block_size = AES.block_size | |
def decrypt(key, ciphertext): | |
# assume: len(key) == len(IV) == 16 bytes; no padding | |
iv = ciphertext[:block_size] | |
ciph = ciphertext[block_size:] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scapy.all import * | |
# XXX: make sure conf.route6 includes the target IPv6 address in its route table; | |
# you can do so by first calling ping6 so that a neighbor solicitation is done | |
sip = 'fe80::20c:29ff:fe67:22c2' | |
dip = 'fe80::700d:da7e:80bb:aca9' | |
packets = fragment6(IPv6(src=sip, dst=dip) / IPv6ExtHdrFragment() / ICMPv6EchoRequest(data='A'*5000), 1024) | |
send(packets) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add with `sudo visudo`: | |
username ALL=(root) NOPASSWD:/usr/bin/truecrypt | |
# obviously change 'username' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import sys | |
import array | |
import struct | |
NUMRANDS = 10 ** 6 # the number of random integers we want to generate (one million) | |
BUFSIZE = 1000 # the number of integers we buffer internally before flushing to output |
NewerOlder