Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 20.09 2.9 kB view raw
1{ buildPythonPackage, fetchFromGitHub, lib, isPyPy 2, pycrypto, ecdsa # TODO 3, tox, mock, coverage, can, brotli 4, withOptionalDeps ? true, tcpdump, ipython 5, withCryptography ? true, cryptography 6, withVoipSupport ? true, sox 7, withPlottingSupport ? true, matplotlib 8, withGraphicsSupport ? false, pyx, texlive, graphviz, imagemagick 9, withManufDb ? false, wireshark 10# 2D/3D graphics and graphs TODO: VPython 11# TODO: nmap, numpy 12}: 13 14buildPythonPackage rec { 15 pname = "scapy"; 16 version = "2.4.4"; 17 18 disabled = isPyPy; 19 20 src = fetchFromGitHub { 21 owner = "secdev"; 22 repo = "scapy"; 23 rev = "v${version}"; 24 sha256 = "1wpx7gps3g8q5ykbfcd67mxwcs416zg37b53fwfzzlc1m58vhk3p"; 25 }; 26 27 postPatch = '' 28 printf "${version}" > scapy/VERSION 29 '' + lib.optionalString withManufDb '' 30 substituteInPlace scapy/data.py --replace "/opt/wireshark" "${wireshark}" 31 ''; 32 33 propagatedBuildInputs = [ pycrypto ecdsa ] 34 ++ lib.optionals withOptionalDeps [ tcpdump ipython ] 35 ++ lib.optional withCryptography cryptography 36 ++ lib.optional withVoipSupport sox 37 ++ lib.optional withPlottingSupport matplotlib 38 ++ lib.optionals withGraphicsSupport [ pyx texlive.combined.scheme-minimal graphviz imagemagick ]; 39 40 # Running the tests seems too complicated: 41 doCheck = false; 42 checkInputs = [ tox mock coverage can brotli ]; 43 checkPhase = '' 44 patchShebangs . 45 .config/ci/test.sh 46 ''; 47 48 meta = with lib; { 49 description = "A Python-based network packet manipulation program and library"; 50 longDescription = '' 51 Scapy is a powerful Python-based interactive packet manipulation program 52 and library. 53 54 It is able to forge or decode packets of a wide number of protocols, send 55 them on the wire, capture them, store or read them using pcap files, 56 match requests and replies, and much more. It is designed to allow fast 57 packet prototyping by using default values that work. 58 59 It can easily handle most classical tasks like scanning, tracerouting, 60 probing, unit tests, attacks or network discovery (it can replace hping, 61 85% of nmap, arpspoof, arp-sk, arping, tcpdump, wireshark, p0f, etc.). It 62 also performs very well at a lot of other specific tasks that most other 63 tools can't handle, like sending invalid frames, injecting your own 64 802.11 frames, combining techniques (VLAN hopping+ARP cache poisoning, 65 VoIP decoding on WEP protected channel, ...), etc. 66 67 Scapy supports Python 2.7 and Python 3 (3.4 to 3.8). It's intended to be 68 cross platform, and runs on many different platforms (Linux, OSX, *BSD, 69 and Windows). 70 ''; 71 homepage = "https://scapy.net/"; 72 changelog = "https://github.com/secdev/scapy/releases/tag/v${version}"; 73 license = licenses.gpl2; 74 platforms = platforms.unix; 75 maintainers = with maintainers; [ primeos bjornfor ]; 76 }; 77}