This commit is contained in:
firmianay 2017-07-19 00:05:44 +08:00
parent 8275a9dd84
commit 0fa315ef1a
22 changed files with 109 additions and 17 deletions

View File

@ -2,7 +2,7 @@
- [一、基础知识篇](doc/1_basic.md)
- [1.1 ctf 介绍](doc/1.1_ctf.md)
- [1.2 打造虚拟机](doc/1.2_vm.md)
- [1.2]
- [1.3 Linux基础](doc/1.3_linux_basic.md)
- [1.4 Web 安全基础](doc/1.4_web_basic.md)
- [1.5 逆向工程基础](doc/1.5_reverse_basic.md)
@ -12,14 +12,20 @@
- [1.5.4 Windows PE](doc/1.5.4_pe.md)
- [1.5.5 静态链接](doc/1.5.5_static_link.md)
- [1.5.6 动态链接](doc/1.5.6_dynamic_link.md)
- [1.5.7 内存与虚拟内存](doc/1.5.7_memory.md)
- [1.6 密码学基础](doc/1.6_crypto_basic.md)
- [1.7 Android安全基础](doc/1.7_android_basic.md)
- [二、工具篇](doc/2_tools.md)
- [2.1 gdb/peda](doc/2.1gdb&peda.md)
- [2.2 ollydbg](doc/2.2_ollydbg.md)
- [2.3 windbg](doc/2.3_windbg.md)
- [2.4 radare2](doc/2.4_radare2.md)
- [2.5 IDA Pro](doc/2.5_idapro.md)
- [2.6 pwntools](doc/2.6_pwntools.md)
- [2.1 VM](doc/2.1_vm.md)
- [2.1 gdb/peda](doc/2.2_gdb&peda.md)
- [2.2 ollydbg](doc/2.3_ollydbg.md)
- [2.3 windbg](doc/2.4_windbg.md)
- [2.4 radare2](doc/2.5_radare2.md)
- [2.5 IDA Pro](doc/2.6_idapro.md)
- [2.6 pwntools](doc/2.7_pwntools.md)
- [2.8 zio](doc/2.8_zio.md)
- [2.9 metasploit](doc/2.9_metasploit.md)
- [三、分类专题篇](doc/3_topics.md)
- [3.1 Reverse](doc/3.1_reverse.md)
@ -32,6 +38,7 @@
- [四、技巧篇](doc/4_tips.md)
- [五、高级篇](doc/5_advanced.md)
- [5.1 Fuzz 测试](doc/5.1_fuzz.md)
- [六、附录](doc/6_appendix.md)
- [6.1 更多 Linux 工具](doc/6.1_Linuxtools.md)

View File

@ -1,6 +1,9 @@
# Linux 基础
## 常用基础命令
- [常用基础命令](#command)
- [字节序](#order)
## <span id="command">常用基础命令</span>
```text
ls 用来显示目标列表
@ -27,3 +30,17 @@ nano / vim / emacs 字符终端的文本编辑器
```text
管道命令符 "|" 将一个命令的标准输出作为另一个命令的标准输入
```
## <span id="order">字节序</span>
目前计算机中采用两种字节存储机制大端Big-endian和小端Little-endian
>MSB (Most Significan Bit/Byte):最重要的位或最重要的字节。
>
>LSB (Least Significan Bit/Byte):最不重要的位或最不重要的字节。
Big-endian 规定 MSB 在存储时放在低地址在传输时放在流的开始LSB 存储时放在高地址在传输时放在流的末尾。Little-endian 则相反。常见的 Intel 处理器使用 Little-endian而 PowerPC 系列处理器则使用 Big-endian另外 TCP/IP 协议和 Java 虚拟机的字节序也是 Big-endian。
例如十六进制整数 0x12345678 存入以 1000H 开始的内存中:
![](../pic/1.3_byte_order.png)

View File

@ -1 +1,52 @@
# C 语言基础
## 从源代码到可执行文件
我们以经典著作《The C Programming Language》中的第一个程序 “Hello World” 为例,讲解 Linux 下 GCC 的编译过程。
```c
#include <stdio.h>
main()
{
printf("hello, world\n");
}
```
```text
$gcc hello.c
$./a.out
hello world
```
以上过程可分为4个步骤预处理Preprocessing、编译Compilation、汇编Assembly和链接Linking
![](../pic/1.5.1_compile.png)
### 预编译
```text
$gcc -E hello.c -o hello.i
```
预编译过程主要处理源代码中以 “#” 开始的预编译指令:
- 将所有的 “#define” 删除,并且展开所有的宏定义。
- 处理所有条件预编译指令,如 “#if”、“#ifdef”、“#elif”、“#else”、“#endif”。
- 处理 “#include” 预编译指令,将被包含的文件插入到该预编译指令的位置。注意,该过程递归执行。
- 删除所有注释。
- 添加行号和文件名标号。
- 保留所有的 #pragma 编译器指令。
### 编译
```text
$gcc -S hello.c -o hello.s
```
编译过程就是把预处理完的文件进行一系列词法分析、语法分析、语义分析及优化后生成相应的汇编代码文件。
### 汇编
```text
$gcc -c hello.s -o hello.o
或者
$gcc -c hello.c -o hello.o
```
汇编器将汇编代码转变成机器可以执行的指令。
### 链接
目标文件需要链接一大堆文件才能得到最终的可执行文件。链接过程主要包括地址和空间分配Address and Storage Allocation、符号决议Symbol Resolution和重定向Relocation等。

1
doc/1.5.7_memory.md Normal file
View File

@ -0,0 +1 @@
# 内存与虚拟内存

1
doc/1.6_crypto_basic.md Normal file
View File

@ -0,0 +1 @@
# 密码学基础

1
doc/1.7_android_basic.md Normal file
View File

@ -0,0 +1 @@
# Android 安全基础

View File

@ -1,7 +1,7 @@
# 第一章 基础知识篇
- [1.1 CTF 介绍](1.1_ctf.md)
- [1.2 打造虚拟机](1.2_vm.md)
- [1.2 打造虚拟机](2.1_vm.md)
- [1.3 Linux基础](1.3_linux_basic.md)
- [1.5 逆向工程基础](1.5_reverse_basic.md)
- [1.5.1 C语言基础](1.5.1_c_basic.md)
@ -10,3 +10,4 @@
- [1.5.4 Windows PE](1.5.4_pe.md)
- [1.5.5 静态链接](1.5.5_static_link.md)
- [1.5.6 动态链接](1.5.6_dynamic_link.md)
- [1.5.7 内存与虚拟内存](1.5.7_memory.md)

View File

@ -1,6 +1,9 @@
# 2.5 IDA Pro
#### 内存 dump 脚本
- [内存 dump 脚本](#dump)
#### <span id="dump">内存 dump 脚本</span>
调试程序时偶尔会需要 dump 内存,但 IDA Pro 没有直接提供此功能,可以通过脚本来实现。
```python
import idaapi

1
doc/2.8_zio.md Normal file
View File

@ -0,0 +1 @@
# Zio

1
doc/2.9_metasploit.md Normal file
View File

@ -0,0 +1 @@
# MetaSploit

View File

@ -1,8 +1,8 @@
# 第二章 工具篇
- [2.1 gdb/peda](2.1gdb&peda.md)
- [2.2 ollydbg](2.2_ollydbg.md)
- [2.3 windbg](2.3_windbg.md)
- [2.4 radare2](2.4_radare2.md)
- [2.5 IDA Pro](2.5_idapro.md)
- [2.6 pwntools](2.6_pwntools.md)
- [2.1 gdb/peda](2.2_gdb&peda.md)
- [2.2 ollydbg](2.3_ollydbg.md)
- [2.3 windbg](2.4_windbg.md)
- [2.4 radare2](2.5_radare2.md)
- [2.5 IDA Pro](2.6_idapro.md)
- [2.6 pwntools](2.7_pwntools.md)

1
doc/5.1_fuzz.md Normal file
View File

@ -0,0 +1 @@
# Fuzz 测试

View File

@ -1 +1,3 @@
# 第五章 高级篇
- [5.1 Fuzz 测试](doc/5.1_fuzz.md)

View File

@ -2,6 +2,7 @@
- [file](#file)
- [edb](#edb)
- [ldd](#ldd)
- [ltrace](#ltrace)
- [md5sum](#md5sum)
- [objdump](#objdump)
@ -19,6 +20,10 @@
**edb**是一个同时支持x86、x86-64的调试器。它主要向 OllyDbg 工具看齐,并可通过插件体系进行功能的扩充。
## <span id="ldd">ldd</span>
用于打印程序或者库文件所依赖的共享库列表。
## <span id="ltrace">ltrace</span>
**ltrace**命令用于跟踪进程调用库函数的情况。
@ -118,7 +123,7 @@ ssdeep -bm hash.txt modified.elf
#### 重要参数
```text
-d --data Only scan the data sections in the file
-a --all Scan the entire file, not just the data section [default]
-t --radix={o,d,x} Print the location of the string in base 8, 10 or 16
-e --encoding={s,S,b,l,B,L} Select character size and endianness:
s = 7-bit, S = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit

BIN
pic/1.3_byte_order.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
pic/1.5.1_compile.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB