Lesson Previews
Bash Fundamentals
- Shebang (
#!/bin/bash
), permissions (chmod +x
) - Basic commands (
cd
,grep
,awk
) and control structures
Understanding a Bash Script
- Identify sections: variable declarations, loops, functions, output
- Demo: Read a script that parses logs and saves results
Modifying a Bash Script
- Add argument parsing with
getopts
- Insert logging:
echo "[$(date)] message" >> script.log
- Automate new tasks: iterate over host list, parallel execution (
&
)
PowerShell Fundamentals
- Cmdlets (Verb-Noun), pipelines, objects
- Execution policy (
Set-ExecutionPolicy
), modules import
Understanding a PowerShell Script
- Flow:
Param()
block,if
,foreach
,try/catch
- Demo: Script gathering Event Log entries
Modifying a PowerShell Script
- Add parameters (
[CmdletBinding()] Param(...)
) - Enhance error handling with
Write-Error
- Integrate external module (e.g.,
Import-Module ActiveDirectory
)
Python Fundamentals
- Script entry point (
if __name__ == '__main__':
), modules, virtual environments
Understanding a Python Script
- Structure: imports, function definitions, main logic, CLI (
argparse
) - Demo: Script that queries web API and prints JSON
Modifying a Python Script
- Add argument parsing (
parser = argparse.ArgumentParser()
) - Implement logging (
import logging
) - Extend functionality: new modules (
requests
,json
), error handling (try/except
)
Conclusion
By mastering script modification, you will:
- Automate complex recon/enumeration workflows
- Tailor existing tools to your environment
- Increase efficiency and reliability of pentesting activities