Merge pull request #267555 from h7x4/pkgs-refactor-wordlists

authored by

Janik and committed by
GitHub
de20681f 8b7e94d3

+30 -27
+30 -27
pkgs/by-name/wo/wordlists/package.nix
··· 1 { lib 2 - , callPackage 3 , nmap 4 , rockyou 5 - , runtimeShell 6 , seclists 7 - , symlinkJoin 8 - , tree 9 , wfuzz 10 , lists ? [ 11 nmap ··· 13 seclists 14 wfuzz 15 ] 16 }: 17 18 - symlinkJoin rec { 19 - pname = "wordlists"; 20 - version = "unstable-2023-10-10"; 21 22 - name = "${pname}-${version}"; 23 - paths = lists; 24 25 - postBuild = '' 26 - mkdir -p $out/bin 27 - 28 - # Create a command to show the location of the links. 29 - cat >> $out/bin/wordlists << __EOF__ 30 - #!${runtimeShell} 31 - ${tree}/bin/tree ${placeholder "out"}/share/wordlists 32 - __EOF__ 33 - chmod +x $out/bin/wordlists 34 35 - # Create a handy command for easy access to the wordlists. 36 - # e.g.: `cat "$(wordlists_path)/rockyou.txt"`, or `ls "$(wordlists_path)/dirbuster"` 37 - cat >> $out/bin/wordlists_path << __EOF__ 38 - #!${runtimeShell} 39 - printf "${placeholder "out"}/share/wordlists\n" 40 - __EOF__ 41 - chmod +x $out/bin/wordlists_path 42 - ''; 43 44 meta = with lib; { 45 description = "A collection of wordlists useful for security testing"; ··· 65 If you want to add a new package that provides wordlist/s the convention 66 is to copy it to {file}`$out/share/wordlists/myNewWordlist`. 67 ''; 68 - maintainers = with maintainers; [ janik pamplemousse ]; 69 }; 70 }
··· 1 { lib 2 + , symlinkJoin 3 , nmap 4 , rockyou 5 , seclists 6 , wfuzz 7 , lists ? [ 8 nmap ··· 10 seclists 11 wfuzz 12 ] 13 + , writeShellScriptBin 14 + , tree 15 }: 16 + let 17 + wordlistsCollection = symlinkJoin { 18 + name = "wordlists-collection"; 19 + paths = lists; 20 21 + postBuild = '' 22 + shopt -s extglob 23 + rm -rf $out/!(share) 24 + rm -rf $out/share/!(wordlists) 25 + shopt -u extglob 26 + ''; 27 + }; 28 29 + # A command to show the location of the links. 30 + wordlistsBin = writeShellScriptBin "wordlists" '' 31 + ${lib.getExe tree} ${wordlistsCollection}/share/wordlists 32 + ''; 33 + # A command for easy access to the wordlists. 34 + wordlistsPathBin = writeShellScriptBin "wordlists_path" '' 35 + printf "${wordlistsCollection}/share/wordlists\n" 36 + ''; 37 38 + in symlinkJoin { 39 + name = "wordlists"; 40 41 + paths = [ 42 + wordlistsCollection 43 + wordlistsBin 44 + wordlistsPathBin 45 + ]; 46 47 meta = with lib; { 48 description = "A collection of wordlists useful for security testing"; ··· 68 If you want to add a new package that provides wordlist/s the convention 69 is to copy it to {file}`$out/share/wordlists/myNewWordlist`. 70 ''; 71 + maintainers = with maintainers; [ janik pamplemousse h7x4 ]; 72 }; 73 }