Skip to content

Instantly share code, notes, and snippets.

@0x410c
0x410c / jni_all.h
Created April 19, 2023 12:01 — forked from Jinmo/jni_all.h
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.
*

ELF

ELF Header

The first portion of any ELF file is the ELF header. This generally provides offsets to other headers (program headers and section headers) within an ELF.

typedef struct {
  unsigned char e_ident[EI_NIDENT];
 uint16_t e_type;
#pragma once
// This allows windows.h to be included first, overriding this header file, but be careful
// not to do this everywhere as compile-times suffer.
#ifndef _WINDOWS_
#define _WIN32_WINNT 0x0601 // _WIN32_WINNT_WIN7
@0x410c
0x410c / chaiwinapi.cpp
Created March 31, 2022 07:38
Call winapis from chai script
#include <string>
#include<vector>
#include <chaiscript/chaiscript.hpp>
#include<windows.h>
unsigned int proxy_LoadLibraryA(unsigned int libName)
{
return (unsigned int)LoadLibraryA((char*)libName);
}
@0x410c
0x410c / hardwareID
Created July 24, 2017 05:44
generating hardware id on windows systems, c++ 54-7-2017
// generating hardware id on windows systems, c++ 54-7-2017
std::string getHDDSerial()
{
DWORD disk_serialINT;
GetVolumeInformationA(NULL, NULL, NULL, &disk_serialINT, NULL, NULL, NULL, NULL);
return std::to_string(disk_serialINT);
}
std::string getMac()
{