Skip to content

Instantly share code, notes, and snippets.

@ColdHeat
ColdHeat / http.sh
Created June 6, 2022 02:16
One line simple http server with openbsd netcat
View http.sh
while true; do printf 'HTTP/1.1 200 OK\nContent-Length: 7\nContent-Type: text/html; charset=UTF-8\nServer: netcat!\n\n\nhello\n' | nc -l 80; done
@ColdHeat
ColdHeat / inverse-cidr.py
Created October 29, 2021 16:48 — forked from nacx/inverse-cidr.py
Compute the inverse list of CIDR blocks
View inverse-cidr.py
"""Use it like this: main('192.168.1.0/24')"""
IPV4_MIN = 0
IPV4_MAX = 0xFFFFFFFF
def not_network(ipv4_address, ipv4_netmask):
assert IPV4_MIN <= ipv4_address <= IPV4_MAX
assert IPV4_MIN <= ipv4_netmask <= IPV4_MAX
def hostmask_netmask(m):
@ColdHeat
ColdHeat / htmldiff.py
Last active July 24, 2020 19:21
Script to help update CTFd Pages to CommonMark
View htmldiff.py
import re
import subprocess
import tempfile
import cmarkgfm
import mistune
from bs4 import BeautifulSoup
from sqlalchemy import create_engine
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import sessionmaker
@ColdHeat
ColdHeat / pinout.md
Last active June 21, 2018 07:43
PSNee pinout on Attiny45
View pinout.md

On an Attiny45 you can perhaps expect the following pinout which you can slowly remap back to the MM3 pinout diagrams. This is untested by me.

1 - N/A
2 - N/A
3 - GATE
4 - GND
5 - SQCK
6 - SUBQ
7 - DATA
@ColdHeat
ColdHeat / ip_address.py
Created June 10, 2017 02:22
Functions to convert IP addresses to decimals and back
View ip_address.py
from socket import inet_pton, inet_ntop, AF_INET, AF_INET6
from struct import unpack, pack, error as struct_error
def ip2long(ip):
'''Converts a user's IP address into an integer/long'''
if '.' in ip:
# ipv4
return unpack('!i', inet_pton(AF_INET, ip))[0]
else:
@ColdHeat
ColdHeat / autobots.py
Created October 2, 2015 08:19
(PWN350) autobots challenge from CSAW CTF 2015
View autobots.py
import random
import hashlib
import threading
import subprocess
import SocketServer
import os
import signal
from subprocess import Popen, PIPE, STDOUT
import subprocess, shlex
View gist:877137829fe63c720ead
### Keybase proof
I hereby claim:
* I am ColdHeat on github.
* I am kchung (https://keybase.io/kchung) on keybase.
* I have a public key whose fingerprint is 2317 E0FF BFD0 ED07 26A6 D553 5931 7106 359B FFE8
To claim this, I am signing this object: