Skip to content

Instantly share code, notes, and snippets.

@Jinmo
Jinmo / _.md
Last active March 5, 2024 21:13
C/C++ header to IDA

Usage

In IDAPython,

execfile('<path>/cxxparser.py')
parse_file('<path>/a.cpp',[r'-I<path>\LuaJIT-2.0.5\src', '-D__NT__', '-D__X64__', '-D__EA64__'])
parse_file('<path>/malloc.c',['-target=x86_64-linux-gnu'])
@Jinmo
Jinmo / jni_all.h
Created May 26, 2017 07:36
Useful when reversing JNI on IDA Pro
/*
* Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
@Jinmo
Jinmo / ida_stdin.py
Last active March 18, 2023 02:44
IDA Pro stdin readline support
import idaapi
from Queue import Queue
from PyQt5.QtCore import QCoreApplication
from PyQt5.QtWidgets import qApp, QMainWindow, QWidget, QLineEdit
def _query(window, predicate):
results = []
@Jinmo
Jinmo / apple-script.yaml
Created June 1, 2020 21:43
kaitai struct for AppleScript file
meta:
id: apple_script
file-extension: scpt
application: AppleScript files
endian: be
ks-opaque-types: true
seq:
- id: magic
size: 4
@Jinmo
Jinmo / 1.diff
Created May 10, 2020 07:28
pwntools windows; at least remote() works
diff --git "a/pwnlib/context/__init__.py" "b/pwnlib/context/__init__.py"
index 6d43994..e813de6 100644
--- "a/pwnlib/context/__init__.py"
+++ "b/pwnlib/context/__init__.py"
@@ -26,6 +26,8 @@ import socks
from pwnlib.config import register_config
from pwnlib.device import Device
from pwnlib.timeout import Timeout
+import colorama
+colorama.init()
/*
first malloc(16) : 0x1a61450
eh.. and malloc(-1) : (nil)
second malloc(16) : 0x7fe57c0008c0
FYI, libc.so address is : 0x7fe5837dc000
let's calculate! : 0x7fe580000000
*/
#include <stdio.h>
#include <stdlib.h>
from pwn import *
import struct
def flatten(input_array):
result_array = []
for element in input_array:
if isinstance(element, list):
result_array += flatten(element)
else:
result_array.append(element)
import requests
sess=requests.Session()
HOST,PORT='10.13.37.8',8888
# overflow_len: http://
# overflow_payload <- suffix
append=u'a\u3fff'.encode('utf8')
append=bytes(append)
@Jinmo
Jinmo / .py
Created August 13, 2019 21:53
import pprint
yy_meta = [0x00, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x02, 0x03, 0x01, 0x01, 0x03, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
yy_accept = [0x0000, 0x0000, 0x0000, 0x001C, 0x001A, 0x0018, 0x0018, 0x001A, 0x000E, 0x000F, 0x0015, 0x0013, 0x0017, 0x0014, 0x0019, 0x0016, 0x0012, 0x000D, 0x000D, 0x000D, 0x000D, 0x000D, 0x000D, 0x000D, 0x000D, 0x000D, 0x0010, 0x0011, 0x000C, 0x0000, 0x0019, 0x000D, 0x000D, 0x000D, 0x000D, 0x000D, 0x000D, 0x000D, 0x000D,
0x000D, 0x000D, 0x000B, 0x000D, 0x0003, 0x000D, 0x000D, 0x0006, 0x000D, 0x000D, 0x000D, 0x000D, 0x000D, 0x0001, 0x0004, 0x000D, 0x0002, 0x000D, 0x0005, 0x000D, 0x000A, 0x000D, 0x000D, 0x0008, 0x000D, 0x0000, 0x0009, 0x0000, 0x0000, 0x0000, 0x0007, 0x0000, 0x0000, 0x0001, 0x000
@Jinmo
Jinmo / remote
Last active August 3, 2019 16:47
scripts
#!/bin/bash
# ./remote server port 'menu string'
touch "$1" || (echo "Cannot create file named $1" && exit 1)
exec > "$1"
echo 'from pwn import *'
echo ''
echo -e "HOST, PORT = \"$2\", \"$3\""
if [ ! -n "$HOST" ]; then HOST=0.0.0.0; fi