> l0x1c@blog:~/posts

A Friendly Introduction to Number Theory 学习笔记

Chapter 1 What is number theory Number theory is the study of the set of positive whole numbers, which is often called the set of natural numbers. We know natural numbers have different types: odd, even, square, cube, prime ( 质数 ), composite ( 合数 ), x mod y, triangular, perfect, fibonacci. The main goal of number theory is to discover interesting and unexpected relationships between different sorts of numbers and to prove that these relatinships are true. ...

July 2, 2026 · 7 min · L0x1c

App流量安全与协议逆向

Lec 0: 现代流量安全基石

December 16, 2025 · 1 min · L0x1c

Stanford CS106L Note (上)

主要的笔记内容针对于C++相关的内容,主要针对的课程为Stanford CS106L (2020)的笔记,主要为后面的xv6写的前置笔记知识 Lecture 1: Streams I Streams 主要的作用就是:外部设备 ↔ (字符缓冲区)stream ↔ 你的变量(double、int、struct) stringstream std::istringstream: 输入字符串流(从string 中按类型提取) std::ostringstream: 输出字符串流(往里面放入各种类型,得到string类型) std::stringstream: 既能读又能写 #include <iostream> #include <sstream> int main() { // “16.9 Ounces”, pos at front std::istringstream iss("16.9 Ounces"); double value; std::string unit; iss >> value >> unit; std::cout << "Value: " << value << ", Unit: " << unit << std::endl; return 0; } // Value: 16.9, Unit: Ounces 上面的例子可以看到输入字符串流中的iss -> 16.9 Ounces后面根据类型进行分类,因为中间遇见了空格进行了两个位置进行分割 // “Ito En Green Tea ”, pos at front std::ostringstream oss("Ito En Green Tea "); oss << 16.9 << " Ounce"; std::cout << oss.str() << std::endl; // 16.9 Ounceen Tea 上面的例子中的输出字符串流,指针进行因为是在字符串的最开始的位置开始的,所以内容会进行覆盖,这里就和PPT中的一个位置是一样的 ...

November 30, 2025 · 10 min · L0x1c

dy a_bogus参数 逆向分析

关于dy的a_bogus逆向,jsvmp 进行抖音抓包,对应的位置在 url = "https://www.douyin.com/aweme/v1/web/aweme/post/" 可以看一下调用栈,不难发现主要的逻辑在bdms_1.0.1.19_fix.js 直接跳过去可以看到d就是指令操作 先一点一点的去看 这个位置调用了atob,代表了对下面的那个字符进行了base64的解密,随后取第 4~7 字节求和得到单字节 key 再用自定义 map 函数 _ 对余下字节逐个异或,最后把结果送进自带的 DEFLATE 解压器,从而得到可执行的数据块,这里可以很好的看出来这一块是一个压缩文件的格式,对应base64的UEsC import base64, zlib, re, hashlib, os, sys from pathlib import Path BASE64_DATA = r""" """.strip() # ============================================== def sanitize_b64(s: str) -> str: return re.sub(r'[^A-Za-z0-9+/=]', '', s) def xor_transform(decoded: bytes) -> tuple[bytes, int, int]: key_sum = sum(decoded[4:8]) & 0xFFFFFFFF km = key_sum % 256 step = km % 10 tail = decoded[8:] out = bytearray(len(tail)) for i, b in enumerate(tail): out[i] = (b ^ ((km + step * i) % 256)) & 0xFF return bytes(out), key_sum, km def inflate_raw(data: bytes) -> bytes: return zlib.decompress(data, -15) def main(): b64 = sanitize_b64(BASE64_DATA) raw = base64.b64decode(b64) mapped = xor_transform(raw) payload = inflate_raw(mapped) out_path = Path(os.getcwd()) / "payload.bin" out_path.write_bytes(payload) if __name__ == "__main__": main() 可以和dump的东西进行对应上 function W(t) { for (var r = 0, e = 0; ; ) { var n = t.d[t.i++]; if (r |= (127 & n) << e, e += 7, !(128 & n)) return e < 32 && 64 & n ? r | -1 << e : r } } 最开始的e9 07 ...

November 15, 2025 · 22 min · L0x1c

unluac xxx_app 分析

这个是工作中遇见的一个app,需要分析一下app对于应用列表检测感知这个问题 对应的样本的网址:https://github.com/TMLP-Team/TMLP-Detectors-and-Bypassers/blob/main/Detectors/%E5%87%8C%E5%8D%BF%E6%A3%80%E6%B5%8B_v1.6_fix.apk 直接拖进jeb看一下 调用lua,看一下lingqing.bin Lua 介绍 C 语言和 Lua 的交互是通过 lua_State来实现的,所以首先需要创建一个 lua_State 把 Lua 脚本加载进 Lua 虚拟机, Lua 提供了三个常用的函数 LUALIB_API int (luaL_loadfilex) (lua_State *L, const char *filename, const char *mode); #define luaL_loadfile(L,f) luaL_loadfilex(L,f,NULL) LUALIB_API int (luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz, const char *name, const char *mode); LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s); 这三个函数最后走的都是 lua_load 函数,把经过编译后的代码放到了栈顶,执行加载到栈顶的 Lua 代码,上面的函数只是将程序加载到了栈顶,执行了之后才能变成虚拟机中的函数或者变量,因为在栈顶也没有需要传入的参数,所以只需要调用 lua_pcall 即可 LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc, lua_KContext ctx, lua_KFunction k) 上面的常用的函数有对应的执行合并参数 lua 加载执行流程 luaL_loadbufferx来直接看 LUALIB_API int luaL_loadbufferx (lua_State *L, const char *buff, size_t size, const char *name, const char *mode) { LoadS ls; ls.s = buff; ls.size = size; return lua_load(L, getS, &ls, name, mode); } 调用lua_load LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data, const char *chunkname, const char *mode) { ZIO z; int status; lua_lock(L); if (!chunkname) chunkname = "?"; luaZ_init(L, &z, reader, data); status = luaD_protectedparser(L, &z, chunkname, mode); if (status == LUA_OK) { /* no errors? */ LClosure *f = clLvalue(L->top - 1); /* get newly created function */ if (f->nupvalues >= 1) { /* does it have an upvalue? */ /* get global table from registry */ Table *reg = hvalue(&G(L)->l_registry); const TValue *gt = luaH_getint(reg, LUA_RIDX_GLOBALS); /* set global table as 1st upvalue of 'f' (may be LUA_ENV) */ setobj(L, f->upvals[0]->v, gt); luaC_upvalbarrier(L, f->upvals[0]); } } lua_unlock(L); return status; } luaD_protectedparser ...

November 6, 2025 · 9 min · L0x1c
l0x1c@blog | ~/posts
hugo v0.152.2 |