Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Log Trainer

Log Trainer is a local command-line learning tool that generates randomized, reproducible scripting challenges. It gives you files to investigate, grades the answer you produce, provides progressive hints, explains the solution, and tracks completed practice iterations.

The learner controls the solution. You can use Python, PowerShell, Bash, or any other local tool capable of producing the required answer.txt file. Log Trainer grades the result rather than enforcing one specific implementation.

Features

  • Random scenario selection without repeats until the pool is exhausted
  • Explicit scenario selection
  • Deterministic seeds for reproducible challenges
  • Configurable access-log sizes with safe generation limits
  • Single-file and multi-file challenges
  • Output-based grading
  • Progressive hints
  • Solution walkthroughs
  • Persistent iteration tracking
  • Automatic workspace cleanup
  • No execution of learner-written code by the trainer
  • Python standard library only

Included scenarios

Most Common Client IP

Analyze a generated web access log and identify the client IP address that made the most requests.

most-common-ip

Most Common HTTP Status

Analyze a generated access log and identify the HTTP response status code that appears most often.

most-common-status

The Hidden French Word

Investigate 30 French text files. Twenty-nine are identical, while one contains a single additional word. Use checksums and file-comparison tools to locate the outlier and identify the added word.

hidden-word

Requirements

  • Python 3.12 or newer
  • PowerShell, Bash, or another shell for running commands
  • No third-party Python dependencies

The repository currently selects Python 3.13 through .python-version, but the application supports Python 3.12 and newer.

Installation

Clone the repository and enter its directory:

git clone <your-repository-url>
cd log_trainer

Run it directly with Python:

python main.py help

Creating a virtual environment is optional because the project has no external runtime dependencies.

PowerShell:

python -m venv .venv
.\.venv\Scripts\Activate.ps1

Bash:

python3 -m venv .venv
source .venv/bin/activate

Quick start

Generate a scenario from the current random pool:

python main.py generate

Display the active challenge again:

python main.py show

Open the generated challenge files under:

workspace/challenge/

Write your solution in the generated starter file if desired:

workspace/submission/solution.py

Your solution must write its final response to:

workspace/submission/answer.txt

Run your solution yourself, then grade the answer:

python workspace/submission/solution.py
python main.py grade

The trainer does not execute solution.py; it only reads answer.txt.

Commands

Help

python main.py help
python main.py --help
python main.py generate --help

List scenarios

python main.py list-scenarios

This displays each scenario's title, slug, difficulty, and description.

Generate from the random pool

python main.py generate

Every registered scenario is selected once per pool cycle. When the pool is empty, it is shuffled and refilled. The final scenario of one cycle will not be immediately repeated at the beginning of the next cycle.

Generate a specific scenario

python main.py generate --scenario most-common-ip
python main.py generate --scenario most-common-status
python main.py generate --scenario hidden-word

Explicit selection does not consume a scenario from the random pool.

Reproduce a challenge

python main.py generate --scenario most-common-ip --seed 48291

The same scenario and seed produce the same challenge data.

Change access-log size

python main.py generate --scenario most-common-ip --lines 500

Access-log scenarios accept between 10 and 100,000 records.

Grade an answer

python main.py grade

The answer is normalized by removing surrounding whitespace and then compared with the internally calculated expected result.

Request hints

python main.py hint

Each invocation reveals the next unused hint.

Show the walkthrough

python main.py explain

Wipe the active challenge

python main.py wipe

This removes generated challenge files, solution.py, and answer.txt. It preserves iteration history.

Typical workflow

generate a randomized challenge
        ↓
inspect the prompt and files
        ↓
solve it using your preferred scripting tool
        ↓
write the result to answer.txt
        ↓
grade the result
        ↓
request a hint or walkthrough if needed
        ↓
wipe and generate another iteration

Workspace layout

workspace/
├── challenge/
│   ├── access.log       # access-log scenarios
│   ├── documents/       # multi-file scenarios
│   ├── prompt.txt
│   ├── metadata.json
│   └── .state.json
├── submission/
│   ├── solution.py
│   └── answer.txt
└── iterations.json

Generated challenge data, submissions, answer state, and personal iteration history are excluded from Git.

Design principles

  1. Solve practical problems rather than trivia questions.
  2. Grade results instead of implementation style.
  3. Allow Python, PowerShell, Bash, and other valid approaches.
  4. Use deterministic randomness for reproducibility.
  5. Provide help progressively.
  6. Keep generated work disposable.
  7. Never execute learner code automatically on the host.
  8. Build operational skill through repeated variations.

Project direction

Log Trainer is a working prototype for a broader local systems-learning engine. Future scenario families may cover Linux administration, users and groups, permissions, processes, services, networking, filesystems, Bash automation, Python automation, DevOps, and troubleshooting inside disposable environments.

The current release intentionally remains a small, local, file-based CLI.

Security model

This project is designed for personal local practice:

  • It does not run learner-written scripts.
  • It does not open network services.
  • It does not require administrator privileges.
  • It contains no API credentials or runtime secrets.
  • Generated files are confined to the project workspace.

Do not expose the current CLI directly as a multi-user web service. A hosted version would require isolated execution environments, server-side grading state, authentication, resource limits, and stronger lifecycle controls.

License

No license has been selected yet. Add a license before inviting external contributors or reuse.

About

A local CLI tool to practice parsing logs and other useful Sysadmin/DevOps/Cyber-Operator skills.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages