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 python2 | |
from threading import Event, Thread | |
class Periodic(object): | |
"""Periodically run a function with arguments asynchronously in the background | |
Period is a float of seconds. | |
Don't expect exact precision with timing. | |
Threading is used instead of Multiprocessing because we need shared memory |
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 python2 | |
import string | |
'''mingenerator.py | |
A really quick and dirty answer to : | |
https://www.reddit.com/r/shittyprogramming/comments/3npktf/finding_the_smallest_number_out_of_4_numbers_with/ | |
Author: duckythescientist | |
''' |
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
At first I thought this was a DSP problem. It wasn't. The solution was much simpler. | |
To start, I listened to the entirety of the song. It's not quite everyone's favorite genre, but I rather enjoyed it. I noticed a short burst of static at the beginning. Static typically means data, but I figured I'd look for other patterns. | |
Some GNU Radio later showed that there were no obvious patterns in the spectra of the signal or in the relation of the right and left channels. | |
Initially, I incorrectly converted the file to a raw type. In the converted file, there was obviously some data at the very beginning in the burst of static, but it wasn't readable as anything. | |
I re-did the conversion to raw and looked again. The static was an ELF for linux x86_64. Thinking it couldn't be that easy, I threw it into IDA. It's a binary that grabs samples from the raw audio and prints the samples out as characters. |
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 python3 | |
""" | |
encode.pyc is a compiled python file. | |
The first 2 bytes \x16\x0d == 3350 mean that it's a python3 file. | |
Python3.4 throws a bad magic number error, but python3.5 works. | |
After trying a couple python decompilers, I found that unpyc3 worked the best: | |
``` | |
duck@computer:~/Downloads$ python3.5 ../unpyc3.py encode.pyc | |
import random |
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 python2 | |
""" | |
The pcap is a capture of a USB keyboard. | |
The proper way to tell is by finding the VID/PID combination during enumeration then looking up the device from that. | |
The easy way is just to have looked at enough USB stuffs to recognize that it's a keyboard. :) | |
The keyboard data exists in the USB Leftover section. `tshark` is our friend for extracting this. | |
tshark -r ./intercept.pcapng -T fields -e usb.capdata -Y usb.capdata 2>/dev/null | |
This has some trailing data that we don't care about it, so use tail to skip the beginning 6 lines. |
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 python2 | |
""" | |
Angr would probably be the nice way to solve this. Oh well. | |
Brute force worked for me. | |
Trying different inputs, it seems the length doesn't matter. | |
The output changes depending on how many characters at the beginning match the key. | |
Brute force possible keys watching for output changes (to know when we got the right letter) |
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 python2 | |
import math | |
from pwn import * | |
""" | |
Read this: https://inst.eecs.berkeley.edu/~cs191/fa07/lectures/lecture22_fa07.pdf | |
I don't really know much about quantum computers. | |
Credit goes to [bobert](https://github.com/rstrand2357) for figuring out how to solve this. |
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
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <limits.h> | |
#include <string.h> | |
#include <unistd.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <fcntl.h> | |
#include <sys/mman.h> |
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 python3 | |
import time | |
import threading | |
import functools | |
import tqdm | |
def long_running_function(*args, **kwargs): |
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
# https://stackoverflow.com/a/52465819 | |
function readline_ANSI_escape() { | |
if [[ $# -ge 1 ]]; then | |
echo "$*" | |
else | |
cat # Read string from STDIN | |
fi | \ | |
perl -pe 's/(?:(?<!\x1)|(?<!\\\[))(\x1b\[[0-9;]*[mG])(?!\x2|\\\])/\x1\1\x2/g' | |
} |
OlderNewer