本文主要是介绍linux nc工具在linux7与linux5,6的参数-w 变化,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
linux nc工具在linux7与linux5,6的参数 -w变化
1.nc 在linux5,6 参数说明
nc -h
usage: nc [-46DdhklnrStUuvzC] [-i interval] [-p source_port]
[-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_version]
[-x proxy_address[:port]] [hostname] [port[s]]
Command Summary:
-4 Use IPv4
-6 Use IPv6
-D Enable the debug socket option
-d Detach from stdin
-h This help text
-i secs Delay interval for lines sent, ports scanned
-k Keep inbound sockets open for multiple connects
-l Listen mode, for inbound connects
-n Suppress name/port resolutions
-p port Specify local port for remote connects
-r Randomize remote ports
-S Enable the TCP MD5 signature option
-s addr Local source address
-T ToS Set IP Type of Service
-C Send CRLF as line-ending
-t Answer TELNET negotiation
-U Use UNIX domain socket
-u UDP mode
-v Verbose
-w secs Timeout for connects and final net reads
-X proto Proxy protocol: "4", "5" (SOCKS) or "connect"
-x addr[:port] Specify proxy address and port
-z Zero-I/O mode [used for scanning]
在linux5,6中nc 命令来自
[root@skyvis03 ~]# rpm -qf /usr/bin/nc
nc-1.84-24.el6.x86_64
nc命令监听一个端口例如:
nc localhost 3306
默认10秒无操作会自动退出
nc -w 3 localhost 3306
3秒无操作,则自动退出
但是当
nc -w 30 localhost 3306 时,还是默认10秒退出
nc 在linux7 中的参数说明
[root@mail ~]# nc -h
Ncat 7.50 ( https://nmap.org/ncat )
Usage: ncat [options] [hostname] [port]
Options taking a time assume seconds. Append 'ms' for milliseconds,
's' for seconds, 'm' for minutes, or 'h' for hours (e.g. 500ms).
-4 Use IPv4 only
-6 Use IPv6 only
-U, --unixsock Use Unix domain sockets only
-C, --crlf Use CRLF for EOL sequence
-c, --sh-exec <command> Executes the given command via /bin/sh
-e, --exec <command> Executes the given command
--lua-exec <filename> Executes the given Lua script
-g hop1[,hop2,...] Loose source routing hop points (8 max)
-G <n> Loose source routing hop pointer (4, 8, 12, ...)
-m, --max-conns <n> Maximum <n> simultaneous connections
-h, --help Display this help screen
-d, --delay <time> Wait between read/writes
-o, --output <filename> Dump session data to a file
-x, --hex-dump <filename> Dump session data as hex to a file
-i, --idle-timeout <time> Idle read/write timeout
-p, --source-port port Specify source port to use
-s, --source addr Specify source address to use (doesn't affect -l)
-l, --listen Bind and listen for incoming connections
-k, --keep-open Accept multiple connections in listen mode
-n, --nodns Do not resolve hostnames via DNS
-t, --telnet Answer Telnet negotiations
-u, --udp Use UDP instead of default TCP
--sctp Use SCTP instead of default TCP
-v, --verbose Set verbosity level (can be used several times)
-w, --wait <time> Connect timeout
-z Zero-I/O mode, report connection status only
--append-output Append rather than clobber specified output files
--send-only Only send data, ignoring received; quit on EOF
--recv-only Only receive data, never send anything
--allow Allow only given hosts to connect to Ncat
--allowfile A file of hosts allowed to connect to Ncat
--deny Deny given hosts from connecting to Ncat
--denyfile A file of hosts denied from connecting to Ncat
--broker Enable Ncat's connection brokering mode
--chat Start a simple Ncat chat server
--proxy <addr[:port]> Specify address of host to proxy through
--proxy-type <type> Specify proxy type ("http" or "socks4" or "socks5")
--proxy-auth <auth> Authenticate with HTTP or SOCKS proxy server
--ssl Connect or listen with SSL
--ssl-cert Specify SSL certificate file (PEM) for listening
--ssl-key Specify SSL private key (PEM) for listening
--ssl-verify Verify trust and domain name of certificates
--ssl-trustfile PEM file containing trusted SSL certificates
--ssl-ciphers Cipherlist containing SSL ciphers to use
--version Display Ncat's version information and exit
在linux7中nc命令来自
[root@mail ~]# rpm -qf /usr/bin/nc
nmap-ncat-6.40-19.el7.x86_64
nc localhost 3306
默认nc 不会自动中断
nc -w 3 localhost 3306
也不会自动中断
linux 7中nc -i
-i, --idle-timeout <time> Idle read/write timeout
nc -i 3 localhost 3306
[root@mail ~]# nc -i 3 142.0.2.17 3306
N
5.7.26-log?%92N/??CL*fC)`E%Q;mysql_native_passwordNcat: Idle timeout expired (3000 ms).
[root@mail ~]#
linux7 中 -d 参数取代 linux5,6 -i 参数
nmap-ncat 版本的-i 参数存在问题 是用-i 参数后发现
echo $?
是1
这篇关于linux nc工具在linux7与linux5,6的参数-w 变化的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!