源码安装natcat

下载源码包:http://netcat.sourceforge.net/download.php

# tar -xzvf netcat-0.7.1.tar.gz
[root@znode02 netcat-0.7.1]# ls
ABOUT-NLS   config.guess  configure     INSTALL     Makefile.am    NEWS    TODO
aclocal.m4  config.h.in   configure.ac  install-sh  Makefile.in    po
AUTHORS     config.rpath  COPYING       lib         missing        README
ChangeLog   config.sub    doc           m4          mkinstalldirs  src
# mkdir /apps
# ./configure --prefix=/apps/nc
[root@znode02 netcat-0.7.1]# ls
ABOUT-NLS     config.h       config.sub    INSTALL     Makefile.am    po
aclocal.m4    config.h.in    configure     install-sh  Makefile.in    README
AUTHORS       config.log     configure.ac  lib         missing        src
ChangeLog     config.rpath   COPYING       m4          mkinstalldirs  stamp-h1
config.guess  config.status  doc           Makefile    NEWS           TODO
]# make && make install
# tree /apps/nc
/apps/nc
├── bin
│   ├── nc -> netcat
│   └── netcat
├── info
│   ├── dir
│   └── netcat.info
├── man
│   └── man1
│       └── netcat.1
└── share
    └── locale
        ├── it
        │   └── LC_MESSAGES
        │       └── netcat.mo
        └── sk
            └── LC_MESSAGES
                └── netcat.mo

10 directories, 7 files

增加环境变量:

# cat /root/.bash_profile 
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin
NC=/apps/nc
PATH=$PATH:$NC/bin
export PATH
# source ~/.bash_profile

验证:

# nc -h
GNU netcat 0.7.1, a rewrite of the famous networking tool.
Basic usages:
connect to somewhere:  nc [options] hostname port [port] ...
listen for inbound:    nc -l -p port [options] [hostname] [port] ...
tunnel to somewhere:   nc -L hostname:port -p port [options]

Mandatory arguments to long options are mandatory for short options too.
Options:
  -c, --close                close connection on EOF from stdin
  -e, --exec=PROGRAM         program to exec after connect
  -g, --gateway=LIST         source-routing hop point[s], up to 8
  -G, --pointer=NUM          source-routing pointer: 4, 8, 12, ...
  -h, --help                 display this help and exit
  -i, --interval=SECS        delay interval for lines sent, ports scanned
  -l, --listen               listen mode, for inbound connects
  -L, --tunnel=ADDRESS:PORT  forward local port to remote address
  -n, --dont-resolve         numeric-only IP addresses, no DNS
  -o, --output=FILE          output hexdump traffic to FILE (implies -x)
  -p, --local-port=NUM       local port number
  -r, --randomize            randomize local and remote ports
  -s, --source=ADDRESS       local source address (ip or hostname)
  -t, --tcp                  TCP mode (default)
  -T, --telnet               answer using TELNET negotiation
  -u, --udp                  UDP mode
  -v, --verbose              verbose (use twice to be more verbose)
  -V, --version              output version information and exit
  -x, --hexdump              hexdump incoming and outgoing traffic
  -w, --wait=SECS            timeout for connects and final net reads
  -z, --zero                 zero-I/O mode (used for scanning)

Remote port number can also be specified as range.  Example: '1-1024'
原文地址:https://www.cnblogs.com/bass6/p/6359960.html