yaralyzer 1.0.11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- .yaralyzer.example +65 -0
- CHANGELOG.md +128 -0
- LICENSE +674 -0
- yaralyzer/__init__.py +76 -0
- yaralyzer/bytes_match.py +276 -0
- yaralyzer/config.py +126 -0
- yaralyzer/decoding/bytes_decoder.py +207 -0
- yaralyzer/decoding/decoding_attempt.py +222 -0
- yaralyzer/encoding_detection/character_encodings.py +197 -0
- yaralyzer/encoding_detection/encoding_assessment.py +83 -0
- yaralyzer/encoding_detection/encoding_detector.py +145 -0
- yaralyzer/helpers/bytes_helper.py +268 -0
- yaralyzer/helpers/dict_helper.py +8 -0
- yaralyzer/helpers/file_helper.py +49 -0
- yaralyzer/helpers/list_helper.py +16 -0
- yaralyzer/helpers/rich_text_helper.py +150 -0
- yaralyzer/helpers/string_helper.py +34 -0
- yaralyzer/output/decoding_attempts_table.py +82 -0
- yaralyzer/output/decoding_table_row.py +60 -0
- yaralyzer/output/file_export.py +111 -0
- yaralyzer/output/file_hashes_table.py +82 -0
- yaralyzer/output/regex_match_metrics.py +97 -0
- yaralyzer/output/rich_console.py +114 -0
- yaralyzer/util/argument_parser.py +297 -0
- yaralyzer/util/logging.py +135 -0
- yaralyzer/yara/error.py +90 -0
- yaralyzer/yara/yara_match.py +160 -0
- yaralyzer/yara/yara_rule_builder.py +164 -0
- yaralyzer/yaralyzer.py +304 -0
- yaralyzer-1.0.11.dist-info/LICENSE +674 -0
- yaralyzer-1.0.11.dist-info/METADATA +151 -0
- yaralyzer-1.0.11.dist-info/RECORD +34 -0
- yaralyzer-1.0.11.dist-info/WHEEL +4 -0
- yaralyzer-1.0.11.dist-info/entry_points.txt +4 -0
.yaralyzer.example
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# If you place a filed called '.yaralyzer' in your home dir or the current dir environment variables specified
|
|
2
|
+
# in that .yaralyzer file will be added to the environment each time yaralyzer is invoked. (See the `dotenv`
|
|
3
|
+
# package for more details.) This file contains environment variables you can use to configure
|
|
4
|
+
# the application above and beyond providing command line options on each invocation. Useful if you want to permanently
|
|
5
|
+
# configure options you tend to reuse (e.g. '--maximize-width') so you can stop remembering to type them.
|
|
6
|
+
#
|
|
7
|
+
# Almost all of the command line options can be configured in this file by capitalizing them and prefixing
|
|
8
|
+
# with 'YARALYZER'. e.g. to configure the --maximize-width option for every invocation, you would set:
|
|
9
|
+
# YARALYZER_MAXIMIZE_WIDTH=True
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# Expand the width of the output to the fit the display window (same as the --maximize-width options)
|
|
14
|
+
# YARALYZER_MAXIMIZE_WIDTH=True
|
|
15
|
+
|
|
16
|
+
# yara-python internal options passed through to yara.set_config() as the stack_size and max_match_data arguments
|
|
17
|
+
# YARALYZER_STACK_SIZE=10485760
|
|
18
|
+
# YARALYZER_MAX_MATCH_LENGTH=10737418240
|
|
19
|
+
|
|
20
|
+
# Suppress all attempts to decode bytes into various text encodings
|
|
21
|
+
# YARALYZER_SUPPRESS_DECODES_TABLE=False
|
|
22
|
+
|
|
23
|
+
# Suppress the display of the table showing the the encoding assessments given by `chardet.detect()`
|
|
24
|
+
# about a particular chunk of binary data. (The most important data in the chardet confidence table is
|
|
25
|
+
# redunandant anyways. Only the low likelihood encodings are hidden from the usef)
|
|
26
|
+
# YARALYZER_SUPPRESS_CHARDET_TABLE=False
|
|
27
|
+
# Minimum confidence to display an encoding in the chardet results table
|
|
28
|
+
# YARALYZER_MIN_CHARDET_CONFIDENCE=2.0
|
|
29
|
+
|
|
30
|
+
# Configure how many bytes before and after any binary data should be included in scans and visualizations
|
|
31
|
+
# YARALYZER_SURROUNDING_BYTES=64
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# Size thresholds (in bytes) under/over which yaralyzer will NOT make attempts to decode a match.
|
|
36
|
+
# Longer byte sequences are for obvious reasons slower to decode by force.
|
|
37
|
+
# It may feel counterintuitive but larger chunks of random binary are also harder to examine and
|
|
38
|
+
# (in my experience) less likely to be maningful. Consider it - two frontslash characters 20,000 lines apart
|
|
39
|
+
# are more likely to be random than those same frontslashes when placed nearer to each other and
|
|
40
|
+
# in the vicinity of lot of computerized sigils of internet power like `.', `+bacd*?`,. and other regexes.*
|
|
41
|
+
# Keeping the max value number low will do more to affect the speed of the app than anything else you
|
|
42
|
+
# can easily configure.
|
|
43
|
+
#
|
|
44
|
+
# YARALYZER_MIN_DECODE_LENGTH=1
|
|
45
|
+
# YARALYZER_MAX_DECODE_LENGTH=256
|
|
46
|
+
|
|
47
|
+
# Minimum bytes to run chardet.detect() on a sequence of bytes
|
|
48
|
+
# YARALYZER_MIN_BYTES_TO_DETECT_ENCODING
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
# Directory to write application logs to. Must be an absolute path, not a relative one.
|
|
53
|
+
# These logs are not normally written to a file and the default log level means that the standard behavior
|
|
54
|
+
# is to more or less discard them. Be aware that if you configure this variable a few things will change:
|
|
55
|
+
#
|
|
56
|
+
# 1. Logs WILL NOT be written to STDOUT. They will stream ONLY to files in the configured directory.
|
|
57
|
+
# This is true even with the -D option.
|
|
58
|
+
# 2. The default log_level will be decreased from WARN (extremely spartan) to INFO (fairly verbose).
|
|
59
|
+
# The -D option, which sets the log level to DEBUG, will be respected whether or not
|
|
60
|
+
# YARALYZER_LOG_DIR is configured.
|
|
61
|
+
#
|
|
62
|
+
# YARALYZER_LOG_DIR=/path/to/yaralyzer/log_dir/
|
|
63
|
+
|
|
64
|
+
# Log level
|
|
65
|
+
# YARALYZER_LOG_LEVEL='WARN'
|
CHANGELOG.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# NEXT RELEASE
|
|
2
|
+
|
|
3
|
+
### 1.0.11
|
|
4
|
+
* Catch yara internal errors in `yaralyze()` script so they are still raised when `Yaralyzer` used as a library
|
|
5
|
+
|
|
6
|
+
### 1.0.10
|
|
7
|
+
* Better handling and messaging around internal YARA errors
|
|
8
|
+
* Make `DecodingTableRow` and `BytesMatch` into dataclasses
|
|
9
|
+
* `print_bytes()` takes an `indent` argument
|
|
10
|
+
|
|
11
|
+
### 1.0.9
|
|
12
|
+
* Raise `FileNotFoundError` instead of `ValueError` if provided YARA rules files or dirs don't exist
|
|
13
|
+
|
|
14
|
+
### 1.0.8
|
|
15
|
+
* Bump `python-dotenv` to v1.1.1
|
|
16
|
+
* Use `mkdocs` and `lazydocs` to build automatic API documentation at https://michelcrypt4d4mus.github.io/yaralyzer/
|
|
17
|
+
* Drop python 3.9 support (required by `mkdocs-awesome-nav` package)
|
|
18
|
+
|
|
19
|
+
### 1.0.7
|
|
20
|
+
* Add `Changelog` to PyPi URLs, add some more PyPi classifiers
|
|
21
|
+
* Add `.flake8` config file and fix style errors
|
|
22
|
+
* Rename `prefix_with_plain_text_obj()` to `prefix_with_style()`
|
|
23
|
+
|
|
24
|
+
### 1.0.6
|
|
25
|
+
* Add `Environment :: Console` and `Programming Language :: Python` to PyPi classifiers
|
|
26
|
+
* Add `LICENSE` to PyPi package
|
|
27
|
+
|
|
28
|
+
### 1.0.5
|
|
29
|
+
* Add `Development Status :: 5 - Production/Stable` to pypi classifiers
|
|
30
|
+
|
|
31
|
+
### 1.0.4
|
|
32
|
+
* Lock `chardet` library to 5.x
|
|
33
|
+
|
|
34
|
+
### 1.0.3
|
|
35
|
+
* Upgrade `rich` to 14.1.0
|
|
36
|
+
|
|
37
|
+
### 1.0.2
|
|
38
|
+
* Upgrade `yara-python` to 4.5.4
|
|
39
|
+
|
|
40
|
+
### 1.0.1
|
|
41
|
+
* Fix iteration of byte offsets during attempted decodes for UTF-16 and UTF-32 (was starting at second byte instead of first)
|
|
42
|
+
* Label the byte offset for forced UTF-16 and UTF-32 decodes
|
|
43
|
+
* Show helpful message if logs are being sent to files in `YaralyzerConfig.LOG_DIR` instead of being written to stderr/stdout
|
|
44
|
+
* Warn if `--debug` and `--log-level` args both provided
|
|
45
|
+
|
|
46
|
+
# 1.0.0
|
|
47
|
+
* Add `--export-json` option
|
|
48
|
+
|
|
49
|
+
### 0.9.6
|
|
50
|
+
* Fix help message
|
|
51
|
+
|
|
52
|
+
### 0.9.5
|
|
53
|
+
* Use all files in a directory specified by `--rule-dir` instead of just those with the extension `.yara`
|
|
54
|
+
* Fix bug where `--rule-dir` is prefixed by `./`
|
|
55
|
+
|
|
56
|
+
### 0.9.4
|
|
57
|
+
* Bump `yara-python` to 4.3.0+ and deal with backwards incompatibility
|
|
58
|
+
|
|
59
|
+
### 0.9.3
|
|
60
|
+
* Lock `yara-python` at 4.2.3 bc 4.3.x causes problems
|
|
61
|
+
|
|
62
|
+
### 0.9.2
|
|
63
|
+
* Fix PyPi screenshots
|
|
64
|
+
* Raise better error message if yara rules file doesn't exist
|
|
65
|
+
|
|
66
|
+
### 0.9.1
|
|
67
|
+
* Fix PyPi screenshots
|
|
68
|
+
|
|
69
|
+
# 0.9.0
|
|
70
|
+
* All command lines args configurable via environment variables or `.yaralyzer` file
|
|
71
|
+
* Improve decoding attempt statistics tracking
|
|
72
|
+
* Add suppression notices
|
|
73
|
+
* Expose `--min-chardet-table-confidence` option
|
|
74
|
+
|
|
75
|
+
# 0.8.0
|
|
76
|
+
* Add `--log-level` option
|
|
77
|
+
* `BytesMatch.is_decodable()` method
|
|
78
|
+
|
|
79
|
+
### 0.7.1
|
|
80
|
+
* Bump deps
|
|
81
|
+
|
|
82
|
+
# 0.7.0
|
|
83
|
+
* Show hex and ascii side by side in decodes table
|
|
84
|
+
|
|
85
|
+
### 0.6.2
|
|
86
|
+
* Remove `cairosvg` dependency
|
|
87
|
+
|
|
88
|
+
### 0.6.1
|
|
89
|
+
* Use `rich_argparse_plus` for help formatting
|
|
90
|
+
|
|
91
|
+
# 0.6.0
|
|
92
|
+
* Add `--max-match-length` and `--yara-stack-size` args
|
|
93
|
+
* Increase max returned bytes (was stuck at 512)
|
|
94
|
+
* Tweak unprintable char format for ASCII C1 control range, minor style changes
|
|
95
|
+
* Show color key for raw YARA match panel
|
|
96
|
+
|
|
97
|
+
### 0.5.2
|
|
98
|
+
* Properly escape bytes previews for rich
|
|
99
|
+
|
|
100
|
+
### 0.5.1
|
|
101
|
+
* Add Pdfalyzer info message when scanning PDFs
|
|
102
|
+
|
|
103
|
+
# 0.5.0
|
|
104
|
+
* Show MD5, SHA1, and SHA256 hashes for each match
|
|
105
|
+
|
|
106
|
+
# 0.4.0
|
|
107
|
+
* Add `--hex-pattern` command line option
|
|
108
|
+
* Add `--patterns-label` command line option
|
|
109
|
+
|
|
110
|
+
### 0.3.3
|
|
111
|
+
* Refactor `file_export` and `rich_console`
|
|
112
|
+
|
|
113
|
+
### 0.3.2
|
|
114
|
+
* help screen displays defaults and valid ranges for int types
|
|
115
|
+
|
|
116
|
+
### 0.3.1
|
|
117
|
+
* yara-python compiles files directly
|
|
118
|
+
|
|
119
|
+
# 0.3.0
|
|
120
|
+
* Add `--rule-dir` option for loading all `.yara` files in directories
|
|
121
|
+
* Add `--regex_modifier` option
|
|
122
|
+
|
|
123
|
+
# 0.2.0
|
|
124
|
+
* Add `Yaralyzer.for_rules_dir()` constructor to load all `.yara` files in a directory
|
|
125
|
+
* Change command line arguments `-y` to `-Y` and `-r` to `-re`
|
|
126
|
+
* Respect the `--suppress-decodes` option and min / max decode length options
|
|
127
|
+
* Add `highlight_style` argument to `Yaralyzer`
|
|
128
|
+
* Expose `Yaralyzer.match_iterator()` that calls back with `BytesMatch` objects
|