Skip to content

Instantly share code, notes, and snippets.

@adamvr
adamvr / extract-uimage.sh
Created July 13, 2011 05:20
Script for extracting a uimage
#!/bin/sh
#
# Copyright (C) 2010 Matthias Buecher (http://www.maddes.net/)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# http://www.gnu.org/licenses/gpl-2.0.txt
@zonque
zonque / xymodem-mini.c
Last active February 27, 2024 06:31
simple xmodem/ymodem implementation in C
/*
* Minimalistic implementation of the XModem/YModem protocol suite, including
* a compact version of an CRC16 algorithm. The code is just enough to upload
* an image to an MCU that bootstraps itself over an UART.
*
* Copyright (c) 2014 Daniel Mack <github@zonque.org>
*
* License: MIT
*/
@FedericoPonzi
FedericoPonzi / socket_portable.c
Last active March 8, 2024 01:36
C sockets portable in windows/linux example
// As seen on http://www.di.uniba.it/~reti/LabProRete/Interazione(TCP)Client-Server_Portabile.pdf
#if defined WIN32
#include <winsock.h>
#else
#define closesocket close
#include <sys/socket.h>
#include <arpa/inet.h>
#include <unistd.h>
#endif
#include <stdio.h>
@MaximAlien
MaximAlien / ClassName
Created April 22, 2015 09:19
[Android] [JNI] Method to get class name as std::string
static std::string getClassName(JNIEnv *env, jobject entity, jclass clazz)
{
jmethodID mid = env->GetMethodID(clazz, "getClass", "()Ljava/lang/Class;");
jobject clsObj = env->CallObjectMethod(entity, mid);
jclass clazzz = env->GetObjectClass(clsObj);
mid = env->GetMethodID(clazzz, "getName", "()Ljava/lang/String;");
jstring strObj = (jstring)env->CallObjectMethod(clsObj, mid);
const char* str = env->GetStringUTFChars(strObj, NULL);
std::string res(str);
@naveensrinivasan
naveensrinivasan / generatepdb
Created May 20, 2015 15:36
Generate PDB's from the assembly using NGEN
C:\windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe createpdb "C:\windows\assembly\NativeImages_v4.0.30319_32\System.Security\16f61697a0
61d2fc1afd3f3073089be8\System.Security.ni.dll" "C:\temp"
@linktohack
linktohack / index.php
Created June 20, 2016 07:20
Adminer 4.2.5 loader without password for SQLite
<?php
function adminer_object() {
class AdminerSoftware extends Adminer {
function login($login, $password) {
return true;
}
}
return new AdminerSoftware;
}
include "./adminer-4.2.5.php";
@NaxAlpha
NaxAlpha / HookFx.cs
Last active December 2, 2023 09:08
Windows API Hook with C#
using System;
using System.Runtime.InteropServices;
public class FxHook:IDisposable {
const int nBytes = 5;
IntPtr addr;
Protection old;
byte[] src = new byte[5];
@shicky
shicky / ld_preload_hook.c
Last active June 27, 2024 12:25
LD_PRELOAD linux function hook example
# helloworld.c
# gcc helloworld.c -o helloworld
#include <stdio.h>
#include <unistd.h>
int main() {
puts("Hello world!\n");
return 0;
}
@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.
*
@apsun
apsun / hax.c
Last active April 22, 2024 05:49
Hook main() using LD_PRELOAD
/*
* Hook main() using LD_PRELOAD, because why not?
* Obviously, this code is not portable. Use at your own risk.
*
* Compile using 'gcc hax.c -o hax.so -fPIC -shared -ldl'
* Then run your program as 'LD_PRELOAD=$PWD/hax.so ./a.out'
*/
#define _GNU_SOURCE
#include <stdio.h>