Python for Pentesters | Tryhackme Walkthrough

Rahul Kumar
13 min readMay 23, 2024

Python is probably the most widely used and most convenient scripting language in cybersecurity. This room covers real examples of Python scripts including hash cracking, key logging, enumeration and scanning.

Introduction

Python can be the most powerful tool in your arsenal as it can be used to build almost any of the other penetration testing tools. The scope of this module does not allow us to go into too many details on Python. Still, we will cover several key areas that will be useful during engagements and help you better understand Python.

Please complete the “Python Basics” room before proceeding, as this room will not go over the basic usage and programming features of the Python language.

We are not learning to become a developer; our objective is to become a penetration tester. This room will give you pointers on which you can build and improve. Examples are given on a “one of each” basis, and no code should be considered as “the only and correct way” to reach a solution. Our goal is then to build quick and effective tools that will help us in our daily tasks.

Throughout this room, you will see how to:

  • Use Python to enumerate the target’s subdomain
  • Build a simple keylogger
  • Scan the network to find target systems
  • Scan any target to find the open ports
  • Download files from the internet

--

--

Rahul Kumar

Cybersecurity Enthusiast!! | COMPTIA SEC+ | CCSK | CEH | MTA S&N | Cybersecurity Analyst | Web Application Security