-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmatches.nix
31 lines (31 loc) · 828 Bytes
/
matches.nix
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
{ pkgs ? import <nixpkgs> { } }:
with pkgs;
let
rules = ./execers.yar;
# sudo = if pkgs.stdenv.isDarwin
# then pkgs.runCommand "impure-native-darwin-sudo" { } ''
# mkdir -p $out/bin
# ln -s /usr/bin/sudo $out/bin/sudo
# ln -s /usr/sbin/sudo $out/bin/visudo
# '' else pkgs.sudo;
# targets = [ sudo ];
targets = (import ./big.nix { });
in runCommand "yara-matches" { } ''
binlore_yara()(
set -x
${yara}/bin/yara --scan-list --recursive --print-strings ${rules} <(printf '%s\n' $1/{bin,lib,libexec})
)
{
echo ""
for package in ${toString targets}; do
echo "YARA rule matches for package $package"
echo ""
binlore_yara $package
echo ""
echo "File types"
echo ""
${file}/bin/file -L $package/*/*
echo ""
done
} > $out
''