工具
Git
# 压缩两个提交
git rebase --interactive HEAD~2
# 将
# pick c6d7bf6 fix namespace bug
# pick 1c648d8 fix namespace bug
# pick 7c648d8 fix namespace bug
# 改为
# pick c6d7bf6 fix namespace bug
# s 1c648d8 fix namespace bug
# s 7c648d8 fix namespace bug
# 压缩所有提交
git rebase --interactive -root
# 更新所有submodule
# 首次运行
git submodule update --init --recursive
# 之后运行
git submodule foreach --recursive git pull origin master -f
Clion-将Windows换行转换为Linux模式
how-do-i-force-git-to-use-lf-instead-of-crlf-under-windows
git config --global core.eol lf
git config --global core.autocrlf input
git rm -rf --cached .
git reset --hard HEAD
VIM&zsh设置
VIM
set expandtab
set ts=4
set shiftwidth=4
set sts=4
set tw=100
set number
set cinoptions=:0,g0,(0,w1
set backspace=indent,eol,start
" set smartindent
set autoindent
set cindent
set softtabstop=4
set tabstop=4
set enc=utf-8
set nocompatible
syntax on
set fileencodings=ucs-bom,utf-8,gb18030,latin1
set nobackup
set undofile
set undodir=~/.vim/undodir
if !isdirectory(&undodir)
call mkdir(&undodir, 'p', 0700)
endif
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
endif
set pastetoggle=<F2>
ZSH
plugins=(git zsh-autosuggestions zsh-syntax-highlighting autojump)
Make设置install指定文件
make install <name>
for-cmakes-install-command-what-can-the-component-argument-do
install(TARGETS main RUNTIME DESTINATION ./install_dir/ COMPONENT main)
add_custom_target(install_main COMMAND ${CMAKE_COMMAND} -DCOMPONENT=main -P ${CMAKE_BINARY_DIR}/cmake_install.cmake)
lsof iftop
# lsof
lsof -i tcp:10002 -P
-P 不解析端口号,直接显示
# iftop
-P 显示端口号
-N 不解析端口号
l 输入fileter,可以直接输入ip
安卓adb抓包
adb connect 127.0.0.1:port # (连接指定机器)
adb devices # (列出所有设备)
adb shell # (进入机器中 打开shell)
adb push tcpdump /sdcard/... # (推送文件)
adb pull /sdcard/1.pcap . # (拉取文件到本地)
# wireshark左下角的灯是可以点的,可以列出来可疑项目
抓取https(没有成功, 也还是记录一下)
# https://github.com/frida/frida/releases 下载frida-server 注意要到非sdcard目录 否则不会给运行权限
# adb后运行
./frida-server
# pip3 install frida-tools
# 这条会自动启动目标app 所以tcpdump要提前准备好
# 将产出的秘钥保存起来, Wireshark-Protocol-TLS 最下方加载
frida -U -f jp.ne.paypay.android.app -l .\1.js
// 1.js
function startTLSKeyLogger(SSL_CTX_new, SSL_CTX_set_keylog_callback) {
console.log("start----")
function keyLogger(ssl, line) {
console.log(new NativePointer(line).readCString());
}
const keyLogCallback = new NativeCallback(keyLogger, 'void', ['pointer', 'pointer']);
Interceptor.attach(SSL_CTX_new, {
onLeave: function(retval) {
const ssl = new NativePointer(retval);
const SSL_CTX_set_keylog_callbackFn = new NativeFunction(SSL_CTX_set_keylog_callback, 'void', ['pointer', 'pointer']);
SSL_CTX_set_keylog_callbackFn(ssl, keyLogCallback);
}
});
}
startTLSKeyLogger(
Module.findExportByName('libssl.so', 'SSL_CTX_new'),
Module.findExportByName('libssl.so', 'SSL_CTX_set_keylog_callback')
)
安装Prometheus
docker run -d -p 9090:9090 -v /data/prometheus/prometheus.yml:/data/prometheus/prometheus.yml -v /data/prometheus:/data/prometheus --user root --name prometheus prom/prometheus --config.file=/data/prometheus/prometheus.yml --storage.tsdb.path=/data/prometheus
火焰图生成
# -g enables call-graph recording -p pid
perf record -F 99 -g -p 28470
perf script > perf.unfold
git clone https://github.com/brendangregg/FlameGraph.git
./stackcollapse-perf.pl perf.unfold > perf.fold
./flamegraph.pl perf.fold > perf.svg
文件大小分析
objdump -dwarf=info XXXServer > XXXServer.info
readelf -e XXXServer
# cmake选项
-femit-struct-debug-baseonly