From 8114f7c07560235fb33d4748a64a78a270215f9c Mon Sep 17 00:00:00 2001 From: yutent Date: Mon, 2 Dec 2024 14:36:12 +0800 Subject: [PATCH] add naabu --- naabu/package.sh | 77 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100755 naabu/package.sh diff --git a/naabu/package.sh b/naabu/package.sh new file mode 100755 index 0000000..bba2e4d --- /dev/null +++ b/naabu/package.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +app_name="naabu" +tmp_dir="/tmp/${app_name}_tmp" +version="2.3.3" +release="v${version}" +pkg_arch="x64" +deb_arch="amd64" + + + +deb_url="https://github.com/projectdiscovery/naabu/releases/download/${release}/naabu_${version}_linux_amd64.zip" + +# 创建临时目录, 用于下载官方包 +if [ -d $tmp_dir ]; then + rm -rf $tmp_dir +fi + +if [ -d "./unpack" ]; then + sudo rm -rf ./unpack +fi + +if [ -f "./${app_name}_${version}.deb" ]; then + rm "./${app_name}_${version}.deb" +fi + +mkdir $tmp_dir + +# 创建临时待打包目录 +echo "创建待打包目录..." +mkdir -p "./unpack/DEBIAN" +mkdir -p "./unpack/usr/bin" + +echo "下载官方原包..." +wget $deb_url -O "${tmp_dir}/${app_name}-linux-${pkg_arch}.zip" + + +echo "下载完成, 解包中..." +unzip "${tmp_dir}/${app_name}-linux-${pkg_arch}.zip" -d $tmp_dir + +echo "解包完成, 复制到待打包目录..." +mv ${tmp_dir}/${app_name} "./unpack/usr/bin/" + +rm -rf $tmp_dir + + +echo "复制完成, 计算文件md5..." + +cd ./unpack + +find usr/ -type f | xargs md5sum > DEBIAN/md5sums + +IFS=$'\t' read -ra size <<< "$(du -d 0)" + +echo """ +Package: ${app_name} +Version: ${version} +Section: devlop +Installed-Size: ${size[0]} +Architecture: ${deb_arch} +Maintainer: Yutent +Priority: optional +Homepage: https://github.com/projectdiscovery/naabu +Description: Naabu is a port scanning tool written in Go that allows you to enumerate valid ports for hosts in a fast and reliable manner. + A fast port scanner written in go with a focus on reliability and simplicity. Designed to be used in combination with other tools for attack surface discovery in bug bounties and pentests + +""" > DEBIAN/control + +echo '计算文件md5完成, 打包中...' + +cd .. +sudo chown -R root:root unpack + +dpkg-deb -b ./unpack "./${app_name}-${deb_arch}_${version}.deb" + +sudo rm -rf ./unpack +echo "打包完成 :)"