indicator-extractor 0.1.3

Extract indicators (IP, domain, email, hashes, etc.) from a string or a PDF file
Documentation

indicator-extractor

Extract indicators (IP, domain, email, hashes, etc.) from a string or a PDF file written in Rust.

Usage

Web NPM Version

A WebAssembly build is available on npm and can be installed like the following:

npm install indicator-extractor

Then you can use it like this:

import { extract_str, extract_pdf, extract_bytes } from "indicator-extractor";

const resultStr = extract_str("https://github.com");
console.log(resultStr); // ['{"kind":"Url","value":"https://github.com"}']

// Similarly for the other functions

const extractPdf = extract_pdf(new Uint8Array());
const extractBytes = extract_bytes(new Uint8Array());

Rust Crates.io Version

The crate is available on crates.io and can be installed like the following:

cargo add indicator-extractor

To extract indicators from a string/bytes

use indicator_extractor::parser::extract_indicators;

let result = extract_indicators("https://github.com".as_bytes());
println!("{:?}", result); // Ok(([], [Indicator::Url("https://github.com")])

To extract indicators from a PDF file

use indicator_extractor::{data{::PdfExtractor, DataExtractor}, parser::extract_indicators};

let pdf_data = std::fs::read("./somewhere/pdf_file_path.pdf").unwrap();
let pdf_string = PdfExtractor.extract(&pdf_data);
let result = extract_indicators(pdf_string.as_bytes());