Skip to content

Instantly share code, notes, and snippets.

@wideglide
wideglide / macos-static-routes.md
Created May 28, 2024 17:56
mac OS add static routes

Friday, November 6, 2020

from: https://www.analysisman.com/2020/11/macos-staticroutes.html

How to add and delete Static Routes on macOS (persistently)

Problem

I have several networks at home, including 192.168.1.0/24 and 192.168.2.0/24. A problem occurred when I connected to a VPN site because it gives a route with 192.168.2.0/23. So my traffic on 192.168.2.0/24 routed through the VPN tunnel instead of my internal home network.

@wideglide
wideglide / encode.ps1
Created October 10, 2023 19:37
PowerShell gzip compress and base64 encode file
function Get-Gzip64 {
Param (
$filename
)
$fd = [System.IO.File]::ReadAllBytes($filename)
$ms = New-Object System.IO.MemoryStream
$gz = New-Object System.IO.Compression.GZipStream($ms, [System.IO.Compression.CompressionMode]::Compress)
$gz.Write($fd, 0, $fd.Length)
$gz.Close();
$ms.Close()
@wideglide
wideglide / function-bounds-issues.md
Created February 24, 2022 17:43
Identified issues with evaluating function boundaries of disassemblers.
  1. Definition of function start and end.
  2. Functions with exception handlers.
  3. Functions like thunk functions (name?).

These examples are from the ByteWeight dataset using the file bap-dataset/pe-x86-64/binary/msvs_whatever_64_O2_vim.

Functions where end == start

The function bounds provided (ground truth) are:

@wideglide
wideglide / test_pymongo.py
Created November 23, 2021 23:16
pymongo tutorial
#!/usr/bin/env python3
from pprint import pprint
from pymongo import MongoClient
# Straight from the PyMongo Tutorial
# https://pymongo.readthedocs.io/en/stable/tutorial.html
## Connection parameters (default for FACT)
## need to change the host parameter
@wideglide
wideglide / shellcode_decrypt.asm
Created March 27, 2019 22:11
encryptor shellcode
;--------------------------------------------
; Name: Josh Bundt
; Class: IA6120
; Assignment 9
; File: decrypt_uuid.asm
; Last modified: 19 Mar 2019
;---------------------------------------------
; nasm -f bin decrypt_uuid.asm
@wideglide
wideglide / BinDiffExport.idc
Created March 26, 2019 01:31
BinDiff scripts
#include <idc.idc>
static main() {
Batch(0);
Wait();
RunPlugin("zynamics_binexport_9", 2);
Exit(0);
}
@wideglide
wideglide / raw_disk.vmdk
Created July 10, 2018 17:24
Use raw disk image as vmdk in VMWare Workstation / Player
version=1
encoding="UTF-8"
CID=fffffffe
parentCID=ffffffff
isNativeSnapshot="no"
createType="monolithicFlat"
RW 1 FLAT "cce4a5127f0ae2f86bd050a45badb85160597571.binary" 0
@wideglide
wideglide / solve.py
Created May 1, 2018 02:47
solve.py template
#!/usr/bin/env python
from pwn import *
import argparse
from struct import pack
# challenge specific
FILE = './syscaller'
SVR = 'chal1.swampctf.com'
PORT = 1800
@wideglide
wideglide / create_blank_ext2.md
Created April 4, 2018 15:26
Creating filesystems
  • Create 10MB file filled with NULL bytes
$ dd if=/dev/zero of=/tmp/blank_ext2.img bs=512 count=20480
20480+0 records in
20480+0 records out
10485760 bytes (10 MB, 10 MiB) copied, 0.132602 s, 79.1 MB/s
  • Create a EXT2 filesystem inside the blank file (default options).
@wideglide
wideglide / create_payload.py
Created April 1, 2018 04:15
Syscaller's Lament (swampctf-pwn)
from pwn import *
import sys
from struct import pack
# challenge specific
FILE = './syscaller'
SVR = 'chal1.swampctf.com'
PORT = 1800
# set up environ