2021-02-01 21:35:56 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
2023-03-07 20:34:23 +00:00
|
|
|
, fetchpatch
|
2021-02-01 21:35:56 +00:00
|
|
|
, installShellFiles
|
|
|
|
, makeWrapper
|
|
|
|
, libpcap
|
|
|
|
}:
|
2017-02-04 17:10:37 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "masscan";
|
2021-02-01 21:14:53 +00:00
|
|
|
version = "1.3.2";
|
2017-02-04 17:10:37 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2021-01-27 07:22:20 +00:00
|
|
|
owner = "robertdavidgraham";
|
|
|
|
repo = "masscan";
|
|
|
|
rev = version;
|
2021-02-01 21:14:53 +00:00
|
|
|
sha256 = "sha256-mnGC/moQANloR5ODwRjzJzBa55OEZ9QU+9WpAHxQE/g=";
|
2017-02-04 17:10:37 +00:00
|
|
|
};
|
|
|
|
|
2023-03-07 20:34:23 +00:00
|
|
|
patches = [
|
|
|
|
# Patches the missing "--resume" functionality
|
|
|
|
(fetchpatch {
|
|
|
|
name = "resume.patch";
|
|
|
|
url = "https://github.com/robertdavidgraham/masscan/commit/90791550bbdfac8905917a109ed74024161f14b3.patch";
|
|
|
|
sha256 = "sha256-A7Fk3MBNxaad69MrUYg7fdMG77wba5iESDTIRigYslw=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-11-19 19:57:28 +00:00
|
|
|
postPatch = lib.optionalString stdenv.isDarwin ''
|
|
|
|
# Fix broken install command
|
|
|
|
substituteInPlace Makefile --replace "-pm755" "-pDm755"
|
|
|
|
'';
|
|
|
|
|
2021-02-01 21:35:56 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper installShellFiles ];
|
2017-02-04 17:10:37 +00:00
|
|
|
|
2021-09-29 07:36:13 +00:00
|
|
|
makeFlags = [
|
|
|
|
"PREFIX=$(out)"
|
|
|
|
"GITVER=${version}"
|
|
|
|
"CC=${stdenv.cc.targetPrefix}cc"
|
|
|
|
];
|
2018-03-21 20:42:06 +00:00
|
|
|
|
2021-09-29 07:36:13 +00:00
|
|
|
enableParallelBuilding = true;
|
2017-02-04 17:10:37 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
2021-09-29 07:36:13 +00:00
|
|
|
installManPage doc/masscan.?
|
|
|
|
|
|
|
|
install -Dm444 -t $out/etc/masscan data/exclude.conf
|
|
|
|
install -Dm444 -t $out/share/doc/masscan doc/*.{html,js,md}
|
|
|
|
install -Dm444 -t $out/share/licenses/masscan LICENSE
|
2021-02-01 21:35:56 +00:00
|
|
|
|
2021-09-29 07:36:13 +00:00
|
|
|
wrapProgram $out/bin/masscan \
|
|
|
|
--prefix LD_LIBRARY_PATH : "${libpcap}/lib"
|
|
|
|
'';
|
2017-02-04 17:10:37 +00:00
|
|
|
|
2021-09-29 07:36:13 +00:00
|
|
|
doInstallCheck = true;
|
2017-11-05 17:15:53 +00:00
|
|
|
|
2021-09-29 07:36:13 +00:00
|
|
|
installCheckPhase = ''
|
|
|
|
$out/bin/masscan --selftest
|
2017-02-04 17:10:37 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2017-02-04 17:10:37 +00:00
|
|
|
description = "Fast scan of the Internet";
|
2024-03-19 02:14:51 +00:00
|
|
|
mainProgram = "masscan";
|
2021-01-27 07:22:20 +00:00
|
|
|
homepage = "https://github.com/robertdavidgraham/masscan";
|
|
|
|
changelog = "https://github.com/robertdavidgraham/masscan/releases/tag/${version}";
|
|
|
|
license = licenses.agpl3Only;
|
|
|
|
platforms = platforms.unix;
|
2017-02-04 17:10:37 +00:00
|
|
|
maintainers = with maintainers; [ rnhmjoj ];
|
|
|
|
};
|
|
|
|
}
|