View Issue Details

IDProjectCategoryView StatusLast Update
0007994Kali LinuxQueued Tool Additionpublic2024-08-19 19:52
Reportermccrypter Assigned To 
PrioritynormalSeverityminorReproducibilityN/A
Status acknowledgedResolutionopen 
Summary0007994: yaralyzer - tool to visually inspect and force decode YARA and regex matches found in both binary and text data.
Description

[Name] yaralyzer
[Version] 0.6.2
[Homepage] https://github.com/michelcrypt4d4mus/yaralyzer
[Download] https://pypi.org/project/yaralyzer/#files
[Author] Michel de Cryptadamus
[Licence] GPLv3

[Description] Visually inspect all of the regex matches (and their sexier, more cloak and dagger cousins, the YARA matches) found in binary data and/or text. See what happens when you force various character encodings upon those matched bytes. With colors.
Can be run with a yara rule file, a dir full of yarn rules, or off the cuff with --hex-pattern and --regex-pattern

Some screenshots are visible here: https://github.com/michelcrypt4d4mus/yaralyzer#example-output

[Dependencies] python 3.9+
chardet = "^5.0.0"
python-dotenv = "^0.21.0"
rich = "^12.5.1"
rich-argparse-plus = "^0.3.1"
yara-python = "^4.2.3"

[Similar tools] http://www.binaryalert.io/yara-matches.html (sort of - it writes matches to a DB rather than STDOUT, and it doesn't do any encoding detection or force decodes)

[Activity] Development started mid summer 2022 originally as an internal engine of a related tool, the pdfalyzer: https://github.com/michelcrypt4d4mus/pdfalyzer. actively being maintained, kind of surprising amount of interest since it was open sourced last week

[How to install] pipx install yaralyzer is the easiest way

Note, using source code to acquire (e.g. git clone/svn checkout) can’t be used - Also downloading from the head. Please use a “tag” or “release” version.
[How to use] - What are some basic commands/functions to demonstrate it?

Scan against YARA definitions in a file:

yaralyze --yara-rules /path/to/malware_rules.yara lacan_buys_the_dip.pdf

Scan against an arbitrary YARA compatible regular expression:

yaralyze --regex-pattern 'evil.*of\s+\w+byte' the_crypto_archipelago.exe

Scan against an arbitrary YARA hex pattern

yaralyze --hex-pattern 'd0 93 d0 a3 d0 [-] 9b d0 90 d0 93' one_day_in_the_life_of_ivan_cryptosovich.bin

[Packaged] - Is the tool already packaged for Debian?
no

Activities

g0tmi1k

g0tmi1k

2022-11-01 14:35

administrator   ~0017034

@kali-team, please could this be packaged up.
@author, If you want to help the packaging process, you can check the documentation here ~ https://www.kali.org/docs/development/public-packaging

Arszilla

Arszilla

2024-08-14 16:50

reporter   ~0019643

Package has been drafted: https://gitlab.com/Arszilla/yaralyzer

However, it requires the following package as its a dependency I had to package: https://gitlab.com/Arszilla/rich-argparse-plus

I tested the functionality in a limited manner - thus I'd appreciate it if you could test it @mccrypter. I've attached the drafted packages below. Feel free to install them in a pre-existing instance of Kali (or spin up one in Docker) and test them, and feel free to report any issues you have.

mccrypter

mccrypter

2024-08-19 01:30

reporter   ~0019664

thanks @arszilla! I did a little test driving on a bare bones kali docker container and while i didn't run the whole test suite everything i tried worked great, including stuff like dumping colored output to svg files which is what i would expect to have issues if there were any.

that said i did notice you packaged yaralyzer for "all" architectures but rich-argparse-plus is only packaged for x86/amd64. while it's not the end of the world (i was able to work around it with docker pull --platform linux/amd64 kalilinux/kali-rolling instead of just docker pull kalilinux/kali-rolling) it's at least worth mentioning that these packages will not work for someone using the default kali container on an arm64 device.

specifically this is what happened:

$ docker pull kalilinux/kali-rolling
$ docker run --tty --interactive kalilinux/kali-rolling

┌──(root㉿4c3cb6edb32a)-[/debian_pkgs]
└─# dpkg -i ./python3-rich-argparse-plus_0.3.1.4-0kali1_amd64.deb 
dpkg: error processing archive ./python3-rich-argparse-plus_0.3.1.4-0kali1_amd64.deb (--install):
 package architecture (amd64) does not match system (arm64)
mccrypter

mccrypter

2024-08-19 01:33

reporter   ~0019665

p.s. i don't know if you'd by any chance be interested in packaging the pdfalyzer which is the tool that i broke the yaralyzer out from and which has proven surprisingly (to me, at least) popular for investigating malware PDFs but if you are it's here: https://github.com/michelcrypt4d4mus/pdfalyzer

realistically it only has 2 or 3 dependencies beyond those already required to package the yaralyzer.

Arszilla

Arszilla

2024-08-19 05:47

reporter   ~0019666

Last edited: 2024-08-19 05:49

Hey @mccrypter

  1. Thanks for pointing out my mistake. It should `Architecture: any, not Architecture: all. Thus, rich-argparse-plus is correct, while yaralyzer is incorrect. I've pushed a commit to fix this and the Kali Team would have caught this as well when they review my work before pushing it to their repositories.
  2. It'd be better if you submit a separate ticket for pdfalyzer. If the team approves the package, I will likely package it no one attempts it before I do.

I should point out that the packages I shared were built for amd64, thus they'll only work on amd64 based systems. For i386 or arm64, a respective build must happen. If you want, I can provide you with arm64 images if you wish to test it on that platform.

mccrypter

mccrypter

2024-08-19 12:26

reporter   ~0019668

i'm not super worried about the arm64 vs. amd64 thing seeing as how it's pretty tricky to install linux on a mac these days and there is the --platform workaround for those using docker but if there's a way to make the build generic so that it Just Works when someone pulls the docker image and runs it on an arm64 platform that seems like it would be ideal... but tbh i don't know enough about apt or the packaging of kali tools to know if that's something you need to do anything about or if it will Just Work as is.

mccrypter

mccrypter

2024-08-19 19:52

reporter   ~0019669

created a separate issue for packaging the pdfalyzer (actually far more popular a tool than the standalone yaralyzer)

Issue History

Date Modified Username Field Change
2022-10-09 23:01 mccrypter New Issue
2022-11-01 14:35 g0tmi1k Note Added: 0017034
2022-11-01 14:35 g0tmi1k Status new => acknowledged
2022-11-01 14:35 g0tmi1k Category New Tool Requests => Queued Tool Addition
2024-03-13 14:09 daniruiz Summary yaralyzer is a tool to visually inspect and force decode YARA and regex matches found in both binary and text data. => yaralyzer - tool to visually inspect and force decode YARA and regex matches found in both binary and text data.
2024-08-14 16:50 Arszilla Note Added: 0019643
2024-08-14 16:50 Arszilla File Added: python3-rich-argparse-plus_0.3.1.4-0kali1_amd64.deb
2024-08-14 16:50 Arszilla File Added: yaralyzer_0.9.4-0kali1_all.deb
2024-08-19 01:30 mccrypter Note Added: 0019664
2024-08-19 01:33 mccrypter Note Added: 0019665
2024-08-19 05:47 Arszilla Note Added: 0019666
2024-08-19 05:49 Arszilla Note Edited: 0019666
2024-08-19 12:26 mccrypter Note Added: 0019668
2024-08-19 19:52 mccrypter Note Added: 0019669