Ctrl + k

or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/yara-python@3.11.x
tile.json

tessl/pypi-yara-python

tessl install tessl/pypi-yara-python@3.11.0

Python interface for YARA, a powerful malware identification and classification tool

Agent Success

Agent success rate when using this tile

85%

Improvement

Agent success rate improvement when using this tile compared to baseline

0.94x

Baseline

Agent success rate without this tile

90%

task.mdevals/scenario-6/

Rule Loader from Network Stream

Build a system that downloads pre-compiled pattern matching rules from a remote server and loads them for immediate use without saving to disk.

Requirements

Your solution should:

  1. Accept a URL pointing to a remote pre-compiled rules file
  2. Download the rules file content into memory
  3. Load the rules directly from the in-memory buffer without writing to disk
  4. Return a loaded rules object that can be used for pattern matching

Implementation Guidelines

  • Use standard Python libraries for HTTP operations
  • Handle the downloaded data as a file-like object in memory
  • Load the pre-compiled rules from the in-memory buffer
  • Include proper error handling for network failures and invalid rule data

Test Cases

  • Loading rules from a valid in-memory buffer returns a usable rules object @test
  • The loaded rules can successfully match against test data @test
  • Loading from an invalid buffer raises an appropriate error @test

Implementation

@generates

API

def load_rules_from_url(url: str):
    """
    Downloads pre-compiled rules from a URL and loads them from memory.

    Args:
        url: The URL of the pre-compiled rules file

    Returns:
        A rules object ready for pattern matching

    Raises:
        Exception: If the download fails or the rules data is invalid
    """
    pass

Dependencies { .dependencies }

yara { .dependency }

Provides pattern matching and rules management support.

io { .dependency }

Provides file-like object support for in-memory operations.

urllib.request { .dependency }

Provides HTTP request capabilities.