[原创] Build netcat for MacOS / iOS
发表于:
2017-7-20 08:51
4299
[原创] Build netcat for MacOS / iOS
Build netcat for MacOS / iOS
##############################
### Download Source
##############################
wget http://http.debian.net/debian/pool/main/n/netcat/netcat_1.10.orig.tar.bz2
wget http://http.debian.net/debian/pool/main/n/netcat/netcat_1.10-41.1.debian.tar.xz
tar jxvf netcat_1.10.orig.tar.bz2
tar Jxvf netcat_1.10-41.1.debian.tar.xz
##############################
### Patch
##############################
patch -p0 -i debian/patches/unstripped.patch
patch -p0 -i debian/patches/glibc-resolv-h.patch
patch -p0 -i debian/patches/arm-timer.patch
patch -p0 -i debian/patches/posix-setjmp.patch
patch -p0 -i debian/patches/no-sleep-punt.patch
patch -p0 -i debian/patches/single-verbose.patch
patch -p0 -i debian/patches/use-getservbyport.patch
patch -p0 -i debian/patches/read-overflow.patch
patch -p0 -i debian/patches/inet-aton.patch
patch -p0 -i debian/patches/udp-broadcast.patch
patch -p0 -i debian/patches/quit.patch
patch -p0 -i debian/patches/dash-port.patch
patch -p0 -i debian/patches/sh-c.patch
patch -p0 -i debian/patches/tos.patch
patch -p0 -i debian/patches/rservice-buf.patch
patch -p0 -i debian/patches/so-keepalive.patch
patch -p0 -i debian/patches/nodup-stderr.patch
patch -p0 -i debian/patches/help-exit-failure.patch
patch -p0 -i debian/patches/darwin-ipproto.patch
patch -p0 -i debian/patches/select-nfds.patch
patch -p0 -i debian/patches/proxy-doc.patch
patch -p0 -i debian/patches/655881-Makefile-LDFLAGS.patch
patch -p0 -i debian/patches/655881-netcat.c.format.patch
patch -p0 -i debian/patches/545579-send-crlf.patch
patch -p0 -i debian/patches/no-static.patch sed -i "" 's/" DEBIAN_VERSION "/1.10/g' netcat-1.10.orig/netcat.c
sed -i "" '/CC =/d' netcat-1.10.orig/Makefile sed -i "" '/define GENERIC_H/a \
\
#define GAPING_SECURITY_HOLE \
#define TELNET \
' netcat-1.10.orig/generic.h
##############################
### mac
##############################
cd netcat-1.10.orig
make nc
##############################
### ios armv7
##############################
cd netcat-1.10.orig DEVROOT=$(xcrun --sdk iphoneos --show-sdk-platform-path)/Developer
IOSSDKROOT=$(xcrun --sdk iphoneos --show-sdk-path)
export SDKROOT=$IOSSDKROOT
export CC="$(xcrun -f gcc) -arch armv7"
export CXX="$(xcrun -f g++) -arch armv7"
export LD=$DEVROOT/usr/bin/ld
export AR=$DEVROOT/usr/bin/ar
export AS=$DEVROOT/usr/bin/as
export NM=$DEVROOT/usr/bin/nm
export RANLIB=$DEVROOT/usr/bin/ranlib
export CFLAGS="-I$SDKROOT/usr/include/ -arch armv7"
export LDFLAGS="-L$SDKROOT/usr/lib/ -arch armv7"
export CPPFLAGS=$CFLAGS
export CXXFLAGS=$CFLAGS make nc or
$CC $(CFLAGS) -s -o nc netcat.c
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课