Skip to content
CCint3 edited this page Nov 21, 2019 · 13 revisions

一些杂项

Windows注册表

{078759d3-423b-48ad-ab6a-5638c2884dbe}:删除后将无法重命名文件

ELF

Python 解析 ELF

pip install pyelftools

grep

-n 显示行号并高亮匹配

-i 忽略大小写

-r 递归方式搜索所有文件

-l 仅显示匹配到的文件名称

--include=FILE_PATTERN 只搜索匹配到FILE_PATTERN的文件;

FILE_PATTERN *.{smali,xml} 或 *.smali

sed

批量修改字符串

匹配当前目录及子目录下的所有常规文件,并将字符串de.robv.android.修改为空字符串

sed -i "s/de.robv.android.//g" `find -type f`

修改grep匹配到的文件

sed -i "s/de.robv.android.//g" `grep -rl "package .*;" .`

LLDB

列出可用的平台插件

(lldb) platform list

选择一个可用的平台插件

(lldb) platform select remote-android

连接到指定设备名称的指定端口上,该端口一定是lldb-server所监听的端口

(lldb) platform connect connect://0dfa1ebb43e6f28d:12345

设置lldb的工作目录

(lldb) platform settings -w /data/local/tmp

查看当前平台的状态:平台插件;系统架构;内核版本;主机名称;连接是否正常;工作目录

(lldb) platform status

指定一个对应平台的可执行文件的绝对路径,将上传这个可执行文件到工作目录中,接下来将会调试启动它。

(lldb) file "D:\TestSignal\app\src\main\cpp\signal_test"

指定一个断点,位于_start的第一行代码

(lldb) b _start

CERT.RSA 转 PEM

openssl pkcs7 -in cert.RSA -inform DER -print_certs -out cert.pem

Show so export symbol

查看 so 的导出符号:

objdump -T <xxx.so>

or

nm <xxx.so>

Un gcc name mangling

反命名粉碎:

c++filt <mangled names>

<<<<<<< Updated upstream

Fucking knack to resolve "UnicodeDecodeError" on python

解决 UnicodeDecodeError 的奇技淫巧:

"".join(map(chr, bytes_data))  # tested on python3

Use Unicorn java binding on WIndows

在 Windows 上使用 Java 版本的 Unicorn

  • Compile the library of "unicorn_java"

    1. Install Windows JDK, and make sure the path is compatible with Linux subsystem(like do not let spaces appear in the path), then append it to the "path" environment variable;

    2. Install Msys2, and install "make" with "pacman -S make", maybe you should install the development kit of gcc too, i'm not sure it's included in the Msys2 install package whether or;

    3. Download the whole Unicorn project from Github(https://minhaskamal.github.io/DownGit/#/home?url=https://github.com/unicorn-engine/unicorn);

    4. Open Msys2 bash(we will use "MSYS2 MinGW 64-bit" here) and change directories into the java bindings;

    5. Make it with execute "make" command, after the command finished, you will get a file named "unicorn_Unicorn.o" on "unicorn_project_root\bindings\java" and an error message of "xxx/bin/ld.exe: cannot find -lunicorn";

    6. Download Unicorn Core Engine from official website(https://github.com/unicorn-engine/unicorn/releases/download/1.0.1/unicorn-1.0.1-win64.zip), and decompress it, make sure you can access the "unicorn.dll", assum it's under the "D:\unicorn-1.0.1-win64";

    7. Fix the Gcc error on step 5(Do this on Msys2 bash);

      gcc -o libunicorn_java.dll -shared -fPIC unicorn_Unicorn.o -L../../ -lunicorn -L "D:/unicorn-1.0.1-win64"

      Then you will get the "libunicorn_java.dll" file.

  • Use it on Java project

    1. Rename "libunicorn_java.dll" to "unicorn_java.dll", copy it and "unicorn.dll" to your Java project root directory, copy "unicorn_project_root\bindings\java\unicorn" directory to your project source path;
    2. Enjoy it(Remember that "Unicorn" provided sample codes for you).

在 Linux 上使用 Java 版本的 Unicorn

  • 不要使用 Unicorn Github 上指定的 "sudo ./make.sh install" 来编译安装 Unicorn,而是直接 make,然后 make install;
  • 在 Ubuntu x64 上链接 Java 库时失败,提示找不到实现,然而那些方法是可以在 libunicorn.so 中找到导出的,原因未知;
  • 在 CentOs x64 上测试成功。

Let Ida use python2 on Anaconda

让 Ida 使用 Anaconda 中的 python2 环境

Because Ida will use some Environment Variables, so if you installed python2(on Anaconda) and python3 both, and the "python about" Environment is not python2 that Ida can recognize, then you will fuck up, you will not able to use python on Ida.

Use below batch to set temporary Environment Variables:

SET Anaconda2_PATH=C:\ProgramData\Anaconda2
SET PYTHONHOME=%Anaconda2_PATH%
SET PATH=%PYTHONHOME%;%PYTHONHOME%\Lib
:: or .\ida64.exe
START .\ida.exe %*

=======

Base64 Url Safe

Encoder/decoder flag bit to indicate using the "URL and filename safe" variant of Base64 (see RFC 3548 section 4) where - and _ are used in place of + and /.

Stashed changes

Focus Make Things

Clone this wiki locally