如何自学黑客&网络安全
黑客零基础入门学习路线&规划
初级黑客
1、网络安全理论知识(2天)
①了解行业相关背景,前景,确定发展方向。
②学习网络安全相关法律法规。
③网络安全运营的概念。
④等保简介、等保规定、流程和规范。(非常重要)
2、渗透测试基础(一周)
①渗透测试的流程、分类、标准
②信息收集技术:主动/被动信息搜集、Nmap工具、Google Hacking
③漏洞扫描、漏洞利用、原理,利用方法、工具(MSF)、绕过IDS和反病毒侦察
④主机攻防演练:MS17-010、MS08-067、MS10-046、MS12-20等
3、操作系统基础(一周)
①Windows系统常见功能和命令
②Kali Linux系统常见功能和命令
③操作系统安全(系统入侵排查/系统加固基础)
4、计算机网络基础(一周)
①计算机网络基础、协议和架构
②网络通信原理、OSI模型、数据转发流程
③常见协议解析(HTTP、TCP/IP、ARP等)
④网络攻击技术与网络安全防御技术
⑤Web漏洞原理与防御:主动/被动攻击、DDOS攻击、CVE漏洞复现
5、数据库基础操作(2天)
①数据库基础
②SQL语言基础
③数据库安全加固
6、Web渗透(1周)
①HTML、CSS和JavaScript简介
②OWASP Top10
③Web漏洞扫描工具
④Web渗透工具:Nmap、BurpSuite、SQLMap、其他(菜刀、漏扫等)
恭喜你,如果学到这里,你基本可以从事一份网络安全相关的工作,比如渗透测试、Web 渗透、安全服务、安全分析等岗位;如果等保模块学的好,还可以从事等保工程师。薪资区间6k-15k
到此为止,大概1个月的时间。你已经成为了一名“脚本小子”。那么你还想往下探索吗?
如果你想要入坑黑客&网络安全,笔者给大家准备了一份:282G全网最全的网络安全资料包评论区留言即可领取!
7、脚本编程(初级/中级/高级)
在网络安全领域。是否具备编程能力是“脚本小子”和真正黑客的本质区别。在实际的渗透测试过程中,面对复杂多变的网络环境,当常用工具不能满足实际需求的时候,往往需要对现有工具进行扩展,或者编写符合我们要求的工具、自动化脚本,这个时候就需要具备一定的编程能力。在分秒必争的CTF竞赛中,想要高效地使用自制的脚本工具来实现各种目的,更是需要拥有编程能力.
如果你零基础入门,笔者建议选择脚本语言Python/PHP/Go/Java中的一种,对常用库进行编程学习;搭建开发环境和选择IDE,PHP环境推荐Wamp和XAMPP, IDE强烈推荐Sublime;·Python编程学习,学习内容包含:语法、正则、文件、 网络、多线程等常用库,推荐《Python核心编程》,不要看完;·用Python编写漏洞的exp,然后写一个简单的网络爬虫;·PHP基本语法学习并书写一个简单的博客系统;熟悉MVC架构,并试着学习一个PHP框架或者Python框架 (可选);·了解Bootstrap的布局或者CSS。
8、超级黑客
这部分内容对零基础的同学来说还比较遥远,就不展开细说了,附上学习路线。
网络安全工程师企业级学习路线
如图片过大被平台压缩导致看不清的话,评论区点赞和评论区留言获取吧。我都会回复的
视频配套资料&国内外网安书籍、文档&工具
需要体系化学习资料的朋友,可以加我V获取:vip204888 (备注网络安全)
当然除了有配套的视频,同时也为大家整理了各种文档和书籍资料&工具,并且已经帮大家分好类了。
一些笔者自己买的、其他平台白嫖不到的视频教程。
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
相信各位CTF pwners一定对pwntools熟悉得不能再熟悉,做一道题时写下的第一行代码很可能就是from pwn import *
。很多pwners对于pwntools的了解可能仅限于远程交互、ELF文件简单分析这些最基础的功能,但pwntools真的只有这些功能吗?你真的会使用pwntools吗?
本文从pwntools官方文档入手,进行pwntools功能的探索。
文章目录
- A. 控制台实用命令——commandline
- B. 常数类——constants
- C. ROP——ROP类
- D. SROP——SigReturnFrame类
- E. FILE结构体——FileStructure类
- F. 格式化字符串漏洞工具——FmtStr类
- G. 数据打包实用函数——pwnlib/util/packing.py
A. 控制台实用命令——commandline
pwntools提供了一系列实用的控制台命令工具,源码相对路径:/pwnlib/commandline。
1. asm
命令用法:pwn asm [-h] [-f {raw,hex,string,elf}] [-o file] [-c context] [-v AVOID] [-n] [-z] [-d] [-e ENCODER] [-i INFILE] [-r] [line ...]
选项:
options:
-h, --help show this help message and exit
-f {raw,hex,string,elf}, --format {raw,hex,string,elf}
Output format (defaults to hex for ttys, otherwise raw)
-o file, --output file
Output file (defaults to stdout)
-c context, --context context
The os/architecture/endianness/bits the shellcode will run in (default: linux/i386), choose from: ['16', '32', '64', 'android', 'baremetal', 'cgc', 'freebsd', 'linux',
'windows', 'powerpc64', 'aarch64', 'powerpc', 'sparc64', 'mips64', 'msp430', 'alpha', 'amd64', 'riscv', 'sparc', 'thumb', 'cris', 'i386', 'ia64', 'm68k', 'mips', 's390',
'none', 'avr', 'arm', 'vax', 'little', 'big', 'be', 'eb', 'le', 'el']
-v AVOID, --avoid AVOID
Encode the shellcode to avoid the listed bytes (provided as hex)
-n, --newline Encode the shellcode to avoid newlines
-z, --zero Encode the shellcode to avoid NULL bytes
-d, --debug Debug the shellcode with GDB
-e ENCODER, --encoder ENCODER
Specific encoder to use
-i INFILE, --infile INFILE
Specify input file
-r, --run Run output
这里的asm命令有一个-z选项和-n选项,可以通过修改原本的指令来避免指令中出现换行和空字符。但是经过实际测试发现,这个功能转换出来的汇编指令并不是很好看。因此asm的这两个选项谨慎使用。
2. checksec
usage: pwn checksec [-h] [--file [elf ...]] [elf ...]
Check binary security settings
positional arguments:
elf Files to check
options:
-h, --help show this help message and exit
--file [elf ...] File to check (for compatibility with checksec.sh)
这个命令就不必多言了,检查ELF的安全选项,常用的命令。
3. constgrep
usage: pwn constgrep [-h] [-e] [-i] [-m] [-c arch_or_os] regex [constant]
Looking up constants from header files.
Example: constgrep -c freebsd -m ^PROT_ '3 + 4'
positional arguments:
regex The regex matching constant you want to find
constant The constant to find
options:
-h, --help show this help message and exit
-e, --exact Do an exact match for a constant instead of searching for a regex
-i, --case-insensitive
Search case insensitive
-m, --mask-mode Instead of searching for a specific constant value, search for values not containing strictly less bits that the given value.
-c arch_or_os, --context arch_or_os
The os/architecture/endianness/bits the shellcode will run in (default: linux/i386), choose from: ['16', '32', '64', 'android', 'baremetal', 'cgc', 'freebsd', 'linux',
'windows', 'powerpc64', 'aarch64', 'powerpc', 'sparc64', 'mips64', 'msp430', 'alpha', 'amd64', 'riscv', 'sparc', 'thumb', 'cris', 'i386', 'ia64', 'm68k', 'mips', 's390',
'none', 'avr', 'arm', 'vax', 'little', 'big', 'be', 'eb', 'le', 'el']
这个命令的功能有点意思。我们都知道在C语言标准库中有很多的宏定义常量,如mmap中的映射选项、读写权限选项等,有的时候,这种常量可能很多,在IDA中查看源码的时候,IDA当然是不可能会将函数传入的常数转换为这种宏定义的,这就会让我们阅读代码带来一定的困难,还需要去查阅源码才能知道传入常量的具体含义。而constgrep命令则允许我们通过一定的正则匹配筛选出源码中的常量,然后根据我们给出的值自动进行或操作拼接,最终给出原本的宏定义含义。如输入命令constgrep -c amd64 -m ^PROT_ 7,其输出如下:
#define PROT_NONE 0x0
#define PROT_READ 0x1
#define PROT_WRITE 0x2
#define PROT_EXEC 0x4
(PROT_WRITE | PROT_READ | PROT_EXEC) == 7
上面命令的功能是:找到amd64架构下所有以"PROT_"开头的宏定义,并通过或操作获得值7,输出中给出了或操作的具体项。如果不传入具体的数值而是添加-m选项,则会输出所有与正则匹配的宏定义。这个小工具有助于我们更容易理解IDA反编译出来的C代码。
4. cyclic
usage: pwn cyclic [-h] [-a alphabet] [-n length] [-c context] [-l lookup_value | count]
Cyclic pattern creator/finder
positional arguments:
count Number of characters to print
options:
-h, --help show this help message and exit
-a alphabet, --alphabet alphabet
The alphabet to use in the cyclic pattern (defaults to all lower case letters)
-n length, --length length
Size of the unique subsequences (defaults to 4).
-c context, --context context
The os/architecture/endianness/bits the shellcode will run in (default: linux/i386), choose from: ['16', '32', '64', 'android', 'baremetal', 'cgc', 'freebsd', 'linux',
'windows', 'powerpc64', 'aarch64', 'powerpc', 'sparc64', 'mips64', 'msp430', 'alpha', 'amd64', 'riscv', 'sparc', 'thumb', 'cris', 'i386', 'ia64', 'm68k', 'mips', 's390',
'none', 'avr', 'arm', 'vax', 'little', 'big', 'be', 'eb', 'le', 'el']
-l lookup_value, -o lookup_value, --offset lookup_value, --lookup lookup_value
Do a lookup instead printing the alphabet
这个工具可以生成指定长度的缓冲数据,可通过-a选项指定缓冲数据可以使用的字符。
5. debug
usage: pwn debug [-h] [-x GDBSCRIPT] [--pid PID] [-c context] [--exec EXECUTABLE] [--process PROCESS_NAME] [--sysroot SYSROOT]
Debug a binary in GDB
options:
-h, --help show this help message and exit
-x GDBSCRIPT Execute GDB commands from this file.
--pid PID PID to attach to
-c context, --context context
The os/architecture/endianness/bits the shellcode will run in (default: linux/i386), choose from: ['16', '32', '64', 'android', 'baremetal', 'cgc', 'freebsd', 'linux',
'windows', 'powerpc64', 'aarch64', 'powerpc', 'sparc64', 'mips64', 'msp430', 'alpha', 'amd64', 'riscv', 'sparc', 'thumb', 'cris', 'i386', 'ia64', 'm68k', 'mips', 's390',
'none', 'avr', 'arm', 'vax', 'little', 'big', 'be', 'eb', 'le', 'el']
--exec EXECUTABLE File to debug
--process PROCESS_NAME
Name of the process to attach to (e.g. "bash")
--sysroot SYSROOT GDB sysroot path
这个指令和gdb的功能类似,可以通过–pid参数对某个进程进行调试,可以通过–process参数根据进程名对进程进行调试等。
6. disablenx
后面跟上ELF文件名即可,可以让该ELF文件执行时关闭NX栈不可执行保护。
7. disasm
usage: pwn disasm [-h] [-c arch_or_os] [-a address] [--color] [--no-color] [hex ...]
Disassemble bytes into text format
positional arguments:
hex Hex-string to disassemble. If none are supplied, then it uses stdin in non-hex mode.
options:
-h, --help show this help message and exit
-c arch_or_os, --context arch_or_os
The os/architecture/endianness/bits the shellcode will run in (default: linux/i386), choose from: ['16', '32', '64', 'android', 'baremetal', 'cgc', 'freebsd', 'linux',
'windows', 'powerpc64', 'aarch64', 'powerpc', 'sparc64', 'mips64', 'msp430', 'alpha', 'amd64', 'riscv', 'sparc', 'thumb', 'cris', 'i386', 'ia64', 'm68k', 'mips', 's390',
'none', 'avr', 'arm', 'vax', 'little', 'big', 'be', 'eb', 'le', 'el']
-a address, --address address
Base address
--color Color output
--no-color Disable color output
反汇编命令,传入的数据是以16进制bytes的形式,如需要传入字符串’aa’则应该写成6161。
8. elfdiff
传入两个ELF文件,比较两个文件。
9. elfpatch
usage: pwn elfpatch [-h] elf offset bytes
Patch an ELF file
positional arguments:
elf File to patch
offset Offset to patch in virtual address (hex encoded)
bytes Bytes to patch (hex encoded)
options:
-h, --help show this help message and exit
修改ELF文件中的几个字节。
10. errno
传入一个整数或者errno的宏定义,获取其errno宏定义或值。
11. hex
将传入字符串转换为16进制字符串。
12. libcdb
libc相关信息查询。
pwn libcdb file [LIBC]:通过给定libc打印其哈希、关键函数偏移等
pwn libcdb lookup [FUNC] [OFFSET]:通过给定函数和偏移查询候选libc,推测是使用LibcSearcher引擎,较新的libc可能搜不到
pwn libcdb hash [HASH_VALUE]:通过给定哈希值获取libc,不常用
13. phd
与hexdump功能类似,以pretty形式打印二进制文件的每个字节。
14. pwnstrip
和strip功能类似,去除程序符号表增加逆向难度。
15. scramble
usage: pwn scramble [-h] [-f {raw,hex,string,elf}] [-o file] [-c context] [-p] [-v AVOID] [-n] [-z] [-d]
Shellcode encoder
options:
-h, --help show this help message and exit
-f {raw,hex,string,elf}, --format {raw,hex,string,elf}
Output format (defaults to hex for ttys, otherwise raw)
-o file, --output file
Output file (defaults to stdout)
-c context, --context context
The os/architecture/endianness/bits the shellcode will run in (default: linux/i386), choose from: ['16', '32', '64', 'android', 'baremetal', 'cgc', 'freebsd', 'linux',
'windows', 'powerpc64', 'aarch64', 'powerpc', 'sparc64', 'mips64', 'msp430', 'alpha', 'amd64', 'riscv', 'sparc', 'thumb', 'cris', 'i386', 'ia64', 'm68k', 'mips', 's390',
'none', 'avr', 'arm', 'vax', 'little', 'big', 'be', 'eb', 'le', 'el']
-p, --alphanumeric Encode the shellcode with an alphanumeric encoder
-v AVOID, --avoid AVOID
Encode the shellcode to avoid the listed bytes
-n, --newline Encode the shellcode to avoid newlines
-z, --zero Encode the shellcode to avoid NULL bytes
-d, --debug Debug the shellcode with GDB
这个命令看上去应该是一个shellcode的解码器,支持将shellcode解码成全字母,允许定义黑名单等,但是笔者在全网都没有搜到这个命令的一个使用的例子,试了各种方法命令运行都报错,甚至连new bing返回的结果都是错的。不过想要实现全字母shellcode还能用AE64。若有读者知道这个命令到底是怎么用的,还请不吝赐教。
16. shellcraft
usage: pwn shellcraft [-h] [-?] [-o file] [-f format] [-d] [-b] [-a] [-v AVOID] [-n] [-z] [-r] [--color] [--no-color] [--syscalls] [--address ADDRESS] [-l] [-s] [shellcode] [arg ...]
Microwave shellcode -- Easy, fast and delicious
positional arguments:
shellcode The shellcode you want
arg Argument to the chosen shellcode
options:
-h, --help show this help message and exit
-?, --show Show shellcode documentation
-o file, --out file Output file (default: stdout)
-f format, --format format
Output format (default: hex), choose from {e}lf, {r}aw, {s}tring, {c}-style array, {h}ex string, hex{i}i, {a}ssembly code, {p}reprocssed code, escape{d} hex string
-d, --debug Debug the shellcode with GDB
-b, --before Insert a debug trap before the code
-a, --after Insert a debug trap after the code
-v AVOID, --avoid AVOID
Encode the shellcode to avoid the listed bytes
-n, --newline Encode the shellcode to avoid newlines
-z, --zero Encode the shellcode to avoid NULL bytes
-r, --run Run output
--color Color output
--no-color Disable color output
--syscalls List syscalls
--address ADDRESS Load address
-l, --list List available shellcodes, optionally provide a filter
-s, --shared Generated ELF is a shared library
这个命令在命令行中的用法与代码中相似,其中有个实用的选项-l可以列出可用的shellcode,后面加上具体的架构可以获取更为详细的列表。不过笔者测试发现有的shellcode貌似找不到,谨慎使用。找不到的可以使用Metasploit这个更为强大的工具生成。
17. template
给大家的福利
零基础入门
对于从来没有接触过网络安全的同学,我们帮你准备了详细的学习成长路线图。可以说是最科学最系统的学习路线,大家跟着这个大的方向学习准没问题。
同时每个成长路线对应的板块都有配套的视频提供:
因篇幅有限,仅展示部分资料
需要体系化学习资料的朋友,可以加我V获取:vip204888 (备注网络安全)
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!