From 079793078fb6880608f8893b5543cdf3521057a2 Mon Sep 17 00:00:00 2001 From: trimstray Date: Fri, 11 Jan 2019 11:37:42 +0100 Subject: [PATCH] #53 - added nmap header to TOC; updated ssh examples - signed-off-by: trimstray --- README.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/README.md b/README.md index 51263b7..8474bae 100644 --- a/README.md +++ b/README.md @@ -864,6 +864,7 @@ Linux Security Expert - trainings, howtos, checklists, security tools an * [tcpick](#tool-tcpick) * [ngrep](#tool-ngrep) * [hping3](#tool-hping3) + * [nmap](#tool-nmap) * [netcat](#tool-netcat) * [socat](#tool-socat) * [lsof](#tool-lsof) @@ -1774,6 +1775,42 @@ function _scg() { ssh -tt user@host bash ``` +###### SSH local port forwarding + +Example 1: + +```bash +# Forwarding our local 2250 port to nmap.org:443 from localhost through localhost +host1> ssh -L 2250:nmap.org:443 localhost + +# Connect to the service: +host1> curl -Iks --location -X GET https://localhost:2250 +``` + +Example 2: + +```bash +# Forwarding our local 9051 port to db.d.x:5432 from localhost through node.d.y +host1> ssh -nNT -L 9051:db.d.x:5432 node.d.y + +# Connect to the service: +host1> psql -U db_user -d db_dev -p 9051 -h localhost +``` + + * `-n` - redirects stdin from `/dev/null` + * `-N` - do not execute a remote command + * `-T` - disable pseudo-terminal allocation + +###### SSH remote port forwarding + +```bash +# Forwarding our local 9051 port to db.d.x:5432 from host2 through node.d.y +host1> ssh -nNT -R 9051:db.d.x:5432 node.d.y + +# Connect to the service: +host2> psql -U postgres -d postgres -p 8000 -h localhost +``` + ___ ##### Tool: [linux-dev](https://www.tldp.org/LDP/abs/html/devref1.html)