⬆️ ⬇️

Gray Hat Python Book

image



Dear Habs community and all interested in the programming language Python. I started translating a very interesting Gray Hat Python book. True, so far I have translated only the preface and the first chapter. He began to translate for himself (therefore, a little clumsy), but still decided that I needed to share. :)



And so give the floor to the author.



Foreword

')

I learned Python specifically for hacking - and I dare say that this statement is true for many others as well. I spent a lot of time learning a language that is well suited for hacking and reverse engineering, and a few years ago it became quite obvious that Python was becoming a true leader in hacking-oriented languages. However, the trick was that there was no worthwhile guide on how to use Python for various hacking tasks. You have to dig in the forums and manuals, and usually spend a lot of time looking through the code step by step to make it work correctly. This book aims to fill this gap by giving you a cursory course on how to use Python for hacking and reverse engineering in various ways.



The book is designed to allow you to learn some of the theoretical foundations of most hacking tools and techniques, including debuggers, backdoors, fuzzers, emulators, and code injection, giving you some insight into how Python ready-made tools can be used when conventional solutions are not required. . You will learn not only how to use tools based on Python, but also how to create tools in the Python language. But be warned, this is not an exhaustive guide! There are many, many tools for IB (information security) written in Python, which I did not consider. However, this book will allow you to learn many similar application skills that you can use, debug, extend, and customize any Python application of your choice.



There are several ways to study this book. If you're new to Python or developing hacking tools, then you should read the book from beginning to end in order. You will learn a little bit of theory, program a bunch of Python code, and gain solid knowledge about how to solve a lot of hacking and reversing tasks as you read the book. If you are already familiar with Python and understand the ctypes Python library, then go straight to Chapter 2. For those of you who are “in the subject,” it’s enough to go to the necessary sections of the book and use code snippets or specific sections as you need in your daily tasks.



I spent a lot of time debugging, starting with debugging theory in Chapter 2, and continuing right up to Immunity Debugger (a modification of OllyDbg) in Chapter 5. Debuggers are important tools for any hacker, and I’m not ashamed to tell you about them in sufficient detail. Moving on, you'll learn some hooking and injection techniques in Chapters 6 and 7, which you can add to some concepts of debugging program control and memory manipulation.



The next section of the book is aimed at hacking applications using fuzzers. In Chapter 8, you will begin to study fuzzing, and create your simplest file fuzzing. In Chapter 9, we will use the powerful Sulley fuzzing framework to break a real FTP daemon, and in Chapter 10 you will learn how to create a fuzzer to destroy Windows drivers.



In Chapter 11, you will see how to automate static analytics tasks in IDA Pro, a popular binary static analysis tool. We will end the book with a PyEmu theme, based on a Python emulator, in Chapter 12.



I tried to present the source code somewhat less, with detailed explanations of how the code inserted at certain points works. Part of the time when learning a new language, or making new libraries, is spent in the necessary diligent rewriting of the code and debugging your mistakes. I encourage your manual code entry. All source codes to your satisfaction are presented on the official website of the book.



Well, now let's start programming!



First chapter of the book



I really look forward to objective criticism, clarification and feedback. Translations of chapters tentatively appear once a week.

Source: https://habr.com/ru/post/88947/



All Articles