精华内容
下载资源
问答
  • linux nc

    2016-08-29 17:00:15
    nc cmd linux

    man nc

    nc -h
    OpenBSD netcat (Debian patchlevel 1.105-7ubuntu1)
    This is nc from the netcat-openbsd package. An alternative nc is available
    in the netcat-traditional package.
    usage: nc [-46bCDdhjklnrStUuvZz] [-I length] [-i interval] [-O length]
          [-P proxy_username] [-p source_port] [-q seconds] [-s source]
          [-T toskeyword] [-V rtable] [-w timeout] [-X proxy_protocol]
          [-x proxy_address[:port]] [destination] [port]
        Command Summary:
            -4      Use IPv4
            -6      Use IPv6
            -b      Allow broadcast
            -C      Send CRLF as line-ending
            -D      Enable the debug socket option
            -d      Detach from stdin
            -h      This help text
            -I length   TCP receive buffer length
            -i secs     Delay interval for lines sent, ports scanned
            -j      Use jumbo frame
            -k      Keep inbound sockets open for multiple connects
            -l      Listen mode, for inbound connects
            -n      Suppress name/port resolutions
            -O length   TCP send buffer length
            -P proxyuser    Username for proxy authentication
            -p port     Specify local port for remote connects
                -q secs     quit after EOF on stdin and delay of secs
            -r      Randomize remote ports
            -S      Enable the TCP MD5 signature option
            -s addr     Local source address
            -T toskeyword   Set IP Type of Service
            -t      Answer TELNET negotiation
            -U      Use UNIX domain socket
            -u      UDP mode
            -V rtable   Specify alternate routing table
            -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      DCCP mode
            -z      Zero-I/O mode [used for scanning]
        Port numbers can be individual or ranges: lo-hi [inclusive]

    功能应用

    1、远程拷贝文件
    从服务器server-A拷贝文件到服务器server-B上。需要先在server-B上,用nc激活监听,server-B上运行:

    [root@server-B ~]# nc -lp 5678 > test.txt

    server-A上运行:

    [root@server-A ~]# ll test.txt
    -rw-r--r--   1 root root 39693 829  2016 test.txt
    [root@server-A ~]# nc -w 1 192.168.228.222 1234 < test.txt

    2、nc复制或者实现其他功能其实都是利用服务器监听的是同一台机器的唯一的端口,数据都放到这个端口,固然数据就会从这里展示出,其实也类似管道的作用,依赖的方式不同罢了。

    展开全文
  • Linux nc

    2019-11-07 11:53:30
    netcat 1.tcp/udp端口监听,server 2.端口扫描,client 3.机器间传输文件 ...nc -l 20000 # client端 连接server的端口,发送消息 nc 192.168.1.1 20000 文件传输 # server端 监听20000端口,并输入文件f...

    netcat

    1.tcp/udp端口监听,server
    2.端口扫描,client
    3.机器间传输文件
    4.机器间测试网速

    #socket 同喜

    # server端 监听20000端口,任何发送过来的消息都会被显示
    nc -l 20000
    # client端 连接server的端口,发送消息
    nc 192.168.1.1 20000
    

    文件传输

    # server端 监听20000端口,并输入文件file.txt,任何连接到该端口的,都会受到file.txt
    nc -l 20000 < file.txt
    # client端,连接server2000端口,并将发送来的内容从定向到file.txt
    nc 192.168.1.1 20000 > file.txt
    
    # 与上述例子相反
    nc -l 20000 > file.txt
    nc 192.168.1.2 20000 < file.txt
    
    # 压缩文件传输
    tar -cvf – dir_name | nc -l 20000
    nc 192.168.1.1 20000 | tar -xvf -
    
    # 执行shell
    # server端 连接成功时执行shell
    nc -l 20000 -e /bin/bash -i
    # client
    nc 192.168.1.1 20000
    

    参考:
    https://blog.csdn.net/u012486730/article/details/82019996
    https://www.cnblogs.com/jnxb/p/3940593.html

    展开全文

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 3,813
精华内容 1,525
关键字:

linuxnc

linux 订阅