npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@pompelmi/engine-binaryninja

v0.1.0

Published

Binary Ninja HLIL decompilation engine for Pompelmi file scanner

Downloads

44

Readme

@pompelmi/engine-binaryninja

Binary Ninja HLIL (High-Level Intermediate Language) decompilation engine for Pompelmi file scanner.

This package integrates Binary Ninja's powerful static analysis capabilities with Pompelmi's modular scanning architecture to detect malicious patterns in compiled binaries through decompilation analysis.

Features

  • HLIL Decompilation: Extracts high-level intermediate representations from binaries
  • Pattern Detection: Identifies suspicious API calls, obfuscation techniques, and anti-analysis measures
  • Configurable Analysis: Multiple analysis depths from minimal to deep inspection
  • Timeout Protection: Prevents analysis from hanging on complex binaries
  • Rich Metadata: Detailed function analysis including complexity metrics

Prerequisites

  • Binary Ninja License: Requires Binary Ninja Commercial or Personal license
  • Python Environment: Binary Ninja Python API must be accessible
  • Node.js: Version 18 or higher

Installation

pnpm add @pompelmi/engine-binaryninja

Quick Start

import { createBinaryNinjaScanner } from '@pompelmi/engine-binaryninja';

const scanner = createBinaryNinjaScanner({
  timeout: 30000,        // 30 second timeout
  depth: 'basic',        // Analysis depth
  pythonPath: 'python3', // Path to Python with Binary Ninja
});

// Scan a binary file
const bytes = await fs.readFile('suspicious.exe');
const matches = await scanner.scan(bytes);

// Or get detailed analysis
const result = await scanner.analyze(bytes);
console.log(`Found ${result.functions.length} functions`);
console.log(`Detected ${result.matches.length} suspicious patterns`);

Configuration

BinaryNinjaOptions

  • timeout (number): Analysis timeout in milliseconds (default: 30000)
  • depth ('minimal' | 'basic' | 'deep'): Analysis depth (default: 'basic')
  • enableHeuristics (boolean): Enable pattern detection (default: true)
  • pythonPath (string): Path to Python executable (default: 'python3')
  • binaryNinjaPath (string): Path to Binary Ninja installation

Environment Variables

  • BINJA_PATH: Path to Binary Ninja installation directory
  • PYTHONPATH: Should include Binary Ninja's Python API path

Analysis Results

DecompilationMatch

interface DecompilationMatch {
  rule: string;                    // Pattern rule name
  severity: 'low' | 'medium' | 'high' | 'critical';
  engine: 'binaryninja-hlil';     // Engine identifier
  confidence: number;              // 0.0 to 1.0
  meta?: {
    function?: string;             // Function name where pattern found
    address?: string;              // Memory address  
    api_call?: string;            // Suspicious API call
    [key: string]: unknown;
  };
}

FunctionAnalysis

interface FunctionAnalysis {
  name: string;                    // Function name
  address: string;                 // Start address
  size: number;                    // Function size in bytes
  complexity?: number;             // Cyclomatic complexity
  callCount?: number;              // Number of function calls
  isObfuscated?: boolean;          // High complexity indicator
  hasAntiAnalysis?: boolean;       // Anti-analysis techniques
  suspiciousCalls?: string[];      // List of suspicious API calls
}

Detected Patterns

The scanner automatically detects:

  • Suspicious API Calls: Process injection, debugging, anti-analysis functions
  • High Complexity: Functions with unusual complexity indicating obfuscation
  • Anti-Debugging: Debug detection and evasion techniques
  • Crypto Constants: Common cryptographic algorithm signatures

Integration with Pompelmi

Use with the main Pompelmi scanner:

import { composeScanners } from 'pompelmi';
import { createBinaryNinjaScanner } from '@pompelmi/engine-binaryninja';
import { createYaraScanner } from '@pompelmi/engine-yara';

const scanner = composeScanners([
  ['yara', createYaraScanner()],
  ['binja', createBinaryNinjaScanner({ depth: 'basic' })],
]);

const results = await scanner.scan(binaryData);

Performance Considerations

  • CPU Intensive: Decompilation requires significant computational resources
  • Memory Usage: Large binaries may consume substantial memory during analysis
  • Timeout Settings: Adjust timeout based on binary size and system performance
  • Analysis Depth: Use 'minimal' for fast scanning, 'deep' for thorough analysis

Troubleshooting

Binary Ninja Not Found

Error: "Binary Ninja Python executable not found"
  • Ensure Binary Ninja is installed and licensed
  • Set BINJA_PATH environment variable
  • Verify Python can import binaryninja module

Analysis Timeout

Error: "Analysis timeout"
  • Increase timeout value
  • Use 'minimal' analysis depth for large binaries
  • Consider pre-filtering files by size/type

License

MIT - See LICENSE file for details.

Contributing

Contributions welcome! Please see the main Pompelmi repository for guidelines.