2021-02-08 16:49:25 +00:00
|
|
|
{ lib, stdenv, fetchurl, jre, runtimeShell }:
|
2016-01-09 04:00:29 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "zap";
|
2021-12-11 19:02:15 +00:00
|
|
|
version = "2.11.1";
|
2021-02-08 16:49:25 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/zaproxy/zaproxy/releases/download/v${version}/ZAP_${version}_Linux.tar.gz";
|
2021-12-11 19:02:15 +00:00
|
|
|
sha256 = "0b1qqrjm4m76djy0az9hnz3rqpz1qkql4faqmi7gkx33b1p6d0sz";
|
2016-01-09 04:00:29 +00:00
|
|
|
};
|
|
|
|
|
2021-02-08 16:49:25 +00:00
|
|
|
buildInputs = [ jre ];
|
2016-01-09 04:00:29 +00:00
|
|
|
|
2021-02-08 16:49:25 +00:00
|
|
|
# From https://github.com/zaproxy/zaproxy/blob/master/zap/src/main/java/org/parosproxy/paros/Constant.java
|
|
|
|
version_tag = "2010000";
|
2016-01-09 04:00:29 +00:00
|
|
|
|
2021-02-08 16:49:25 +00:00
|
|
|
# Copying config and adding version tag before first use to avoid permission
|
|
|
|
# issues if zap tries to copy config on it's own.
|
2016-01-09 04:00:29 +00:00
|
|
|
installPhase = ''
|
2021-02-08 16:49:25 +00:00
|
|
|
mkdir -p "$out/bin" "$out/share"
|
|
|
|
cp -pR . "$out/share/${pname}/"
|
|
|
|
|
|
|
|
cat >> "$out/bin/${pname}" << EOF
|
|
|
|
#!${runtimeShell}
|
|
|
|
export PATH="${lib.makeBinPath [ jre ]}:\$PATH"
|
|
|
|
export JAVA_HOME='${jre}'
|
|
|
|
if ! [ -f "~/.ZAP/config.xml" ];then
|
|
|
|
mkdir -p "\$HOME/.ZAP"
|
|
|
|
head -n 2 $out/share/${pname}/xml/config.xml > "\$HOME/.ZAP/config.xml"
|
|
|
|
echo "<version>${version_tag}</version>" >> "\$HOME/.ZAP/config.xml"
|
|
|
|
tail -n +3 $out/share/${pname}/xml/config.xml >> "\$HOME/.ZAP/config.xml"
|
|
|
|
fi
|
|
|
|
exec "$out/share/${pname}/zap.sh" "\$@"
|
|
|
|
EOF
|
|
|
|
|
|
|
|
chmod u+x "$out/bin/${pname}"
|
2016-01-09 04:00:29 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://www.owasp.org/index.php/ZAP";
|
2016-01-09 04:00:29 +00:00
|
|
|
description = "Java application for web penetration testing";
|
2019-02-26 11:45:54 +00:00
|
|
|
maintainers = with maintainers; [ mog ];
|
2016-01-09 04:00:29 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
license = licenses.asl20;
|
|
|
|
};
|
|
|
|
}
|