This Repository is a collection of different ethical hacking tools and malware's for penetration testing and research purpose written in python, ruby, rust, c++, go and c.
JavaScript algorithmsartificial-intelligencebugbountycryptographycyber-threat-intelligencecybersecurity-projectsethical-hackinghacking-toolsmalwarenessusnetwork-monitoringnetwork-securitynmapportscannerpythonpythonprojectsthreat-intelligencevirus-scanning
Create traceroute.md
Abdul Wahab Junaid6edb68ff6007
diff --git a/Nmap/Nmap Commands/traceroute.md b/Nmap/Nmap Commands/traceroute.mdnew file mode 100644index 0000000..e126cb4--- /dev/null+++ b/Nmap/Nmap Commands/traceroute.md@@ -0,0 +1,131 @@+**Traceroute** is a network diagnostic tool used to trace the path that packets take from the source to a destination across an IP network. It provides information about the intermediate routers (or hops) between the source and the destination, as well as the response times for each hop.++### How Traceroute Works++1. **TTL Field in IP Header**:+ - Traceroute exploits the **Time to Live (TTL)** field in the IP header.+ - TTL starts as a set value and decreases by 1 at each hop. When TTL reaches 0, the packet is discarded, and an ICMP "Time Exceeded" message is sent back to the source.++2. **Process**:+ - Traceroute sends packets with incrementing TTL values:+ - Packet 1: TTL = 1 (records the first hop).+ - Packet 2: TTL = 2 (records the second hop).+ - Continues until the destination is reached or the TTL limit is exceeded.+ - Each router along the path decrements the TTL and sends an ICMP error message when TTL = 0.++3. **Protocol Used**:+ - **ICMP**: Commonly used on Windows (`tracert` command).+ - **UDP/TCP**: Many traceroute implementations (e.g., Linux) send UDP or TCP packets to avoid being blocked by firewalls that filter ICMP.++4. **Result**:+ - For each TTL value, traceroute records:+ - The IP address or hostname of the router.+ - The round-trip time (RTT) for each probe.++---++### Running Traceroute++1. **Linux/Unix/macOS**:+ - Command:+ ```bash+ traceroute <destination>+ ```+ - Example:+ ```bash+ traceroute example.com+ ```++2. **Windows**:+ - Command:+ ```cmd+ tracert <destination>+ ```+ - Example:+ ```cmd+ tracert example.com+ ```++3. **Using Nmap**:+ - Nmap can include traceroute as part of its scan.+ - Command:+ ```bash+ nmap --traceroute <destination>+ ```++---++### Output of Traceroute++Traceroute displays:+1. **Hop Number**: The position of the router in the path.+2. **Router's IP Address or Hostname**: Information about the intermediate router.+3. **Round-Trip Times (RTT)**: Time taken for the probe packets to reach the hop and return.++**Example Output**:+```plaintext+1 192.168.1.1 (192.168.1.1) 1.123 ms 0.987 ms 1.045 ms+2 10.0.0.1 (10.0.0.1) 2.345 ms 2.456 ms 2.567 ms+3 isp.gateway.net (203.0.113.1) 12.345 ms 12.456 ms 12.567 ms+4 example.com (93.184.216.34) 20.123 ms 20.234 ms 20.345 ms+```++---++### Key Options for Traceroute (Linux)++- **`-n`**: Do not resolve hostnames; display only IP addresses.+ ```bash+ traceroute -n example.com+ ```+- **`-I`**: Use ICMP instead of UDP.+ ```bash+ traceroute -I example.com+ ```+- **`-T`**: Use TCP instead of UDP.+ ```bash+ traceroute -T example.com+ ```+- **`-p <port>`**: Specify the port to send packets.+ ```bash+ traceroute -p 80 example.com+ ```+- **`-m <hops>`**: Set the maximum number of hops.+ ```bash+ traceroute -m 20 example.com+ ```++---++### Use Cases of Traceroute++1. **Troubleshooting Network Issues**:+ - Identify slow or unreachable hops in the network path.+ - Detect bottlenecks and problematic routers.++2. **Mapping Network Paths**:+ - Understand the path packets take through a network.+ - Visualize network topology.++3. **Firewall and Security Checks**:+ - Test which protocols are allowed by intermediate routers.+ - Identify hops where traffic might be filtered or blocked.++---++### Limitations of Traceroute++1. **Firewall Restrictions**:+ - Firewalls may block ICMP or UDP packets, leading to incomplete results.+ - Some routers may silently drop packets or limit TTL-exceeded responses.++2. **Asymmetric Routing**:+ - Traceroute shows only the forward path, not the reverse path. The route back to the source may be different.++3. **Performance Impact**:+ - Repeated probes can temporarily stress intermediate routers, causing inaccurate RTT measurements.++4. **Hidden Hops**:+ - Some routers are configured to suppress ICMP TTL-exceeded responses, causing gaps in traceroute output (e.g., `* * *`).++Traceroute remains a vital tool for network diagnostics, offering insights into routing and connectivity issues in diverse environments.