Skip to content

Instantly share code, notes, and snippets.

@lpcdma
lpcdma / getcert.sh
Created May 1, 2017 13:29
获得证书用于java程序连接
HOST=myhost.example.com
PORT=443
KEYSTOREFILE=dest_keystore
KEYSTOREPASS=changeme
# get the SSL certificate
openssl s_client -connect ${HOST}:${PORT} </dev/null \
| sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ${HOST}.cert
# create a keystore and import certificate
@lpcdma
lpcdma / fix_python_win32.cpp
Last active November 11, 2017 14:33
fix_python_win32.cpp
_PyVerify_fd(int fd)
{
// const int i1 = fd >> IOINFO_L2E;
// const int i2 = fd & ((1 << IOINFO_L2E) - 1);
// static int sizeof_ioinfo = 0;
// /* Determine the actual size of the ioinfo structure,
// * as used by the CRT loaded in memory
// */
#!/bin/bash
DATESTR=`date +%Y%m%d`
rm -f stdout.log.$DATESTR
mv stdout.log stdout.log.$DATESTR
#tail -f stdout.log
java -Xms128m -classpath Server.jar Main 2 8081 $@>> stdout.log 2>&1 &
abootimg -u /home/john/Desktop/boot.img -k zImage-dtb -c 'cmdline = console=ttyHSL0,115200,n8 androidboot.hardware=hammerhead user_debug=31 msm_watchdog_v2.enable=1 kgdbwait kgdboc=ttyHSL0,115200 kgdbretry=4'
abootimg -i twrp-3.1.0-0-plank.img
abootimg -x twrp-3.1.0-0-plank.img
sudo update-alternatives --install "/usr/bin/java" "java" \
"/opt/jdk1.6.0_45/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" \
"/opt/jdk1.6.0_45/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" \
"/opt/jdk1.6.0_45/bin/javaws" 1
@lpcdma
lpcdma / MemoryDump.py
Created April 23, 2018 02:49
memory dump plugin for ida pro 7.0 7.1 hot_key:"alt+D"
# -*- coding: UTF-8 -*-
import idaapi
class MemoryDumpForm(idaapi.Form):
"""Simple Form to test and combo box controls"""
def __init__(self):
idaapi.Form.__init__(self, r"""STARTITEM 0
MemoryDump
{FormChangeCb}
@lpcdma
lpcdma / ByteArray.lua
Created August 23, 2018 10:08
lua5_3_ByteArray
--[[
Serialzation bytes stream like ActionScript flash.utils.ByteArray.
It depends on lpack.
A sample: https://github.com/zrong/lua#ByteArray
@see http://underpop.free.fr/l/lua/lpack/
@see http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/utils/ByteArray.html
@author zrong(zengrong.net)
Creation 2013-11-14
@lpcdma
lpcdma / imei.lua
Created August 24, 2018 05:00
lua genimei function
function serialize(obj)
local lua = ""
local t = type(obj)
if t == "number" then
lua = lua .. obj
elseif t == "boolean" then
lua = lua .. tostring(obj)
elseif t == "string" then
lua = lua .. string.format("%q", obj)
@lpcdma
lpcdma / base.cpp
Last active September 9, 2019 12:08
libhoudini.so load arm so api
static jobject getApplication(JNIEnv *env) {
jobject application = NULL;
jclass activity_thread_clz = env->FindClass("android/app/ActivityThread");
if (activity_thread_clz != NULL) {
jmethodID currentApplication = env->GetStaticMethodID(
activity_thread_clz, "currentApplication", "()Landroid/app/Application;");
if (currentApplication != NULL) {
application = env->CallStaticObjectMethod(activity_thread_clz, currentApplication);
}
env->DeleteLocalRef(activity_thread_clz);
@lpcdma
lpcdma / launch.json
Created November 6, 2019 06:46
codelldb android
{
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "attach",
"name": "android_attach",
"pid": "13841",
"initCommands": [
"platform select remote-android",