Explore the world of practical ethical hacking by developing custom network scanning and remote access tools that will help you test the system security of your organization

Key Features

  • Get hands-on with ethical hacking and learn to think like a real-life hacker
  • Build practical ethical hacking tools from scratch with the help of real-world examples
  • Leverage Python 3 to develop malware and modify its complexities

Book Description

Penetration testing enables you to evaluate the security or strength of a computer system, network, or web application that an attacker can exploit. With this book, you'll understand why Python is one of the fastest-growing programming languages for penetration testing. You'll find out how to harness the power of Python and pentesting to enhance your system security.

Developers working with Python will be able to put their knowledge and experience to work with this practical guide. Complete with step-by-step explanations of essential concepts and practical examples, this book takes a hands-on approach to help you build your own pentesting tools for testing the security level of systems and networks. You'll learn how to develop your own ethical hacking tools using Python and explore hacking techniques to exploit vulnerabilities in networks and systems. Finally, you'll be able to get remote access to target systems and networks using the tools you develop and modify as per your own requirements.

By the end of this ethical hacking book, you'll have developed the skills needed for building cybersecurity tools and learned how to secure your systems by thinking like a hacker.

What you will learn

  • Understand the core concepts of ethical hacking
  • Develop custom hacking tools from scratch to be used for ethical hacking purposes
  • Discover ways to test the cybersecurity of an organization by bypassing protection schemes
  • Develop attack vectors used in real cybersecurity tests
  • Test the system security of an organization or subject by identifying and exploiting its weaknesses
  • Gain and maintain remote access to target systems
  • Find ways to stay undetected on target systems and local networks

Who this book is for

If you want to learn ethical hacking by developing your own tools instead of just using the prebuilt tools, this book is for you. A solid understanding of fundamental Python concepts is expected. Some complex Python concepts are explained in the book, but the goal is to teach ethical hacking, not Python.

Table of Contents

  1. Python Ethical Hacking from Scratch
  2. Contributors
  3. About the author
  4. About the reviewers
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Download the example code files
    5. Download the color images
    6. Conventions used
    7. Get in touch
    8. Reviews
  6. Section 1: The Nuts and Bolts of Ethical Hacking – The Basics
  7. Chapter 1: Introduction to Hacking
    1. What's all the fuss about hackers?
    2. What is hacking?
    3. Confidentiality
    4. Integrity
    5. Availability
    6. Becoming a successful hacker
    7. Legality
    8. Types of hackers
    9. White hat hackers
    10. Black hat hackers
    11. Gray hat hackers
    12. Nation-state hackers
    13. Corporate spies
    14. Hacktivists
    15. Script kiddies
    16. Hacking phases and methodology
    17. Planning
    18. Reconnaissance
    19. Scanning
    20. Identifying weaknesses
    21. Attacking and gaining access
    22. Maintaining access
    23. Post exploitation
    24. Covering tracks
    25. Reporting
    26. Careers in cybersecurity
    27. Systems security administration
    28. Security architect
    29. Penetration tester
    30. Forensic analyst
    31. Chief information security officer
    32. Types of attacks
    33. System control
    34. Social engineering
    35. Baiting
    36. Phishing
    37. Summary
  8. Chapter 2: Getting Started – Setting Up a Lab Environment
    1. Technical requirements
    2. Setting up VirtualBox
    3. Installing virtual OSes
    4. Attack machine OS
    5. Installing Python
    6. Installing Python on Windows
    7. Installing Python on Kali Linux
    8. Integrated development environment
    9. Setting up networking
    10. Updating Kali
    11. Using virtual environments
    12. Summary
  9. Section 2: Thinking Like a Hacker – Network Information Gathering and Attacks
  10. Chapter 3: Reconnaissance and Information Gathering
    1. What is a computer network?
    2. Components of a basic computer network
    3. Node
    4. Server
    5. Transmission media
    6. Network interface card
    7. Hub
    8. Switch
    9. Router
    10. Gateway
    11. Firewall
    12. Classifying network
    13. Local area network
    14. Personal area network
    15. Metropolitan area networks
    16. Wide area network
    17. Internet
    18. Network stack
    19. Introduction to OSI model
    20. Complete cycle
    21. TCP/IP model
    22. Mapping the OSI and TCP/IP stack
    23. Network entities
    24. Private IP address
    25. IPv4 versus IPv6
    26. MAC address
    27. Ports
    28. Protection
    29. Changing our MAC address
    30. Creating a Python script
    31. Summary
  11. Chapter 4: Network Scanning
    1. Introduction to networking
    2. Data representation in digital systems
    3. Data encapsulation
    4. The packet delivery process
    5. Introduction to Scapy
    6. Installing Scapy
    7. Understanding how Scapy works
    8. Network scanner using Scapy
    9. Address Resolution Protocol
    10. ARP scanner using Scapy
    11. Summary
  12. Chapter 5: Man in the Middle Attacks
    1. Why do we need ARP?
    2. ARP poisoning
    3. Building an ARP spoof program
    4. Arp spoof project
    5. Monitoring traffic
    6. Encrypted traffic
    7. Restoring ARP tables manually
    8. Decrypting the network traffic
    9. HTTPS versus HTTP
    10. Bypassing HTTPS
    11. Summary
  13. Section 3: Malware Development
  14. Chapter 6: Malware Development
    1. Understanding RATs
    2. Forward shell
    3. Reverse shell
    4. Socket programming in Python
    5. Sockets
    6. Creating a socket in Python
    7. socket.socket() API
    8. socket.bind() API
    9. socket.listen() API
    10. socket.accept() API
    11. socket.connect()
    12. socket.send()
    13. Socket.recv()
    14. socket.close()
    15. Fitting it altogether
    16. Creating malware
    17. Hacker server
    18. Victim's client
    19. Running commands remotely on the victim's machine
    20. Navigating directories
    21. Summary
  15. Chapter 7: Advanced Malware
    1. Building a keylogger file transfer
    2. Downloading the victim file to the hacker
    3. Uploading files to the victim
    4. Taking screenshots
    5. Keylogger
    6. Summary
  16. Chapter 8: Post Exploitation
    1. Packaging the malware
    2. Understanding the pyinstaller library
    3. Understanding trojans
    4. Adding an icon to an executable
    5. Creating your own trojan
    6. Attack over a public IP
    7. Cracking passwords
    8. Stealing passwords
    9. Creating botnets
    10. Summary
  17. Chapter 9: System Protection and Perseverance
    1. Persistence system protection
    2. Intrusion detection systems
    3. IDS detection mechanisms
    4. Bypassing an IDS
    5. Persistence
    6. Summary
    7. Why subscribe?
  18. Other Books You May Enjoy
    1. Packt is searching for authors like you
    2. Leave a review - let other readers know what you think