Skip to content

Instantly share code, notes, and snippets.

View zhangkn's full-sized avatar
❣️
https://kunnan.blog.csdn.net/

公众号:iOS逆向 zhangkn

❣️
https://kunnan.blog.csdn.net/
View GitHub Profile
@zhangkn
zhangkn / fixheader.sh
Created November 27, 2017 06:13 — forked from ChiChou/fixheader.sh
fix header generated from class-dump
#!/bin/bash
#
# NOTE: You need to `brew install gnu-sed` on Mac
#
# by @codecolorist
# http://github.com/chichou
#
# fix some compilation error of headers generated by class-dump
#
# usage: fixheader.sh DIRECTORY
'''
Break on Objective-C 's method using its address'
'''
import shlex
import lldb
import re
def breakonmethod(debugger, command, exe_ctx,result, internal_dict):
args=shlex.split(command)
Class=args[0]
Method=args[1]
var CryptoJS = require('crypto-js')
var request = require('request-promise')
/*
* npm install crypto-js request-promise request
* node wx_t1t_hack.js
*/
// export function testEncription(msg, fullKey) {
// var fullKey = fullKey.slice(0, 16)
@zhangkn
zhangkn / unwxapkg.py
Created January 5, 2018 02:50 — forked from feix/unwxapkg.py
#!/usr/bin/env python2
# lrdcq
# usage python2 unwxapkg.py filename
import sys, os
import struct
class WxapkgFile(object):
nameLen = 0
@zhangkn
zhangkn / lldb_cheat_sheet.md
Created January 11, 2018 10:03 — forked from ryanchang/lldb_cheat_sheet.md
LLDB Cheat Sheet

LLDB Cheat Sheet

A complete gdb to lldb command map.

Print out

  • Print object
(lldb) po responseObject
(lldb) po [responseObject objectForKey@"state"]
  • p - Print primitive type

Assume LLVM Source tree is located at ../LLVM
The -DLLVM_CREATE_XCODE_TOOLCHAIN=on is only useful for macOS users that requires an Xcode Toolchain to use within Xcode. This enables an extra target called install-xcode-toolchain.
Add -DCMAKE_INSTALL_PREFIX=~/Library/Developer/ installs the Toolchain for the current user.
To install the toolchain globally, replace with -DCMAKE_INSTALL_PREFIX=/Library/Developer/ and invoke sudo ninja install-xcode-toolchain

LLVM Development:

cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -DLLVM_APPEND_VC_REV=on -DLLVM_CREATE_XCODE_TOOLCHAIN=on -DCMAKE_INSTALL_PREFIX=~/Library/Developer/ ../LLVM

Daily Usage

UIWebClip *clip = [UIWebClip webClipWithIdentifier:nil];
//UIWebClip *clip = [UIWebClip webClipWithURL:[webpage.request.mainDocumentURL absoluteString]];
[clip retain];
[clip setPageURL:webpage.request.mainDocumentURL];
[clip setTitle:[webpage stringByEvaluatingJavaScriptFromString:@"document.title"]];
UIWebDocumentView *docView = nil;
UIScrollView *webpagescroller = [[webpage subviews] objectAtIndex:0];
for (UIView* aView in [webpagescroller subviews]){
if ([aView isKindOfClass:[NSClassFromString(@"UIWebBrowserView") class]]){
docView = (UIWebDocumentView *)aView;
@zhangkn
zhangkn / confuse.sh
Last active January 5, 2019 06:30
简易的混淆脚本,主要思路是把敏感方法名集中写在一个名叫func.list的文件中,逐一#define成随机字符,追加写入.h。------痛点就是一个一个手写
#!/usr/bin/env bash
TABLENAME=symbols
SYMBOL_DB_FILE="symbols"
STRING_SYMBOL_FILE="func.list"
HEAD_FILE="$PROJECT_DIR/$PROJECT_NAME/codeObfuscation.h"
export LC_CTYPE=C
#维护数据库方便日后作排重
createTable()
@zhangkn
zhangkn / dataWithScreenshotInPNGFormat.m
Created April 25, 2018 11:21
如果自己的控制器需要展示主端唤起静态库时的页面当中背景,可以采用代码截图当背景即可
/**
* 返回截取到的图片
*
* @return UIImage *
*/
- (UIImage *)imageWithScreenshot
{
NSData *imageData = [self dataWithScreenshotInPNGFormat];
return [UIImage imageWithData:imageData];
}
@zhangkn
zhangkn / CFBundleShortVersionString.m
Created April 25, 2018 11:25
/获取这个版本的的应用场景:为了区分这个静态库是第三方集成版本,还是自家app的独立版本
#define MYBUNDLE_NAME @"hecardpackNFCBundle.bundle"
#define MYBUNDLE_PATH [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent: MYBUNDLE_NAME]
#define MYBUNDLE [NSBundle bundleWithPath: MYBUNDLE_PATH]
+ (NSString*)appVersionCode{
//获取的版本号
// NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
//取KNStaticBundle.bundle 的版本号与独立版本的版本号保存一致
NSDictionary *infoDictionary = [MYBUNDLE infoDictionary];
NSString *appVersionCode = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
if (appVersionCode.length > 0) {