Added GitHub Actions and updated build framework
This commit is contained in:
parent
1f9bc44c60
commit
2e95cb4f0f
23 changed files with 1065 additions and 31 deletions
package/targets/nmap
63
package/targets/nmap/package.sh
Executable file
63
package/targets/nmap/package.sh
Executable file
|
@ -0,0 +1,63 @@
|
|||
#!/bin/bash
|
||||
set -x
|
||||
if [ $# -lt 2 ];then
|
||||
echo "Usage: ${0} <output directory> <arch>" >&2
|
||||
echo "Example: ${0} /output x86_64" >&2
|
||||
exit 2
|
||||
fi
|
||||
output_dir=$1
|
||||
arch=$2
|
||||
tmp_dir=$(mktemp -dt packaging.XXXXXX)
|
||||
trap exit_script EXIT TERM
|
||||
|
||||
if [ ! -d "$output_dir" ];then
|
||||
echo "Invalid directory ${output_dir}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit_script(){
|
||||
rm -rf "$tmp_dir"
|
||||
}
|
||||
|
||||
echo "tmp_dir: ${tmp_dir}"
|
||||
|
||||
version=""
|
||||
|
||||
for f in $(ls "$output_dir");do
|
||||
case "$f" in
|
||||
nmap-data*)
|
||||
mv "${output_dir}/${f}" "${tmp_dir}/data"
|
||||
;;
|
||||
nmap*)
|
||||
mv "${output_dir}/${f}" "${tmp_dir}/nmap"
|
||||
version=${f//nmap-/}
|
||||
;;
|
||||
nping*)
|
||||
mv "${output_dir}/${f}" "${tmp_dir}/nping"
|
||||
;;
|
||||
ncat*)
|
||||
mv "${output_dir}/${f}" "${tmp_dir}/ncat"
|
||||
;;
|
||||
*)
|
||||
echo "This file should not be there: ${output_dir}/${f}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ ! -d /packaged ];then
|
||||
mkdir /packaged
|
||||
fi
|
||||
cp $GITHUB_WORKSPACE/package/targets/nmap/run-nmap.sh "$tmp_dir"
|
||||
cd "$tmp_dir"
|
||||
|
||||
TARBALL="nmap-${version}-${arch}-portable.tar.gz"
|
||||
tar czf "${output}/${TARBALL}" -C "$tmp_dir" .
|
||||
cp "${output}/${TARBALL}" /packaged
|
||||
echo ::set-output name=PACKAGED_TARBALL::${TARBALL}
|
||||
echo ::set-output name=PACKAGED_TARBALL_PATH::"/packaged/${TARBALL}"
|
||||
|
||||
ZIP="nmap-${version}-${arch}-portable.zip"
|
||||
zip -r -q "${output}/${ZIP}" .
|
||||
cp "${output}/${ZIP}" /packaged
|
||||
echo ::set-output name=PACKAGED_ZIP::${ZIP}
|
||||
echo ::set-output name=PACKAGED_ZIP_PATH::"/packaged/${ZIP}"
|
3
package/targets/nmap/run-nmap.ps1
Normal file
3
package/targets/nmap/run-nmap.ps1
Normal file
|
@ -0,0 +1,3 @@
|
|||
$allArgs = $PsBoundParameters.Values + $args
|
||||
$env:NMAPDIR = "data"
|
||||
.\nmap.exe $allArgs
|
4
package/targets/nmap/run-nmap.sh
Executable file
4
package/targets/nmap/run-nmap.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
SCRIPT_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
NMAPDIR="$SCRIPT_DIR/data" "$SCRIPT_DIR/nmap" $@
|
Loading…
Add table
Add a link
Reference in a new issue