🌐 Networking & Curl Toolkit

Curl GET Request

# Simple GET request
curl https://www.google.com/

Curl POST Requests

# Send form data
curl -X POST https://example-webhook.com/your-id -d "data1=value1&data2=value2"

# Send JSON data
curl -X POST -H "Content-Type: application/json" \
https://example-webhook.com/your-id \
-d '{"key1":"value1","key2":"value2"}'

# Upload a file/image
curl -X POST https://example-webhook.com/your-id -F "file=@image.jpg"

Advanced Curl

# Add Authorization header
curl -H "Authorization: Bearer YOUR_API_TOKEN" https://api.example.com/data

# Post to an IoT feed (e.g., Adafruit IO)
curl -H "X-AIO-Key: YOUR_AIO_KEY" \
  -F "value=on" \
  https://io.adafruit.com/api/v2/YOUR_USERNAME/feeds/YOUR_FEED/data

# Save output to file
curl -o file.html https://example.com

# Download file with same name
curl -O https://example.com/file.zip

# Show only headers
curl -I https://example.com

# Verbose (debugging)
curl -v https://example.com

Webhook Testing

# Steps:
# 1. Go to https://webhook.site
# 2. Copy your unique URL
# 3. Send requests using curl

# Example POST test
curl -X POST https://webhook.site/your-unique-id -d "test=hello"

MQTT with Curl

# Subscribe to topic
curl mqtt://mqtt.eclipseprojects.io/topic_name

# Force output to terminal
curl mqtt://mqtt.eclipseprojects.io/topic_name --output -

# Save messages to file
curl mqtt://mqtt.eclipseprojects.io/topic_name --output data.txt

# Publish message
curl -d "Hello" mqtt://mqtt.eclipseprojects.io/topic_name
📖 Full MQTT documentation: https://curl.se/docs/mqtt.html

Time API

# Get current time (Kolkata timezone)
curl "https://timeapi.io/api/Time/current/zone?timeZone=Asia/Kolkata"

FTP Upload

# Upload file to FTP server
curl -k -T file.jpg ftp://USERNAME:PASSWORD@ftp.example.com/htdocs/uploads/

# Access uploaded files (paste in Windows File Explorer address bar)
# ftp://USERNAME:PASSWORD@ftp.example.com/htdocs/
💡 Replace USERNAME, PASSWORD, and ftp.example.com with your actual FTP credentials.

Nmap

🔧 Installation (Windows): Download from nmap.org/download.html → Run the .exe installer → ✅ Check "Add Nmap to PATH"
# Basic scan
nmap google.com

# Scan specific ports
nmap -p 22,80,443 192.168.1.1

# Scan all ports
nmap -p 1-65535 192.168.1.1

# Detect OS
nmap -O 192.168.1.1

PowerShell Test-NetConnection

✅ Built-in PowerShell utility — no installation required.
# Ping test
Test-NetConnection google.com

# Test HTTPS port
Test-NetConnection google.com -Port 443

# Trace route
Test-NetConnection google.com -TraceRoute

# Check RDP port (Remote Desktop)
Test-NetConnection -ComputerName 192.168.1.10 -Port 3389

# Check SMB port (file sharing)
Test-NetConnection -ComputerName 192.168.1.20 -Port 445

Trace Route

# Trace network path
tracert google.com

OpenSSL

# Test SSL connection
openssl s_client -connect example.com:443

# View SMTP certificates (shows full chain)
openssl s_client -showcerts -connect smtp.example.com:587 <NUL -starttls smtp

# Extract certificate to PEM
openssl s_client -showcerts -connect api.example.com:443 <NUL | openssl x509 -outform PEM > cert.pem
📌 Certificate chain explained:

1. Leaf cert — Proves the server's identity
2. Intermediate cert — Trusted middleman linking the server cert to a root
3. Root cert — Ultimate trust anchor; already trusted by your OS/browser

SSH – Secure Shell

# Connect to a remote machine
ssh username@hostname

# Connect to a Raspberry Pi
ssh pi@192.168.0.100
ssh pi@raspberrypi

# Execute a remote command and exit
ssh user@host "ls -l"
⚙️ How remote commands work: SSH logs in → executes the command → returns output → exits automatically.

SCP – Secure File Transfer

# Copy local file to remote machine
scp file.txt user@host:/remote/path/

# Copy file from remote to local
scp user@host:/remote/path/file.txt .

# Copy entire directory recursively
scp -r local-folder/ user@host:/remote/path/

📎 Quick Reference

Tool Purpose
curlHTTP/HTTPS/FTP/MQTT requests from the terminal
nmapNetwork scanning and port discovery
Test-NetConnectionPowerShell ping, port test, and traceroute
tracertTrace the network route to a host
opensslInspect and test SSL/TLS certificates
sshSecure remote shell access
scpSecure file transfer over SSH