Skip to content

Instantly share code, notes, and snippets.

View SteveBarnes-BH's full-sized avatar
🏠
Working from home

Steve Barnes SteveBarnes-BH

🏠
Working from home
View GitHub Profile
@SteveBarnes-BH
SteveBarnes-BH / dhcp_server.py
Created August 21, 2022 09:08 — forked from yosshy/dhcp_server.py
DHCP Server with Python Scapy
from scapy.all import DHCP_am
from scapy.base_classes import Net
dhcp_server = DHCP_am(iface='eth1', domain='example.com',
pool=Net('192.168.10.0/24'),
network='192.168.10.0/24',
gw='192.168.10.254',
renewal_time=600, lease_time=3600)
dhcp_server()
@SteveBarnes-BH
SteveBarnes-BH / check_py_assoc.bat
Last active November 9, 2021 05:07
Check the python registry keys to ensure parameters are passed to python when .py files are invoked
@echo OFF
REM This file queries the registry to see if python files are going to be provided with parameters
REM when called by invoking as <filename>.py
reg query HKEY_CLASSES_ROOT\.py_auto_file\shell\open\command
reg query HKEY_CLASSES_ROOT\Applications\py.exe\shell\open\command
reg query HKEY_CLASSES_ROOT\Python.File\shell\open\command
echo ALL the above values should end with "%%1" %%* if they don't then you will need to use regedit to fix
@SteveBarnes-BH
SteveBarnes-BH / cgi-post.py
Last active November 1, 2021 12:20
CGI Debugging - sometimes you have a web page that uses CGI and you need to see what data is being POSTed.
#!/usr/bin/env python
"""
This script is based on https://cgi.tutorial.codepoint.net/file-upload but with changes as needed.
To use:
- Download the web page to be debugged.
- Edit it to replace `action="/cgi-bin/cgi-post"` with `action="/cgi-bin/cgi-post.py"` (on Windows on Linux you can simply rename this file to not have .py at the end.
- place in a cgi-bin subdirectory of the one where you saved the web page
- start a simple web server with ` python -m http.server 8001 --bind localhost --cgi`
@SteveBarnes-BH
SteveBarnes-BH / setup_git_ahead_behind.bat
Created September 23, 2021 07:21
Set some handy aliases for git
git config --global alias.ahead "log --stat @{u}.."
git config --global alias.behind "log --stat ..@{u}"