Unverified Commit f0d3a8e7 authored by Felix Bargfeldt's avatar Felix Bargfeldt Committed by GitHub
Browse files

netcap: init at 0.6.11 (#414553)

parents 842e9cdf b59f175f
Loading
Loading
Loading
Loading
+44 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
  autoreconfHook,
  pkg-config,
  bison,
  flex,
  libtrace,
  nix-update-script,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "libflowmanager";
  version = "3.0.0-3";

  src = fetchFromGitHub {
    owner = "LibtraceTeam";
    repo = "libflowmanager";
    tag = finalAttrs.version;
    hash = "sha256-lQo8F4w+tu0DZgt0pnbEpwcL6buVbAuFoxtwGFXuGX4=";
  };

  strictDeps = true;

  nativeBuildInputs = [
    autoreconfHook
    pkg-config
    bison
    flex
  ];
  buildInputs = [ libtrace ];

  passthru.updateScript = nix-update-script { extraArgs = [ "--version-regex=^([0-9.-]+)$" ]; };

  meta = {
    description = "Library for assigning network packets to flows based on the standard 5-tuple";
    homepage = "https://github.com/LibtraceTeam/libflowmanager";
    changelog = "https://github.com/LibtraceTeam/libflowmanager/releases/tag/${finalAttrs.version}";
    license = lib.licenses.lgpl3Plus;
    maintainers = with lib.maintainers; [ felbinger ];
    platforms = lib.platforms.unix;
  };
})
+48 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
  autoreconfHook,
  pkg-config,
  bison,
  flex,
  libtrace,
  libflowmanager,
  nix-update-script,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "libprotoident";
  version = "2.0.15-2";

  src = fetchFromGitHub {
    owner = "LibtraceTeam";
    repo = "libprotoident";
    tag = finalAttrs.version;
    hash = "sha256-XiZ/UqF11eeeGudNXJqtTfPn5xWvHPKPrgqV7iHii0M=";
  };

  strictDeps = true;

  nativeBuildInputs = [
    autoreconfHook
    pkg-config
    bison
    flex
  ];
  buildInputs = [
    libtrace
    libflowmanager
  ];

  passthru.updateScript = nix-update-script { extraArgs = [ "--version-regex=^([0-9.-]+)$" ]; };

  meta = {
    description = "Network traffic classification library that requires minimal application payload";
    homepage = "https://github.com/LibtraceTeam/libprotoident";
    changelog = "https://github.com/LibtraceTeam/libprotoident/releases/tag/${finalAttrs.version}";
    license = lib.licenses.lgpl3Plus;
    maintainers = with lib.maintainers; [ felbinger ];
    platforms = lib.platforms.unix;
  };
})
+54 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
  autoreconfHook,
  pkg-config,
  bison,
  flex,
  zlib,
  bzip2,
  xz,
  libpcap,
  wandio,
  nix-update-script,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "libtrace";
  version = "4.0.28-1";

  src = fetchFromGitHub {
    owner = "LibtraceTeam";
    repo = "libtrace";
    tag = finalAttrs.version;
    hash = "sha256-impZrZOOORsQaUz04pkCXGxJkXGaCBcJD390hm74peA=";
  };

  strictDeps = true;

  nativeBuildInputs = [
    autoreconfHook
    pkg-config
    bison
    flex
  ];
  buildInputs = [
    zlib
    bzip2
    xz
    libpcap
    wandio
  ];

  passthru.updateScript = nix-update-script { extraArgs = [ "--version-regex=^([0-9.-]+)$" ]; };

  meta = {
    description = "C Library for working with network packet traces";
    homepage = "https://github.com/LibtraceTeam/libtrace";
    changelog = "https://github.com/LibtraceTeam/libtrace/releases/tag/${finalAttrs.version}";
    license = lib.licenses.lgpl3Only;
    maintainers = with lib.maintainers; [ felbinger ];
    platforms = lib.platforms.unix;
  };
})
+32 −0
Original line number Diff line number Diff line
{
  ndpi,
  fetchFromGitHub,
  lib,
  stdenv,
  autoreconfHook,
  autoconf,
  automake,
  fixDarwinDylibNames,
}:

ndpi.overrideAttrs (
  finalAttrs: prevAttrs: {
    version = "4.0";

    src = fetchFromGitHub {
      inherit (prevAttrs.src) owner repo;
      tag = finalAttrs.version;
      hash = "sha256-vWx6IVyxPJBgOkXpHdnvstvDGJbAtndFPtowpjLd32o=";
    };

    configureScript = "./autogen.sh";

    nativeBuildInputs =
      lib.remove autoreconfHook prevAttrs.nativeBuildInputs
      ++ [
        autoconf
        automake
      ]
      ++ lib.optionals stdenv.hostPlatform.isDarwin [ fixDarwinDylibNames ];
  }
)
+92 −0
Original line number Diff line number Diff line
{
  lib,
  callPackage,
  buildGoModule,
  fetchFromGitHub,
  withDpi ? true,
  libpcap,
  libprotoident,
  libflowmanager,
  libtrace,
  versionCheckHook,
  nix-update-script,
}:
let
  ndpi = callPackage ./ndpi_4_0.nix { };
in
buildGoModule (finalAttrs: {
  pname = "netcap";
  version = "0.6.11";

  src = fetchFromGitHub {
    owner = "dreadl0ck";
    repo = "netcap";
    tag = "v${finalAttrs.version}";
    hash = "sha256-SCBKOIC/s+rfrVWmryp9EBp7ARpZZcxymsnZWtEHrhk=";
  };

  vendorHash = "sha256-MvHrJLhcFA0fEgK+YT0rwI6wIwTGMcLWQt6AYkx1eZM=";

  subPackages = [ "cmd" ];

  buildInputs =
    [
      libpcap
    ]
    ++ lib.optionals withDpi [
      ndpi
      libprotoident
      libflowmanager
      libtrace
    ];

  ldflags = [
    "-s -w"
  ];

  tags = lib.optionals (!withDpi) [
    "nodpi"
  ];

  CGO_LDFLAGS = lib.optionalString withDpi ''
    -L${ndpi}/lib -lndpi
    -L${libprotoident}/lib -lndpi
  '';

  CGO_CFLAGS = lib.optionalString withDpi ''
    -I${ndpi}/include
    -I${libprotoident}/include
  '';

  postInstall = ''
    mv $out/bin/cmd $out/bin/net
  '';

  checkFlags =
    let
      skippedTests = [
        # couldn't open packet socket: operation not permitted
        "TestCaptureLive"
        # requires local test data
        "TestCapturePCAP"
      ];
    in
    [ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ];

  nativeInstallCheckInputs = [ versionCheckHook ];
  versionCheckProgram = "${placeholder "out"}/bin/net";
  versionCheckProgramArg = "--version";
  doInstallCheck = true;

  passthru.updateScript = nix-update-script { };

  meta = {
    description = "Framework for secure and scalable network traffic analysis";
    homepage = "https://netcap.io";
    downloadPage = "https://github.com/dreadl0ck/netcap";
    changelog = "https://github.com/dreadl0ck/netcap/releases/tag/v${finalAttrs.version}";
    license = lib.licenses.gpl3Only;
    maintainers = with lib.maintainers; [ felbinger ];
    mainProgram = "net";
  };
})
Loading