diff --git a/progress.md b/progress.md index e69de29..1eedeb7 100644 --- a/progress.md +++ b/progress.md @@ -0,0 +1,84 @@ +# Week 1 Progress Map — Updated to Day 4 + +## Student Profile + +* Experience: Fullstack Web Developer (JavaScript, PHP, SQL, HTML, CSS, Python) +* Goals: System administration (Windows, Linux, macOS), hacking, algorithms, low-level programming +* Languages: C, Powershell, C#, Bash, SQL, C++, Python +* Current Focus: CompTIA A+ → CCNA → Security+ + +--- + +## Week 1 Overview + +* **Concept:** Variables, Conditionals, Loops, Functions, Scope +* **Goal:** Build foundation in core programming concepts, algorithmic thinking, input validation, and cross-language syntax comparison + +### Day 1 — C + +* Read user input +* Count characters in strings +* Enforce max length +* Validate first character via ASCII ranges +* Username validation: letters only, max length, starting letter + +### Day 2 — Python + +* Conditional logic: Even/Odd number check +* Count letters in a string +* Username validation implemented in Python +* Multiple username validation +* Runtime analysis (`T(n)` and `T(m, n)`) and time complexity + +### Day 3 — SQL (PostgreSQL) + +* Filter rows based on string length +* Select letters-only usernames using regex +* `CASE WHEN` to classify usernames as Accepted/Refused +* Aggregate valid usernames count +* Runtime analysis in SQL (`T(n, m) = n x m`) and scaling discussion + +### Day 4 — PowerShell + +* Conditional logic: `if / elseif / else` +* Loops: `foreach` over strings and arrays +* Input validation: letters only, max 20 characters, starts with letter, no spaces or digits +* Username validator script for single and multiple usernames +* Algorithm analysis: runtime `T(n, m) = n x m`, doubling users doubles execution +* Security perspective: safe and defensive scripting in PowerShell, Windows admin context + +--- + +## Completed Exercises Summary + +* **Exercise 1:** Even/Odd number check (Python → PowerShell) +* **Exercise 2:** Count letters in string +* **Exercise 3:** Single username validation +* **Exercise 4:** Multiple usernames validation +* **Exercise 5:** Algorithm scaling explanation + +--- + +## Next Objectives (Week 1 Day 5) + +* Learn **Bash scripting** for Linux sysadmin workflows +* Apply conditionals, loops, and input validation in Linux environment +* Translate Day 1–4 algorithms into Bash scripts +* Emphasize security and defensive programming + +--- + +## Recommendations + +* Review regex patterns across languages (C, Python, SQL, PowerShell) +* Practice linear runtime analysis (`T(n, m)`) in each context +* Keep all scripts secure, avoid unsafe input handling +* Document differences in syntax and idioms between languages + +--- + +## Notes + +* Student has strong programming background; focus can be on **systems, security, and algorithmic thinking** +* Real-world project orientation encouraged (username validation → real-world user input handling, audits, or security scripts) +* Progress map will continue tracking daily exercises, language-specific skills, and algorithmic awareness diff --git a/week 1/day 5/day5.md b/week 1/day 5/day5.md new file mode 100644 index 0000000..dd906ce --- /dev/null +++ b/week 1/day 5/day5.md @@ -0,0 +1,11 @@ + +if the number of user dobules + +the time of execution will be multiply by 2 + + +$$ +T(n, m) = n \times m +T(2n, m) = 2 \times n \times m +Big-O: O(n·m) +$$ \ No newline at end of file diff --git a/week 1/day 5/exo1.sh b/week 1/day 5/exo1.sh new file mode 100755 index 0000000..39bce85 --- /dev/null +++ b/week 1/day 5/exo1.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +read -p "please enter a number : " number + +if [[ -z $number ]]; then + echo "you must enter a number" + exit +fi + +if (( $number % 2 == 0 )); then + echo "Even" +else + echo "Odd" +fi \ No newline at end of file diff --git a/week 1/day 5/exo2.sh b/week 1/day 5/exo2.sh new file mode 100755 index 0000000..a2e82f9 --- /dev/null +++ b/week 1/day 5/exo2.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +read -p "please enter a phrase: " text + +if [[ -z "$text" ]]; then + echo "please enter a string" + exit +fi + +count=0 + +for ((i=0; i<${#text}; i++)); do + char="${text:i:1}" + if [[ "$char" =~ [A-Za-z]]]; then + count++ + fi +done + +echo "Your string contain $count letter" \ No newline at end of file diff --git a/week 1/day 5/exo3.sh b/week 1/day 5/exo3.sh new file mode 100755 index 0000000..d181549 --- /dev/null +++ b/week 1/day 5/exo3.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +read -p "Please enter your username: " username + +if [[ -z "$username" ]]; then + echo "You must enter a username" + exit 1 +fi + +badChar=false + +for ((i=0; i<${#username}; i++)); do + char="${username:i:1}" + if ! [[ "$char" =~ [A-Za-z] ]]; then + badChar=true + break + fi +done + +firstChar="${username:0:1}" +validFirstLetter=false + +if [[ "$firstChar" =~ [A-Za-z] ]]; then + validFirstLetter=true +fi + +if ! $badChar && (( ${#username} <= 20 )) && $validFirstLetter; then + echo "The username $username is valid" +else + echo "The username is not valid" +fi diff --git a/week 1/day 5/exo4.sh b/week 1/day 5/exo4.sh new file mode 100755 index 0000000..4bfea9a --- /dev/null +++ b/week 1/day 5/exo4.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +users=("admin" "root1" "John_Doe" "Alice" "Bob42") + +badChar=false + +for username in "${users[@]}"; do + + badChar=false + + for ((i=0; i<${#username}; i++)); do + char="${username:i:1}" + if ! [[ "$char" =~ [A-Za-z] ]]; then + badChar=true + break + fi + done + + firstChar="${username:0:1}" + validFirstLetter=false + + if [[ "$firstChar" =~ [A-Za-z] ]]; then + validFirstLetter=true + fi + + if ! $badChar && (( ${#username} <= 20 )) && $validFirstLetter; then + echo "The username $username is valid" + else + echo "The username $username is not valid" + fi + +done + diff --git a/week 1/day 5/readme.md b/week 1/day 5/readme.md new file mode 100644 index 0000000..ded88ae --- /dev/null +++ b/week 1/day 5/readme.md @@ -0,0 +1,158 @@ +# 📘 Week 1 · Day 5 — Bash Exercises + +This README documents **all exercises for Week 1 Day 5**, focused on **Bash scripting for Linux system administration and security workflows**. + +The exercises mirror the logic implemented previously in **C, Python, SQL, and PowerShell**, reinforcing algorithmic thinking while introducing **Unix shell syntax, conditionals, loops, and defensive scripting**. + +--- + +## 🎯 Learning Objectives + +By completing today’s exercises, you will: + +* Use Bash variables and user input (`read`) +* Apply conditional logic with `if / elif / else` +* Loop over strings and arrays using `for` +* Perform character validation using regex +* Implement secure input validation logic +* Analyze algorithm runtime and scalability +* Gain confidence writing Linux automation scripts + +--- + +## 🛠 Exercises Overview + +### 🧪 Exercise 1 — Even / Odd Number Checker + +**Task:** + +* Prompt the user for a number +* Determine whether the number is `Even` or `Odd` + +**Concepts practiced:** + +* Numeric input handling +* Arithmetic expressions: `(( ))` +* Conditional branching + +--- + +### 🧪 Exercise 2 — Count Letters in a String + +**Task:** + +* Prompt the user for a string +* Count **letters only** (`A–Z`, `a–z`) +* Ignore spaces, digits, and special characters + +**Concepts practiced:** + +* Looping over string characters +* Regex matching using `[[ =~ ]]` +* Counter variables + +--- + +### 🧪 Exercise 3 — Username Validator (Single User) + +**Task:** +Validate a username using these rules: + +* Length ≤ 20 characters +* Starts with a letter +* Contains letters only +* No digits +* No spaces + +**Output:** + +* `Accepted` or `Refused` + +**Concepts practiced:** + +* Defensive input validation +* Early exit with `break` +* String length checking +* First-character validation + +--- + +### 🧪 Exercise 4 — Validate Multiple Usernames + +**Input:** + +```bash +users=("admin" "root1" "John_Doe" "Alice" "Bob42") +``` + +**Task:** + +* Loop through each username +* Apply the same validation rules as Exercise 3 +* Print whether each username is valid or invalid + +**Concepts practiced:** + +* Array iteration +* Nested loops +* Reusable validation logic + +--- + +### 🧪 Exercise 5 — Algorithm Analysis (Written) + +**Task:** +Explain what happens to execution time if the number of usernames doubles. + +Use: + +* `n` = number of usernames +* `m` = average username length + +**Expected result:** + +``` +T(n, m) = n × m +T(2n, m) = 2 × n × m +Big-O: O(n·m) +``` + +--- + +## 🔐 Security & Sysadmin Perspective + +These exercises reflect real-world Bash usage in: + +* Linux user management +* Input validation scripts +* SSH and access control automation +* Log parsing and monitoring +* Security audits and recon scripts + +Strong validation and predictable runtime are critical for **secure and reliable system scripts**. + +--- + +## ✅ Completion Criteria + +Day 5 is complete when: + +* Exercises 1–4 run correctly in Bash +* Exercise 5 clearly explains runtime scaling +* Scripts follow safe Bash practices (`[[ ]]`, quoting, defensive checks) + +--- + +## 🔜 Next Step + +After Day 5, Week 1 concludes. + +Upcoming: + +* **Week 2:** Data Structures (arrays, maps, sets) +* Stronger algorithm focus +* More security-oriented scripting examples + +--- + +📌 *This README serves as a reference and checklist for Week 1 Day 5 Bash exercises.* diff --git a/week 1/projects/readme.md b/week 1/projects/readme.md new file mode 100644 index 0000000..aa66486 --- /dev/null +++ b/week 1/projects/readme.md @@ -0,0 +1,179 @@ +# 🛠 Bonus Sysadmin Projects — Bash & PowerShell Fundamentals + +This README documents a set of **bonus sysadmin-oriented projects** designed to be completed **after Week 1 and before Week 2**. + +These projects are practical, security-focused, and closely aligned with **real Linux/Windows system administration, automation, and security analysis tasks**. They reinforce core programming concepts (loops, conditionals, validation, algorithms) in both **Bash (Linux)** and **PowerShell (Windows)** environments. + +--- + +## 🎯 Purpose of These Projects + +These bonus projects exist to: + +* Bridge theory → real-world sysadmin work +* Strengthen Bash and PowerShell scripting confidence +* Apply algorithmic thinking to system tasks +* Build habits required for **A+ → CCNA → Security+** paths +* Prepare for Week 2 (Data Structures & Algorithms) + +They simulate tasks performed by: + +* Linux and Windows system administrators +* Security analysts / SOC engineers +* DevOps and cloud engineers +* Blue team / hardening roles + +--- + +## 🧰 Project 1 — User Audit Script + +### Goal + +Audit local users and identify potentially unsafe usernames. + +### Tasks + +* Read usernames from `/etc/passwd` (Linux) or `Get-LocalUser` (PowerShell) +* Extract the username field +* Validate usernames using rules: + + * Letters only + * Length ≤ 20 + * Starts with a letter +* Print only invalid usernames + +### Skills Reinforced + +* File reading / system commands +* Field parsing +* Loops and validation logic +* Defensive system auditing + +--- + +## 🔐 Project 2 — Password Policy Checker (Simulation) + +> ⚠️ No real passwords — this is a simulation exercise + +### Goal + +Validate whether a password string meets a security policy. + +### Tasks + +* Prompt user for a password +* Enforce rules such as: + + * Minimum length (e.g., ≥ 12) + * At least one letter + * At least one digit + * At least one special character +* Output `Strong` or `Weak` + +### Skills Reinforced + +* Multiple counters / flags +* Regex checks +* Early exit logic +* Secure input validation + +--- + +## 📄 Project 3 — Log File Scanner + +### Goal + +Scan a log file for suspicious activity indicators. + +### Tasks + +* Read a log file line by line +* Detect keywords such as: + + * `failed` + * `error` + * `unauthorized` +* Count occurrences of each keyword +* Print a summary report + +### Skills Reinforced + +* File iteration +* Pattern matching +* Counters +* Incident response fundamentals + +--- + +## 🖥 Project 4 — Service Status Monitor + +### Goal + +Verify whether critical system services are running. + +### Tasks + +* Define an array/list of services (e.g., `ssh`, `cron`, `ufw` in Linux; `WinRM`, `wuauserv` in Windows) +* For each service: + + * Check if it is running + * Print `OK` or `NOT RUNNING` + +### Skills Reinforced + +* Arrays / collections +* Command execution and exit code checking +* Automation patterns in Bash and PowerShell + +--- + +## 📊 Project 5 — Algorithm Reflection (Written) + +### Goal + +Build the habit of analyzing performance in real scripts. + +### Tasks + +For **one of the projects above**, answer: + +* What is `n` in this script? +* What is the time complexity? +* What happens if the input doubles? + +### Example + +``` +T(n) = n +T(2n) = 2n +Big-O: O(n) +``` + +--- + +## ✅ Completion Guidelines + +* These projects are **optional but strongly recommended** +* Completing **2–3 projects** is sufficient before Week 2 +* Focus on: + + * Correctness + * Readability + * Defensive coding + * Clear logic +* Implement each project in **both Bash and PowerShell** if possible for dual practice + +--- + +## 🔜 What Comes Next + +After completing the bonus projects: + +* Proceed to **Week 2 — Data Structures & Early Algorithms** +* Arrays, maps, sets +* Searching algorithms +* Clear math explanations with real system examples + +--- + +📌 *These bonus sysadmin projects are designed to turn programming fundamentals into practical Linux and Windows administration and security skills.*