Skip to content

Instantly share code, notes, and snippets.

View crookm's full-sized avatar
🌳

Matt Crook crookm

🌳
View GitHub Profile
@crookm
crookm / TwitterLinkBots.txt
Last active February 6, 2018 09:49
A few of the first bots to access a link on Twitter
Timestamp IPv6 Country UserAgent
2017-07-21 07:51:34.473 0x00000000000000000000FFFFC39AD99A FR Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.21 (KHTML, like Gecko) wpif Safari/537.21
2017-07-21 07:30:43.570 0x00000000000000000000FFFF1760D089 US Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)
2017-07-21 07:13:19.950 0x00000000000000000000FFFF6D44A64C BE NULL
2017-07-21 07:10:54.773 0x00000000000000000000FFFF25BBA2B8 FR Mozilla/5.0 (compatible; PaperLiBot/2.1; http://support.paper.li/entries/20023257-what-is-paper-li)
2017-07-21 07:10:15.083 0x00000000000000000000FFFF586340D6 DE Mozilla/5.0 (compatible; um-LN/1.0; mailto: techinfo@ubermetrics-technologies.com)
2017-07-21 07:09:59.693 0x00000000000000000000FFFF481E0E51 US Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)
2017-07-21 07:09:23.240 0x00000000000000000000FFFF904C17E3 DE Mozilla/5.0 (Windows; U; Windows NT 5.1; de-DE; rv:1.7.6) Gecko/20050321 Firefox/1.0.2
2017-07-21 07:09:09.380 0x00000000000000000
@crookm
crookm / nginx_config_nodejs.txt
Created February 7, 2018 03:54
NGINX config file for node.js applications with websocket support and ssl
server {
listen 80;
server_name example.com www.example.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
@crookm
crookm / work_dist_index.js
Created February 7, 2018 04:22
Setup several forked processes in node.js
const { fork } = require('child_process');
let awaiting = {}; // array of payload ids awaiting responses from workers
let awaiting_lastid = 1; // incrementing payload ids
let worker_pool = [];
function sendPayload(id, payload) {
payload.id = awaiting_lastid++; // set and add id
awaiting[payload.id] = { worker: id, date: Date.now() }
@crookm
crookm / work_dist_worker.js
Created February 7, 2018 04:51
Forked worker to continuously process information in node.js
const self = { id: 0 };
let work_loop = () => {
// some work here! :D
};
function sendPayload(payload) {
process.send(payload);
}
@crookm
crookm / work_dist_query.sql
Created February 7, 2018 04:52
Atomic selection of work that prevents race conditions
UPDATE work
SET
`worker_id` = ?,
`worker_claimedAt` = NOW()
WHERE
(`worker_id` IS NULL
OR `worker_claimedAt` < DATE_SUB(NOW(), INTERVAL 30 SECOND))
AND `active` = 1
ORDER BY `worker_lastWork` DESC
LIMIT 1;
@crookm
crookm / clean_tv_series_filenames.py
Last active January 10, 2019 03:08
Quick python 3 program to rename files for downloaded TV series
import glob, os, re
os.chdir('/directory/you/want/to/work/in')
for file in glob.glob('*[sS][0-9][0-9][eE][0-9][0-9]*'):
ep_string = re.search('[sS][0-9]{2}[eE][0-9]{2}', file).group(0).upper()
file_type = file.split('.')[-1]
new_name = ep_string + '.' + file_type
print(new_name)
os.rename(file, new_name)
@crookm
crookm / stego_extract_img_lsb.py
Last active May 21, 2018 06:58
Python program to extract the text stored in a stego image, that uses LSB row-major - requires PIL
from PIL import Image
stream = []
with open('image.png', 'rb') as img_file:
im = Image.open(img_file)
px = im.load()
x = 0
y = 0
end = False
@crookm
crookm / http_auth_digest_dict_attack.py
Created May 20, 2018 19:41
Basic MD5 dictionary attack on digest HTTP authentication methods - variables should be filled-in with captured packets
import hashlib
extracted = 'known_auth_hash'
nonce = 'known_nonce_hash'
user = 'known_username'
realm = 'known_realm'
uri = '/image.png'
method = 'GET'

Keybase proof

I hereby claim:

  • I am crookm on github.
  • I am crookm (https://keybase.io/crookm) on keybase.
  • I have a public key ASDb2xTjW6QH6qhbUN94hemJ1SK8Ye9zadv2gmyUbNmCXgo

To claim this, I am signing this object:

export default class API {
constructor() {
/**
* This is the function that should be called in the
* actual application.
*/
this.apiFunc = this._debounce(this._apiFunc, 1000 * 2);
}
/**