Black Hat Python




Download 3.02 Mb.
Pdf ko'rish
bet2/10
Sana26.01.2024
Hajmi3.02 Mb.
#146117
1   2   3   4   5   6   7   8   9   10
Bog'liq
python
Mintaqaviy iqtisodiyot
Foreword
Python is still the dominant language in the world of information security, even if the conversation
about your language of choice sometimes looks more like a religious war. Python-based tools include
all manner of fuzzers, proxies, and even the occasional exploit. Exploit frameworks like CANVAS
are written in Python as are more obscure tools like PyEmu or Sulley.
Just about every fuzzer or exploit I have written has been in Python. In fact, the automotive hacking
research that Chris Valasek and I recently performed contained a library to inject CAN messages onto
your automotive network using Python!
If you are interested in tinkering with information security tasks, Python is a great language to learn
because of the large number of reverse engineering and exploitation libraries available for your use.
Now if only the Metasploit developers would come to their senses and switch from Ruby to Python,
our community would be united.
In this new book, Justin covers a large range of topics that an enterprising young hacker would need
to get off the ground. He includes walkthroughs of how to read and write network packets, how to
sniff the network, as well as anything you might need for web application auditing and attacking. He
then spends significant time diving into how to write code to address specifics with attacking
Windows systems. In general, Black Hat Python is a fun read, and while it might not turn you into a
super stunt hacker like myself, it can certainly get you started down the path. Remember, the
difference between script kiddies and professionals is the difference between merely using other
people’s tools and writing your own.
Charlie Miller
St. Louis, Missouri
September 2014


Preface
Python hacker. Those are two words you really could use to describe me. At Immunity, I am lucky
enough to work with people who actually, really, know how to code Python. I am not one of those
people. I spend a great deal of my time penetration testing, and that requires rapid Python tool
development, with a focus on execution and delivering results (not necessarily on prettiness,
optimization, or even stability). Throughout this book you will learn that this is how I code, but I also
feel as though it is part of what makes me a strong pentester. I hope that this philosophy and style
helps you as well.
As you progress through the book, you will also realize that I don’t take deep dives on any single
topic. This is by design. I want to give you the bare minimum, with a little flavor, so that you have
some foundational knowledge. With that in mind, I’ve sprinkled ideas and homework assignments
throughout the book to kickstart you in your own direction. I encourage you to explore these ideas, and
I would love to hear back any of your own implementations, tooling, or homework assignments that
you have done.
As with any technical book, readers at different skill levels with Python (or information security in
general) will experience this book differently. Some of you may simply grab it and nab chapters that
are pertinent to a consulting gig you are on, while others may read it cover to cover. I would
recommend that if you are a novice to intermediate Python programmer that you start at the beginning
of the book and read it straight through in order. You will pick up some good building blocks along
the way.
To start, I lay down some networking fundamentals in 
Chapter 2
and slowly work our way through
raw sockets in 
Chapter 3
 and using Scapy in 
Chapter 4
for some more interesting network tooling.
The next section of the book deals with hacking web applications, starting with your own custom
tooling in 
Chapter 5
 and then extending the popular Burp Suite in 
Chapter 6
. From there we will
spend a great deal of time talking about trojans, starting with GitHub command and control in
Chapter 7
, all the way through 
Chapter 10
 where we will cover some Windows privilege escalation
tricks. The final chapter is about using Volatility for automating some offensive memory forensics
techniques.
I try to keep the code samples short and to the point, and the same goes for the explanations. If you are
relatively new to Python I encourage you to punch out every line to get that coding muscle memory
going. All of the source code examples from this book are available at
http://nostarch.com/blackhatpython/
.
Here we go!



Download 3.02 Mb.
1   2   3   4   5   6   7   8   9   10




Download 3.02 Mb.
Pdf ko'rish