nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 118 lines 3.1 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 bundlerEnv, 6 ruby_3_4, 7 withMongo ? false, 8 withRchardet ? false, 9}: 10 11let 12 gemdir = 13 if withMongo && withRchardet then 14 ./gems 15 else if withMongo then 16 ./gems 17 else if withRchardet then 18 ./gems 19 else 20 ./gems; 21 22 gemfile = 23 if withMongo then 24 gemdir + "/Gemfile.mongo" 25 else if withRchardet then 26 gemdir + "/Gemfile.rchardet" 27 else 28 gemdir + "/Gemfile"; 29 30 lockfile = 31 if withMongo then 32 gemdir + "/Gemfile.mongo.lock" 33 else if withRchardet then 34 gemdir + "/Gemfile.rchardet.lock" 35 else 36 gemdir + "/Gemfile.lock"; 37 38 gemset = 39 if withMongo then 40 gemdir + "/gemset.mongo.nix" 41 else if withRchardet then 42 gemdir + "/gemset.rchardet.nix" 43 else 44 gemdir + "/gemset.nix"; 45 46 gems = bundlerEnv { 47 name = "whatweb-env"; 48 inherit ruby_3_4; 49 inherit gemdir; 50 inherit gemfile lockfile gemset; 51 }; 52in 53stdenv.mkDerivation (finalAttrs: { 54 pname = "whatweb"; 55 version = "0.6.2"; 56 57 src = fetchFromGitHub { 58 owner = "urbanadventurer"; 59 repo = "whatweb"; 60 rev = "v${finalAttrs.version}"; 61 sha256 = "sha256-EFQ4RHI1+kmlz/Bm+9KXbmY0iEBJnKfdQL5YGDWCfJQ="; 62 }; 63 64 prePatch = '' 65 substituteInPlace Makefile \ 66 --replace "/usr/local" "$out" \ 67 --replace "/usr" "$out" \ 68 --replace "bundle install" "echo 'Skipping bundle install in nix build'" 69 ''; 70 71 buildInputs = [ gems ]; 72 73 installPhase = '' 74 runHook preInstall 75 76 raw=$out/share/whatweb/whatweb 77 rm $out/bin/whatweb 78 cat << EOF >> $out/bin/whatweb 79 #!/bin/sh -e 80 export GEM_PATH="${gems}/lib/ruby/gems/3.3.0" 81 export RUBYOPT="-W0" 82 exec ${ruby_3_4}/bin/ruby "$raw" "\$@" 83 EOF 84 chmod +x $out/bin/whatweb 85 86 runHook postInstall 87 ''; 88 89 passthru = { 90 withMongo = withMongo; 91 withRchardet = withRchardet; 92 }; 93 94 meta = { 95 description = "Next generation web scanner"; 96 longDescription = '' 97 WhatWeb is a website fingerprinting tool that identifies web technologies such as CMSs, blogging platforms, 98 analytics packages, JavaScript libraries, web servers, and embedded devices. With over 1800 plugins, it detects software 99 versions, email addresses, account IDs, web framework modules, SQL errors, and more. WhatWeb offers adjustable scan 100 modes, balancing speed and thoroughness, making it suitable for both quick reconnaissance and detailed penetration 101 testing. Its plugins use multiple detection methods to reliably identify technologies, even when sites attempt to 102 obscure their software. 103 '' 104 + lib.optionalString withMongo '' 105 106 This build includes MongoDB support and character set detection capabilities, which may impact performance. 107 '' 108 + lib.optionalString (withRchardet && !withMongo) '' 109 110 This build includes character set detection capabilities, which may impact performance. 111 ''; 112 mainProgram = "whatweb"; 113 homepage = "https://github.com/urbanadventurer/whatweb"; 114 license = lib.licenses.gpl2Only; 115 maintainers = [ ]; 116 platforms = lib.platforms.unix; 117 }; 118})