CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-yara-python

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

Overall
score

85%

Evaluation85%

0.94x

Agent success when using this tile

Overview
Eval results
Files

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.

Install with Tessl CLI

npx tessl i tessl/pypi-yara-python

tile.json