Tomatotech90 / malware_analysis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

malware_analysis


malware_analysis.py

Python script for analyzing Windows PE files. The script uses various Python modules such as lief, hashlib, argparse, pefile, yara, re, subprocess, and sys to extract and analyze information about a given PE file. Here is a brief overview of what this code does:

The code defines several helper functions such as get_file_hashes, extract_strings, get_pe_data, get_imports, get_exports, get_section_data, get_section_data_lief, and scan_with_yara.

The code defines a function analyze_file that takes a PE file path as an argument, parses the file using the pefile module, and then extracts various information about the file using the helper functions defined earlier.

The analyze_file function prints out the extracted information to the console, including the file path, MD5, SHA1, and SHA256 hashes of the file, basic data about the PE file such as machine type, number of sections, timestamp, entry point, image base, subsystem, and DLL characteristics, imported and exported functions, and section data such as virtual address, virtual size, raw size, and entropy.

The analyze_file function also scans the file with a set of YARA rules using the yara module and prints out any matching rules to the console.

About

License:MIT License


Languages

Language:Python 100.0%