Skip to content

Instantly share code, notes, and snippets.

View flyte's full-sized avatar
😎
Open for project work

Ellis Percival flyte

😎
Open for project work
  • London
View GitHub Profile
import serial
import socket
import argparse
import sys
from time import sleep
NEWLINE = "\r\n"
def connect_tcp(sock, target):
@flyte
flyte / star_url.py
Created January 24, 2014 15:53
Rebuild a URL with stars covering the password.
def star_url(url):
"""
Rebuild a URL with stars covering the password.
"""
url = urlparse(url)
ret = ""
# Scheme (http/https)
if url.scheme:
ret += "%s://" % url.scheme
# Username/password
@flyte
flyte / qr.php
Created January 10, 2014 12:37
Generate QR code contents in PHP.
<?php
function toQRCode($prefix, $str) {
$prefixOrd = "";
for ($i = 0; $i < strlen($prefix); $i++) {
$c = substr($prefix, $i, 1);
$prefixOrd.= dechex(ord($c));
}
return $prefixOrd.md5($str);
}
@flyte
flyte / ord_hex_string.js
Created January 9, 2014 13:46
Return a string of the hex ASCII ordinal values of a string.
function toOrdinalHexString(str) {
ret = "";
for (i=0; i < str.length; i++) {
c = str.charAt(i);
ret = ret.concat(c.charCodeAt(0).toString(16));
}
return ret;
}
@flyte
flyte / qr.py
Created December 18, 2013 12:46
Generate/validate a QR code value.
"""
Easy version...
def qr_hash(prefix, data_to_hash):
qr = ""
for char in prefix:
qr += hex(ord(char))[2:]
qr += md5(data_to_hash).hexdigest()
return qr
@flyte
flyte / firstcc_major_disruption.py
Created December 17, 2013 10:40
Get text from First Capital Connect major disruption website
from mechanize import Browser
from BeautifulSoup import BeautifulSoup
if __name__ == "__main__":
br = Browser()
page = br.open("http://www.firstcapitalconnect.co.uk/plan-your-journey/major-disruption/")
soup = BeautifulSoup(page.get_data())
s = soup.find("div", {"class": "single-container"})
lines = s.findAll("span")
text = ""
@flyte
flyte / get_all_site_links.py
Created December 16, 2013 01:22
Gets links to all pages on a website.
@flyte
flyte / ts_make_serveradmin.py
Last active December 30, 2015 23:49
Telnets to a TeamSpeak 3 server and sets the given user to be in the serveradmin group. User must be on the TS server at runtime.
from telnetlib import Telnet
from getpass import getpass
from time import sleep
import re
import argparse
import sys
p = argparse.ArgumentParser()
p.add_argument("-s", "--server", required=True)
p.add_argument("-p", "--port", default=10011, type=int)
@flyte
flyte / fake_swipe.py
Last active December 30, 2015 06:09
Fake a "swipe" UDP packet from a network based RFID reader by spoofing the source IP.
from collections import OrderedDict
import argparse
import logging
# Suppress ipv6 warning when importing scapy
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from scapy.all import IP, UDP, send, L3RawSocket, conf
PACKET_FORMAT = "tag=%s&%s&seq=0x%04x"
@flyte
flyte / archive_to_glacier.py
Created November 25, 2013 18:20
tar.gz a directory and push it to Glacier.
from boto import glacier
from datetime import datetime
from os.path import isdir
import argparse
import tarfile
try:
# Python 2.7
from collections import OrderedDict
except ImportError: