Skip to content

Instantly share code, notes, and snippets.

@geekman
geekman / usbasp-fw.diff
Created July 20, 2017 14:12
USBasp patch for the zhifengsoft USB ISP device (and newer avr-gcc)
diff -ur firmware/Makefile firmware-new/Makefile
--- firmware/Makefile 2011-05-28 15:57:49 +0800
+++ firmware-new/Makefile 2017-07-16 01:12:03 +0800
@@ -7,7 +7,7 @@
# TARGET=atmega8 HFUSE=0xc9 LFUSE=0xef
# TARGET=atmega48 HFUSE=0xdd LFUSE=0xff
# TARGET=at90s2313
-TARGET=atmega8
+TARGET=atmega88
HFUSE=0xc9
@geekman
geekman / Makefile
Last active April 4, 2019 02:53
Makefile for an ATtiny10 project
#
# Makefile for an ATtiny10 project
#
CC=avr-gcc
OBJCOPY=avr-objcopy
OBJDUMP=avr-objdump
#F_CPU := 8000000
MCU := attiny10
@geekman
geekman / pew.js
Created October 14, 2017 15:13
Frida solver script for Flare-On 2017 challenge 5 (pewpewboat.exe)
//
// solver script for flare-on #5 pewpewboat.exe
// run with frida -l pew.js -f pewpewboat.exe --no-pause -o pew.log
//
var mainProgLoop = ptr(0x403c05);
var getInput = ptr(0x40377D);
var clearScreen = ptr(0x4031E1);
var notMd5Prompt = ptr(0x403530);
@geekman
geekman / maze1.txt
Created November 14, 2017 04:02
Maze solver (PAN CTF 2017, programming 1)
###########
#> #
# # ##### #
# # # #
# # #X### #
# # # # # #
# ### # # #
# # # #
# # ### ###
# # #
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>drag &amp; drop</title>
<style>
html, body {
margin: 0;
padding: 0;
@geekman
geekman / GetProfileOwner.ps1
Created January 2, 2018 15:18
retrieves owner of a Windows profile directory
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True,Position=1)]
[string] $Path
)
# Usually the profile owner has full control, but is not a well-known SID
# References:
# https://support.microsoft.com/en-us/help/243330/well-known-security-identifiers-in-windows-operating-systems
# https://technet.microsoft.com/en-us/library/ff730940.aspx
@geekman
geekman / moveup.py
Last active July 12, 2023 17:01
removes a block within a file and shifts its following contents "upwards"
# moves up file data at current pos to specified to_offset
def moveup(f, to_offset, block_size=4096):
assert f.tell() > to_offset
while True:
data = f.read(block_size)
newpos = f.tell()
f.seek(to_offset)
to_offset += len(data)
@geekman
geekman / script.ps1
Created March 29, 2018 05:10
making sure your USB network adapter doesn't take over your default gateway & Internet connection
# to verify, use `route print` and check the order in which the interfaces are listed
Get-NetAdapter | Where-Object {$_.InterfaceDescription -like '*USB*'} | Set-NetIPInterface -InterfaceMetric 9999
@geekman
geekman / fixer.js
Created May 12, 2018 11:07
JS to "fixup" ASCII art on old Apple docs, e.g https://support.apple.com/kb/TA40730
document.querySelector('.SUMMARY').childNodes.forEach(function(e) {
if (e.nodeType == Node.TEXT_NODE && (e.textContent.match(/[+|-]/g) || []).length > 2) {
var n = document.createElement('code');
n.textContent = e.textContent.replace(/^[\r\n]*(.*)[\r\n]*$/, '$1');
n.style = 'white-space:pre-wrap';
e.parentNode.replaceChild(n, e);
}
});
@geekman
geekman / boot.cmd
Created July 21, 2018 15:54
boot-time device tree overlays with U-Boot
part uuid ${devtype} ${devnum}:${bootpart} uuid
setenv bootargs console=${console} root=PARTUUID=${uuid} rw rootwait
if load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} /boot/zImage; then
if load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} /boot/dtbs/${fdtfile}; then
fdt addr ${fdt_addr_r}
fdt resize
setexpr fdtovaddr ${fdt_addr_r} + F000