Skip to content
misteralvaPublic

About

Learn Python from scratch through hands-on exercises, from beginner to expert. Educational statements and solutions focused on automation, scripting, networking and cybersecurity.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

🐍 Python: From Zero to Automation, Networking and Cybersecurity

🌐 English | Español

A repository of exercises to learn Python from scratch, with a clear goal: to be able to automate tasks, write scripts and build networking and cybersecurity tools.

Each exercise comes with its own educational statement (which explains the new concepts) and my solution. Difficulty increases gradually, from a simple "Hello, how old are you?" up to a complete command-line tool.

📚 This is the continuation of my Bash exercises repository, using the same format.


🎯 Who is this repository for?

  • For me, as a learning journal.
  • For anyone who wants to learn Python starting from zero, with examples focused on networking and systems (IPs, ports, logs, passwords...) instead of generic ones.

ℹ️ The exercise statements (Enunciado.md) and code comments are currently written in Spanish.


📁 Structure

Python/
├── README.md
├── README.es.md
├── 01-fundamentos/
│   ├── 01-presentacion/
│   │   ├── Enunciado.md
│   │   └── solucion.py
│   └── 02-.../
├── 02-estructuras-datos/
├── 03-ficheros-sistema/
├── 04-redes/
├── 05-ciberseguridad/
└── 06-proyecto-final/

Each exercise folder contains:

File Content
Enunciado.md Goal, new concepts explained, hints and extra challenges
solucion.py My solution to the exercise

▶️ How to run the exercises

Requirements: Python 3 (usually preinstalled on Linux/WSL2).

Check your version:

python3 --version

Run any solution from its folder:

cd 01-fundamentos/01-presentacion
python3 solucion.py
  • python3 is the interpreter that reads and runs your code.
  • solucion.py is the file containing the program.

My setup: WSL2 (Ubuntu) + Visual Studio Code.


🗺️ Learning path

Block 1 · Fundamentals (with a networking flavor)

# Exercise Concepts Status
01 Introduction input(), print(), int(), if/else ⏳
02 Basic calculator operators, variables ⏳
03 Even or odd % operator ⏳
04 Unit converter (bytes, MB, GB) f-strings, decimals ⏳
05 Port classifier if/elif/else, ranges ⏳
06 Multiplication table and countdown for, range() ⏳
07 Guess the number while, random ⏳
08 Validate an IP octet (0-255) and/or, input validation with retries ⏳
09 Check password length len(), strings ⏳
10 Interactive menu while True, break, elif ⏳

Block 2 · Data structures and functions

# Exercise Concepts Status
11 IP list manager lists, append, remove ⏳
12 Port → service dictionary dictionaries, .get() ⏳
13 Word counter split(), dictionary as a counter ⏳
14 is_valid_ip() function functions, return ⏳
15 Failed attempts per user dictionary + for ⏳
16 Robust password validator any(), string methods ⏳
17 Network device inventory nested dictionaries ⏳
18 Filter and sort IPs by subnet sorted(), list comprehensions ⏳

Block 3 · Files and system

# Exercise Concepts Status
19 Read a file and count lines and words open(), with, try/except ⏳
20 Journal/log with timestamps modes "w"/"a", datetime ⏳
21 Analyze a simulated auth.log files + dictionaries ⏳
22 Folder backup with date shutil, pathlib ⏳
23 Organize files by extension pathlib, shutil.move ⏳
24 Audit file permissions os.walk, os.stat, stat ⏳
25 Run system commands subprocess.run ⏳
26 Save and load the inventory (JSON/CSV) json, csv ⏳

Block 4 · Networking

# Exercise Concepts Status
27 Subnet calculator ipaddress ⏳
28 Ping sweep subprocess, ipaddress ⏳
29 TCP port scanner socket ⏳
30 TCP client and server (echo) socket, bind, listen ⏳
31 Query an API requests, JSON, venv ⏳
32 Forward and reverse DNS lookup socket, network errors ⏳
33 Run commands over SSH on a VM paramiko, getpass ⏳
34 CLI tool with arguments argparse ⏳

Block 5 · Defensive cybersecurity

# Exercise Concepts Status
35 File hashing and integrity verification hashlib ⏳
36 Folder integrity monitor hashes, json, sets ⏳
37 Extract IPs and emails from a log re (regex) ⏳
38 Brute-force detector with alerts sliding window, datetime ⏳
39 Secure password generator secrets, entropy ⏳
40 Check if a password has been leaked k-anonymity, hashlib, requests ⏳
41 Basic packet sniffer scapy ⏳
42 Encrypt and decrypt files cryptography (Fernet) ⏳

Block 6 · Final project

A single project, toolkit: a defensive security tool with four modules (logs, audit, netmon, hids). See the block README for the architecture and how the phases work (statements are in Spanish).

# Phase Concepts Status
43 Design and project skeleton packages, pyproject.toml, argparse ⏳
44 Core: config, logging, alerts, reports tomllib, logging, dataclasses ⏳
45 logs module: analyzer with alerts regex, sliding window, collections ⏳
46 audit module: Linux security audit stat, ss, hardening ⏳
47 netmon module: network monitor ThreadPoolExecutor, baseline ⏳
48 hids module: mini HIDS integration, watch, deduplication ⏳
49 Tests, packaging and final README pytest, build, versioning ⏳

Legend: ✅ done · ⏳ pending


🧭 How to use this repository to learn

  1. Read the exercise's Enunciado.md.
  2. Try to solve it on your own using the concepts and hints.
  3. Try the extra challenges.
  4. Compare with solucion.py only at the end.

Making mistakes and debugging is the best part of learning. 💪


👤 Author

David · @misteralva · misteralva.github.io

ASIR student interested in networking, cybersecurity and automation.

About

Learn Python from scratch through hands-on exercises, from beginner to expert. Educational statements and solutions focused on automation, scripting, networking and cybersecurity.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors