6e8f7f9592
https://github.com/Pennyw0rth/NetExec/releases/tag/v1.5.1 Fixes https://github.com/NixOS/nixpkgs/issues/494755 / CVE-2026-27884
119 lines
3.2 KiB
Nix
119 lines
3.2 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchFromGitHub,
|
|
python312,
|
|
writableTmpDirAsHomeHook,
|
|
}:
|
|
let
|
|
python = python312.override {
|
|
self = python;
|
|
packageOverrides = self: super: {
|
|
impacket = super.impacket.overridePythonAttrs {
|
|
version = "0.14.0-unstable-2025-12-03";
|
|
src = fetchFromGitHub {
|
|
owner = "fortra";
|
|
repo = "impacket";
|
|
rev = "caba5facdd3a01b5d0decc6daf5871839f22f792";
|
|
hash = "sha256-jyn5qSSAipGYhHm2EROwDHa227mnmW+d+0H0/++i1OY=";
|
|
};
|
|
# Fix version to be compliant with Python packaging rules
|
|
postPatch = ''
|
|
substituteInPlace setup.py \
|
|
--replace 'version="{}.{}.{}.{}{}"' 'version="{}.{}.{}"'
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
in
|
|
python.pkgs.buildPythonApplication (finalAttrs: {
|
|
pname = "netexec";
|
|
version = "1.5.1";
|
|
pyproject = true;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "Pennyw0rth";
|
|
repo = "NetExec";
|
|
tag = "v${finalAttrs.version}";
|
|
hash = "sha256-BKqBmpA2cSKwC9zX++Z6yTSDIyr4iZVGC/Eea6zoMLQ=";
|
|
};
|
|
|
|
pythonRelaxDeps = true;
|
|
|
|
pythonRemoveDeps = [
|
|
# Fail to detect dev version requirement
|
|
"neo4j"
|
|
# No python package in nixpkgs; use bloodhound-py instead.
|
|
"bloodhound-ce"
|
|
];
|
|
|
|
postPatch = ''
|
|
substituteInPlace nxc/first_run.py \
|
|
--replace-fail "from os import mkdir" "from os import mkdir, chmod" \
|
|
--replace-fail "shutil.copy(default_path, NXC_PATH)" $'shutil.copy(default_path, CONFIG_PATH)\n chmod(CONFIG_PATH, 0o600)'
|
|
|
|
substituteInPlace pyproject.toml \
|
|
--replace-fail " @ git+https://github.com/Pennyw0rth/Certipy" "" \
|
|
--replace-fail " @ git+https://github.com/fortra/impacket" "" \
|
|
--replace-fail " @ git+https://github.com/wbond/oscrypto" "" \
|
|
--replace-fail " @ git+https://github.com/Pennyw0rth/NfsClient" ""
|
|
'';
|
|
|
|
build-system = with python.pkgs; [
|
|
poetry-core
|
|
poetry-dynamic-versioning
|
|
];
|
|
|
|
dependencies = with python.pkgs; [
|
|
jwt
|
|
aardwolf
|
|
aioconsole
|
|
aiosqlite
|
|
argcomplete
|
|
asyauth
|
|
beautifulsoup4
|
|
bloodhound-py
|
|
certipy-ad
|
|
dploot
|
|
dsinternals
|
|
impacket
|
|
lsassy
|
|
masky
|
|
minikerberos
|
|
msgpack
|
|
msldap
|
|
neo4j
|
|
paramiko
|
|
pefile
|
|
pyasn1-modules
|
|
pylnk3
|
|
pynfsclient
|
|
pypsrp
|
|
pypykatz
|
|
python-dateutil
|
|
python-libnmap
|
|
pywerview
|
|
requests
|
|
rich
|
|
sqlalchemy
|
|
termcolor
|
|
terminaltables
|
|
xmltodict
|
|
];
|
|
|
|
nativeCheckInputs = with python.pkgs; [ pytestCheckHook ] ++ [ writableTmpDirAsHomeHook ];
|
|
|
|
meta = {
|
|
description = "Network service exploitation tool (maintained fork of CrackMapExec)";
|
|
homepage = "https://github.com/Pennyw0rth/NetExec";
|
|
changelog = "https://github.com/Pennyw0rth/NetExec/releases/tag/v${finalAttrs.version}";
|
|
license = lib.licenses.bsd2;
|
|
maintainers = with lib.maintainers; [ vncsb ];
|
|
mainProgram = "nxc";
|
|
# FIXME: failing fixupPhase:
|
|
# $ Rewriting #!/nix/store/<hash>-python3-3.11.7/bin/python3.11 to #!/nix/store/<hash>-python3-3.11.7
|
|
# $ /nix/store/<hash>-wrap-python-hook/nix-support/setup-hook: line 65: 47758 Killed: 9 sed -i "$f" -e "1 s^#!/nix/store/<hash>-python3-3.11.7^#!/nix/store/<hash>-python3-3.11.7^"
|
|
broken = stdenv.hostPlatform.isDarwin;
|
|
};
|
|
})
|