Skip to content

Instantly share code, notes, and snippets.

View tesuji's full-sized avatar
🦀
...

tesuji

🦀
...
  • D28DBB1A0E26FEDA
View GitHub Profile
@tesuji
tesuji / test1.py
Last active August 13, 2018 04:22
Python tutorial code for unicorn
#!/usr/bin/python
from unicorn import *
from unicorn.x86_const import *
# code to be emulated
X86_CODE32 = b"\x41\x4a" # INC ecx; DEC edx
# memory address where emulation starts
ADDRESS = 0x1000000
@tesuji
tesuji / README-Template.md
Created August 18, 2018 15:30 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

┌ (fcn) sym.check 127
│ sym.check (char *s, int arg_ch);
│ ; var char *local_dh @ ebp-0xd
│ ; var unsigned int local_ch @ ebp-0xc
│ ; var unsigned int local_8h @ ebp-0x8
│ ; var int local_4h @ ebp-0x4
│ ; arg char *s @ ebp+0x8
│ ; arg int arg_ch @ ebp+0xc
│ ; var char *format @ esp+0x4
│ ; var int local_8h_2 @ esp+0x8
build/
    meson/
        liba/
            meson.build
        libb/
            meson.build
        meson.build
src/
    liba/

libb/

With rustgdb:

(gdb) x/75i drop::main 
   0x7d90 <drop::main>:	sub    rsp,0xa8
   0x7d97 <drop::main+7>:	lea    rax,[rip+0x4bc0a]        # 0x539a8
   0x7d9e <drop::main+14>:	mov    ecx,0x8
   0x7da3 <drop::main+19>:	mov    edx,ecx
   0x7da5 <drop::main+21>:	lea    rdi,[rsp+0x18]
   0x7daa <drop::main+26>:	mov    rsi,rax
   0x7dad <drop::main+29>:	call   0xa760 <<alloc::string::String as core::convert::From<&'a str>>::from>
@tesuji
tesuji / build-clang.sh
Last active August 31, 2020 05:47
Install clang-10
#!/usr/bin/env bash
set -ex
MY_PREFIX="${DEFAULT_PREFIX:-${HOME}/.local}"
LLVM_TAG=llvmorg-10.0.1
mkdir llvm-project && cd $_
curl -L "https://github.com/llvm/llvm-project/archive/${LLVM_TAG}.tar.gz" \
<!DOCTYPE html>
<html>
<head>
<title>Testing TOML syntax highlighting</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<link href="prism.css" rel="stylesheet" />
<script src="prism.js"></script>
@tesuji
tesuji / shellcode.md
Last active May 31, 2019 13:51
Shellcoding for Linux and Windows Tutorial
title Shellcoding for Linux and Windows Tutorial
description Shellcoding for Linux and Windows Tutorial with example windows and linux shellcode
source http://www.vividmachines.com/shellcode/shellcode.html

Shellcoding for Linux and Windows Tutorial

Table of Contents

% git status -s
## tidy-lldb...origin/tidy-lldb
% CARGO_LOG=cargo::core::compiler::fingerprint=info ./x.py test --stage 1 src/test/ui
Updating only changed submodules
Submodules updated in 0.06 seconds
Finished dev [unoptimized] target(s) in 0.23s
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Finished release [optimized] target(s) in 0.27s
Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building stage0 test artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
use std::env;
use std::mem::size_of;
const SIZE_SZ: usize = size_of::<usize>();
#[repr(C)]
struct malloc_chunk {
mchunk_prev_size: usize, /* Size of previous chunk (if free). */
mchunk_size: usize, /* Size in bytes, including overhead. */
fd: *mut malloc_chunk, /* double links -- used only if free. */