mirror of
https://github.com/dobin/avred
synced 2026-06-08 13:54:13 +00:00
2.5 KiB
2.5 KiB
Source Code Overview
Main objectes:
- Make it as easy as possible to identify parts of a binary which can be modified to bypass signature detection
- Add useful information to the matches to make it easy to spot how and what part should be modified
- Support often used file formats in malware attacks
Phases
The whole process is separated into three distinct phases:
- Scan file to get list of
Matches. - Verify the matches.
- Augment the matches with file information.
Phase 1) and 2) require avred-server connection. The augmentation can run offline.
- Scan will produce a
.matchesfile, which contains a an array ofIntervalwith the matches, pickled. - Verify will create a
.outcomefile, which contains the matches, and its verification. Its of typeOutcome. - Augment will update the information in
.outcomefile with more information for each match.
Data structures
Simplified overview of used data structures.
Interval match:
Interval(start, end, data)
Match:
class Match:
- idx: Matches of a file are numbered, starting at 0
- fileOffset: How many bytes into the file the match starts
- size: How long the match is
- data: A copy of the file from `fileOffset` to `fileOffset+size`
- dataHexdump: A hexdump of `data`
- info: Where the match is located, e.g. which section
- detail: Detailed disassembly of `data`, if possible
Outcome:
class Outcome:
- fileInfo: Some additional information of the file which has been scanned
- matches: List of `Matches`
- verification: List of `Verifications` and supplemental conclusion
- matchesIt: List of matches as `Interval`, basically copy of the `.matches`. Duplicate of `matches`, and not really used
Definition
file: A file to scan. e.g. a .exe, or .docxscanner: Interface to anavred-serverrunning another host. It basically returns detected or not-detected for a givenfilematch: A range in the file which gets detected by Antivirus. Defined in model asMatch. Basically an file offset and size/length
Directories
- app/: Flask Webapp
- doc/: Documentation
- model/: Model
- plugins/: Plugins for each file type
- test/: Tests
- tools/: some command line tools
Files:
- avred.py: Main file
- reducer.py: Finds all
Matchesin afilewith ascanner. The main file reduction logic - scanner.py: The
scannerclass. Accesses anavred-serverto scan afile - verifier.py: Logic to verify the
Matchesof afilewith ascanner