0.2.0 • Published 3 years ago

intezer-js-pre v0.2.0

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

⚠️ This is a pre-release version of the original package. It won't be maintained after main release. This is because the main package is written using ESModules but NodeJS support for ESModules isn't active yet.

Logo intezer-js-pre

An unofficial Node.JS wrapper for Intezer Analyze's API.

📥 Installation

IMPORTANT ⚠️: This library is written using ESModules specification, wich is currently not supported by NodeJS's LTS version. In order to use this library you must either, run it on NodeJS v16 (See the Releases Roadmap) or build an ES2015 compatible library. See the instructions below:

Current NodeJS LTS inferior to v16

Using NPM:

npm install @caesarovich/intezer-js-pre

Cloning from GitHub:

Follow these instructions to clone and build a CommonJS module version of the project.

# Clone the repo
git clone https://github.com/Caesarovich/intezer-js

# Go inside the directory
cd intezer-js

# Install dependencies
npm i

# Build the compatible version
npm run build

# Then copy the 'build_output' directory and paste it where needed
# Then rename it conveniently to 'intezer-js'
# Finally install it to your project
npm install intezer-js

⏳ Quick start

Follow these example to quickly start using the library.

Note: You first need to create an account and get your API Key.

Important Note: All the snippets in this page will use the ES2015 compatible syntax until release.

Import the library:

const intezer = require('intezer-js-pre');

// Or import only the client class //

const Client = require('intezer-js-pre').Client;

Instantiate the client

const Client = require('intezer-js-pre').Client; // Import the Client class

const myClient = new Client('#API Key#'); // Create a new instance

// Or us this shorthand //

const myClient = new require('intezer-js-pre').Client('#API Key#');

Send a file to Analysis

myClient
  .analyze('./file.exe') // Returns a promise
  .then((url) => {
    console.log(`See the analysis results here: ${url}`);
  })
  .catch(console.error);

Retrieve analysis data

Using ID

const id = 'c5e2d1a4-2277-4bcd-839a-19dff91eb112';

myClient.analysis
  .getAnalysis(id)
  .then((data) => {
    console.log(`Analysis results: ${data}`);
  })
  .catch(console.error);

Using a file's hash

const hash = '0a76c55fa88d4c134012a5136c09fb938b4be88a382f88bf2804043253b0559f';
// Or
const hash = myClient.hashFile('file.exe');

myClient.analysis
  .getFile(hash)
  .then((data) => {
    console.log(`Analysis results: ${data}`);
  })
  .catch(console.error);

Making a request using the raw API

const intezer = require('intezer');

// ...

async function myFunction() {
  let accessToken = await intezer.raw.getAccessToken('#API Key#');
  // ...
}

📔 Documentation

Client

Click here to open the wiki

Raw API

Click here to open the wiki

📕 Reference documentation

I used Intezer Analyze's API Documentation as reference for this wrapper.

📄 Disclosure

This library is unofficial and not supported nor sustained by Intezer. Use it at your own risk !

0.2.0

3 years ago

0.1.0

3 years ago