2ND EDITION Black Hat Python

2ND EDITION

Black Hat Python

Python Programming for Hackers and Pentesters

AECACRELSYS

Justin Seitz and Tim Arnold

Foreword by Charlie Miller

NO STARCH PRESS E ARLY ACCESS PROGR AM:

FEEDBACK WELCOME!

Welcome to the Early Access edition of the as yet unpublished Black Hat Python, 2nd Edition by Justin Seitz and Tim Arnold! As a prepublication title, this book may be incomplete and some chapters may not have been proofread.

Our goal is always to make the best books possible, and we look forward to hearing your thoughts. If you have any comments or questions, email us at earlyaccess@. If you have specific feedback for us, please include the page number, book title, and edition date in your note, and we'll be sure to review it. We appreciate your help and support!

We'll email you as new chapters become available. In the meantime, enjoy!

BL ACK HAT PY THON, 2ND EDITION

JUSTIN SEITZ AND TIM ARNOLD

Early Access edition, 12/3/20

Copyright ? 2021 by Justin Seitz and Tim Arnold.

ISBN-10: 978-1-7185-0112-6 ISBN-13: 978-1-7185-0113-3

Publisher: William Pollock Executive Editor: Barbara Yien Production Editor: Dapinder Dosanjh Developmental Editor: Frances Saux Cover Illustration: Garry Booth Interior Design: Octopod Studios Technical Reviewer: Cliff Janzen Copyeditor: Bart Reed Compositor: Happenstance Type-O-Rama Proofreader: Sharon Wilkey

No Starch Press and the No Starch Press logo are registered trademarks of No Starch Press, Inc. Other product and company names mentioned herein may be the trademarks of their respective owners. Rather than use a trademark symbol with every occurrence of a trademarked name, we are using the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark.

All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher.

The information in this book is distributed on an "As Is" basis, without warranty. While every precaution has been taken in the preparation of this work, neither the author nor No Starch Press, Inc. shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in it.

CONTENTS

Preface Chapter 1: Setting Up Your Python Environment . . . . . . . . . . . . 1 Chapter 2: The Network: Basics . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Chapter 3: The Network: Raw Sockets and Sniffing . . . . . . . . . 35 Chapter 4: Owning the Network with Scapy . . . . . . . . . . . . . . . 53 Chapter 5: Web Hackery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 Chapter 6: Extending Burp Proxy . . . . . . . . . . . . . . . . . . . . . . . 93 Chapter 7: GitHub Command and Control . . . . . . . . . . . . . . . 117 Chapter 8: Common Trojaning Tasks on Windows . . . . . . . . . 127 Chapter 9: Fun with Exfiltration . . . . . . . . . . . . . . . . . . . . . . . . 139 Chapter 10: Windows Privilege Escalation . . . . . . . . . . . . . . . . 153 Chapter 11: Offensive Forensics . . . . . . . . . . . . . . . . . . . . . . . . 169

The chapters in red are included in this Early Access PDF.

Black Hat Python (Early Access) ? 2021 by Justin Seitz and Tim Arnold

1

SETTING UP YOUR PYTHON ENVIRONMENT

This is the least fun, but nevertheless critical, part of the book, where we walk through setting up an environment in which to write and test Python. We'll do a crash course in setting up a Kali Linux virtual machine (VM), creating a virtual environment for Python 3, and installing a nice integrated development environment (IDE) so that you have everything you need to develop code. By the end of this chapter, you should be ready to tackle the exercises and code examples in the remainder of the book.

Before you get started, if you don't have a hypervisor virtualization client such as VMware Player, VirtualBox, or Hyper-V, download and install one. We also recommend that you have a Windows 10 VM at the ready. You can get an evaluation Windows 10 VM here: windows/downloads/virtual-machines/.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download