Skip to content

Introduction to Python 3 ​

FieldValue
Module ID88
DifficultyEasy
TierTier 0
CategoryGeneral
Estimated Time5 hours
Cubes Earned0
Experience Points540
CreatorsFugl
Last Updated2021-06-04T00:00:00.000000Z
URLhttps://academy.hackthebox.com/app/module/88

Module Includes ​

  • 14 Sections
  • 13 Interactive Exercises
  • 0 Assessments
  • 0 Cubes

Module Description ​

Automating tedious or otherwise impossible tasks is highly valued during both penetration testing engagements and everyday life. Introduction to Python 3 aims to introduce the student to the world of scripting with Python 3 and covers the essential building blocks needed for a beginner to understand programming. Some advanced topics are also covered for the more experienced student. In a guided fashion and starting soft, the final goal of this module is to equip the reader with enough know-how to be able to implement simple yet useful pieces of software.

Module Summary ​

This module introduces programming with Python 3 and guides the reader through writing simple yet useful pieces of software, little by little. Starting gently with the essential building blocks, we will work our way through different techniques and functional data structures and end up with working software that is easy to modify and add new features to.

In this module, we will, among other topics, cover:

  • A short introduction to Python 3 as a language
  • Variables and simple data structures
  • Working with loops and program control
  • Working with functions, classes, and modules

The module is broken down into smaller sections in which we will cover not just the different, newly introduced concepts but also how we can utilize these to improve the code. The module contains small exercises that will help connect the dots, and most sections of the module will include a fair bit of code and thorough breakdowns of the additions and changes made to it. It is recommended to follow along by typing out everything by hand as additional practice.

The final goal of this module is to equip the reader with enough know-how to be able to implement simple pieces of software, for example, a website word extractor. Homemade tools like these will, in some situations, help the author overcome otherwise very challenging obstacles. The example program we will be making - the word extractor - will, in the end, enable us to generate a list of the most common words of a certain length found on a particular website. A list like this could be used to create a targeted word list for password spraying against an exposed company login page or brute force attacks when combined with other tools.

You can start and stop the module at any time and pick up where you left off. There is no time limit or "grading," but you must complete all of the exercises and the skills assessment to receive the maximum number of cubes and have this module marked as complete in any paths you have chosen.

The module is classified as "Easy". Still, it assumes a working knowledge of using a command-line terminal to perform basic operations such as running the code or installing a Python package. This module further assumes that Python version 3.7.x or later is installed on your local computer already for the full experience.

A firm grasp of the following modules can be considered prerequisites for successful completion of this module:

  • Learning Process
  • Linux Fundamentals

Sections ​

14 sections - 13 Interactive

#GroupTypeTitle
1Introduction to Python 3theoryWhat is Python?
2Python FundamentalsinteractiveExecuting Python Code
3interactiveIntroduction to Variables
4interactiveConditional Statements and Loops
5Keeping It Simple and SmartinteractiveDefining Functions
6interactiveMaking Code Classy
7The Importance of LibrariesinteractiveIntroduction to Libraries
8interactiveManaging Libraries in Python
9interactiveThe Importance of Libraries
10Word ExtractorinteractiveThe First Iterations
11interactiveContinuously Improving The Code
12interactiveFurther Improvements
13Turning it up to 11interactiveA Simple Bind Shell
14interactiveManaging Libraries in Python (Continued)

Conclusion ​

Dear Student,

Thank you for joining me on this journey through the basics of Python programming. In this module, we have gone through the essentials needed to start writing Python software for the greater good. We have covered the basic building blocks, started writing useful tools, and discussed a few more advanced concepts. While there is still so much more to explore and learn, we have tilled the soil, planted seeds, and watched as the sprouts of knowledge have found their way up towards the sun and said their "Hello worlds." With the basic concepts and environment management techniques in hand, only creativity is the limit for what is to come.

Until we meet again,

Birb