Build nmap 7.50 for IOS 6.1.3
OS X 10.9.5
Xcode: 5.0.2
IOS SDK: 6.1 (取自Xcode 4.6.3)
編譯資料記錄:
將 xcode 4.6.3: Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk 複製到
xcode 5: Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk
Mac 必須安裝 brew
然後安裝 dpkg 套件
打開終端機將以下代碼貼上:
IOSDEVROOT=$(xcrun --sdk iphoneos --show-sdk-platform-path)/Developer
IOSSDKROOT=$(xcrun --sdk iphoneos6.1 --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
# iOS sdk include copy
MACSDKROOT=$(xcrun --sdk macosx --show-sdk-path)
cp -r $MACSDKROOT/usr/include/net $IOSSDKROOT/usr/include/
cp -r $MACSDKROOT/usr/include/netinet $IOSSDKROOT/usr/include/
cp -r $MACSDKROOT/usr/include/sys/_types $IOSSDKROOT/usr/include/sys/
cp -r $MACSDKROOT/usr/include/i386 $IOSSDKROOT/usr/include/
cp -r $MACSDKROOT/usr/include/libkern/i386 $IOSSDKROOT/usr/include/libkern/i386
cp -r $MACSDKROOT/usr/include/mach/i386 $IOSSDKROOT/usr/include/mach/
# Install openssl-1.0.2l Libs to SDK
wget --no-check-certificate https://github.com/kalifans/Darwin/raw/deb/openssl-1.0.2l.tar
tar vxf openssl-1.0.2l.tar -C $SDKROOT/ wget --no-check-certificate https://nmap.org/dist/nmap-7.50.tar.bz2
tar jxvf nmap-7.50.tar.bz2
cd nmap-7.50 ######### iOS armv7 patch #########
sed -i "" 's/ppc64/armv7/g' configure
sed -i "" 's/-arch x86_64 -arch i386/-arch armv7/g' libpcap/configure.in
sed -i "" 's/-arch x86_64 -arch i386/-arch armv7/g' libpcap/configure # configure for armv7
./configure --host=arm-apple-darwin --target=armv7-apple-darwin --build=armv7-apple-darwin \
--prefix=/usr/local \
--with-libpcap=included \
--with-liblua=included \
--with-openssl=/usr/local/openssl/1.0.2 \
--with-pcap=bpf \
--without-nmap-update --disable-universal --without-zenmap --without-ndiff 手動修改:
* libdnet-stripped/config.status
刪除 ${LIBOBJDIR}memcmp$U.o
* libdnet-stripped/Makefile
刪除 ${LIBOBJDIR}memcmp$U.o
* libpcap/config.h
刪除 #define LBL_ALIGN 1
或改為 /* #undef LBL_ALIGN */ make
make install DESTDIR=nmap-7.50 # Make deb
cat << EOF > DEBIAN/control
Package: nmap
Version: 7.50
Architecture: iphoneos-arm
Maintainer: Debian Security Tools Packaging Team <pkg-security-team@lists.alioth.debian.org>
Installed-Size: 27235
Depends: libpcap, openssl-1.0
Section: net
Priority: extra
Homepage: http://nmap.org/
Description: The Network Mapper
Nmap is a utility for network exploration or security auditing. It
supports ping scanning (determine which hosts are up), many port
scanning techniques, version detection (determine service protocols
and application versions listening behind ports), and TCP/IP
fingerprinting (remote host OS or device identification). Nmap also
offers flexible target and port specification, decoy/stealth scanning,
sunRPC scanning, and more. Most Unix and Windows platforms are
supported in both GUI and commandline modes. Several popular handheld
devices are also supported, including the Sharp Zaurus and the iPAQ.
EOF dpkg-deb --build --uniform-compression -Zgzip nmap-7.50 nmap_7.50_iphoneos-arm.deb
完成品
https://github.com/kalifans/Darwin/raw/deb/nmap_7.50_iphoneos-arm.deb
依賴 openssl 1.0.2
https://github.com/kalifans/Darwin/blob/deb/openssl-1.0_1.0.2l_iphoneos-arm.deb
手機必須越獄,並使用cydia安裝 openssh 套件
IOS安裝apt套件方法: https://raw.githubusercontent.com/kalifans/Darwin/IOS/APT.For.IOS.txt
手機連接WIFI 在Mac打開終端機
上傳 nmap_7.50_iphoneos-arm.deb 到手機
scp nmap_7.50_iphoneos-arm.deb root@手機IP:/tmp/ 使用ssh登入IOS
ssh root@手機IP 安裝nmap
cd /tmp
dpkg -i nmap_7.50-1_iphoneos-arm.deb
apt-get install -f
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)