about summary refs log tree commit diff
path: root/nixpkgs/pkgs/by-name/di/dirbuster/package.nix
blob: 59b41efab6ea7999c972627f9660d58f486f9623 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
{ lib
, stdenv
, fetchurl
, makeBinaryWrapper
, copyDesktopItems
, makeDesktopItem
, unzip
, jdk8
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "dirbuster";
  version = "1.0-RC1";

  src = fetchurl {
    url = "mirror://sourceforge/dirbuster/DirBuster%20(jar%20%2B%20lists)/${finalAttrs.version}/DirBuster-${finalAttrs.version}.tar.bz2";
    hash = "sha256-UoEt1NkaLsKux3lr+AB+TZCCshQs2hIo63igT39V68E=";
  };

  desktopItems = [
    (makeDesktopItem {
      name = "dirbuster";
      desktopName = "OWASP DirBuster";
      exec = "dirbuster";
      icon = "dirbuster";
      comment = "Web Application Brute Forcing";
      categories = [ "Network" ];
    })
  ];

  nativeBuildInputs = [
    makeBinaryWrapper
    copyDesktopItems
    unzip
  ];

  installPhase = ''
    runHook preInstall

    export JAR=$out/share/java/dirbuster.jar
    install -Dm444 DirBuster-${finalAttrs.version}.jar $JAR
    makeWrapper ${jdk8}/bin/java $out/bin/dirbuster \
      --add-flags "-Duser.dir=$out/share/dirbuster/" \
      --add-flags "-Xmx256M" \
      --add-flags "-jar $JAR"

    cp -r lib/ $out/share/java/lib/

    # Copy wordlists
    mkdir -p $out/share/dirbuster
    for f in *.txt; do
      cp $f $out/share/dirbuster/
    done

    # Extract embedded desktop icon
    mkdir -p $out/share/pixmaps
    unzip $JAR
    strings com/sittinglittleduck/DirBuster/ImageCreator.class | grep iVBORw0KG | base64 -d > $out/share/pixmaps/dirbuster.png

    runHook postInstall
  '';

  meta = {
    description = "Brute force directories and files names on web/application servers";
    homepage = "https://wiki.owasp.org/index.php/Category:OWASP_DirBuster_Project";
    license = lib.licenses.lgpl21Only;
    mainProgram = "dirbuster";
    maintainers = with lib.maintainers; [ emilytrau ];
    platforms = lib.platforms.all;
    sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
  };
})