Gray Hat Python: Python Programming for Hackers and Reverse Engineers
Book information
Description
Python is fast becoming the programming language of choice for hackers, reverse engineers, and software testers because it's easy to write quickly, and it has the low-level support and libraries that make hackers happy. But until now, there has been no real manual on how to use Python for a variety of hacking tasks. You had to dig through forum posts and man pages, endlessly tweaking your own code to get everything working. Not anymore. Gray Hat Python explains the concepts behind hacking tools and techniques like debuggers, trojans, fuzzers, and emulators. But author Justin Seitz goes beyond theory, showing you how to harness existing Python-based security tools—and how to build your own when the pre-built ones won't cut it. You'll learn how to: –Automate tedious reversing and security tasks –Design and program your own debugger –Learn how to fuzz Windows drivers and create powerful fuzzers from scratch –Have fun with code and library injection, soft and hard hooking techniques, and other software trickery –Sniff secure traffic out of an encrypted web browser session –Use PyDBG, Immunity Debugger, Sulley, IDAPython, PyEMU, and more The world's best hackers are using Python to do their handiwork. Shouldn't you? FOREWORD ACKNOWLEDGMENTS INTRODUCTION 1. SETTING UP YOUR DEVELOPMENT ENVIRONMENT Operating System Requirements Obtaining and Installing Python 2.5 Installing Python on Windows Installing Python for Linux Setting Up Eclipse and PyDev The Hacker's Best Friend: ctypes Using Dynamic Libraries Constructing C Datatypes Passing Parameters by Reference Defining Structures and Unions 2. DEBUGGERS AND DEBUGGER DESIGN General-Purpose CPU Registers The Stack Function Call in C Debug Events Breakpoints Soft Breakpoints Hardware Breakpoints Memory Breakpoints 3. BUILDING A WINDOWS DEBUGGER Debuggee, Where Art Thou? my_debugger_defines.py Obtaining CPU Register State Thread Enumeration Putting It All Together Implementing Debug Event Handlers my_debugger.py The Almighty Breakpoint Soft Breakpoints Hardware Breakpoints Memory Breakpoints Conclusion 4. PYDBG—A PURE PYTHON WINDOWS DEBUGGER Extending Breakpoint Handlers printf_random.py Access Violation Handlers Process Snapshots Obtaining Process Snapshots Putting It All Together 5. IMMUNITY DEBUGGER—THE BEST OF BOTH WORLDS Installing Immunity Debugger Immunity Debugger 101 PyCommands PyHooks Exploit Development Finding Exploit-Friendly Instructions Bad-Character Filtering Bypassing DEP on Windows Defeating Anti-Debugging Routines in Malware IsDebuggerPresent Defeating Process Iteration 6. HOOKING Soft Hooking with PyDbg firefox_hook.py Hard Hooking with Immunity Debugger hippie_easy.py 7. DLL AND CODE INJECTION Remote Thread Creation DLL Injection Code Injection Getting Evil File Hiding Coding the Backdoor Compiling with py2exe 8. FUZZING Bug Classes Buffer Overflows Integer Overflows Format String Attacks File Fuzzer file_fuzzer.py Future Considerations Code Coverage Automated Static Analysis 9. SULLEY Sulley Installation Sulley Primitives Strings Delimiters Static and Random Primitives Binary Data Integers Blocks and Groups Slaying WarFTPD with Sulley FTP 101 Creating the FTP Protocol Skeleton Sulley Sessions Network and Process Monitoring Fuzzing and the Sulley Web Interface 10. FUZZING WINDOWS DRIVERS Driver Communication Driver Fuzzing with Immunity Debugger ioctl_fuzzer.py Driverlib—The Static Analysis Tool for Drivers Discovering Device Names Finding the IOCTL Dispatch Routine Determining Supported IOCTL Codes Building a Driver Fuzzer ioctl_dump.py 11. IDAPYTHON—SCRIPTING IDA PRO IDAPython Installation IDAPython Functions Utility Functions Segments Functions Cross-References Debugger Hooks Example Scripts Finding Dangerous Function Cross-References Function Code Coverage Calculating Stack Size 12. PYEMU—THE SCRIPTABLE EMULATOR Installing PyEmu PyEmu Overview PyCPU PyMemory PyEmu Execution Memory and Register Modifiers Handlers Register Handlers Library Handlers Exception Handlers Instruction Handlers Opcode Handlers Memory Handlers High-Level Memory Handlers Program Counter Handler IDAPyEmu addnum.cpp Function Emulation PEPyEmu Executable Packers UPX Packer Unpacking UPX with PEPyEmu
Similar books
Black Hat Python: Python Programming for Hackers and Pentesters
2015 · PDF
Black Hat Python: Python Programming for Hackers and Pentesters
AZW3
Black Hat Python: Python Programming for Hackers and Pentesters
2014 · PDF
Gray Hat Python: Python Programming for Hackers and Reverse Engineers
2009 · PDF
Python灰帽子: 黑客与逆向工程师的Python编程之道
2011 · PDF
Black Hat Python: Python Programming for Hackers and Pentesters
2021 · PDF
Black Hat Python: Python Programming for Hackers and Pentesters
2014 · PDF
Black Hat Python: Python Programming for Hackers and Pentesters
2021 · PDF