🚨 Active Supply Chain Attack:node-ipc Package Compromised.Learn More
Socket
Book a DemoSign in
Socket

@appsensorlike/appsensorlike_storage_mysql

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@appsensorlike/appsensorlike_storage_mysql

AppSensorLike's MySQL storage implementation

latest
Source
npmnpm
Version
0.30.0
Version published
Maintainers
1
Created
Source

This is @appsensorlike/appsensorlike MySQL storage implementation.

Installation

npm i @appsensorlike/appsensorlike_storage_mysql

Preparation

Create tables in the db using module's dist/storage-providers/appsensor-storage-mysql/sql/tables.sql script.

Copy from the module's dist/storage-providers/appsensor-storage-mysql/appsensor-storage-mysql-config.json in your working directory and set "database", "user" and "password" under "poolConfig".

Usage

Considering example under @appsensorlike/appsensorlike, now you just have to pass instances of MySQLAttackStore, MySQLEventStore, MySQLResponseStore to AppSensorLocal constructor

import { AppSensorLocal } from '@appsensorlike/appsensorlike/execution-modes/appsensor-local/appsensor_local.js';
import { AppSensorEvent, Category, DetectionPoint, DetectionSystem, User } from "@appsensorlike/appsensorlike/core/core.js";
import { MySQLAttackStore, MySQLEventStore, MySQLResponseStore } from "@appsensorlike/appsensorlike_storage_mysql";


const appSensorLocal = new AppSensorLocal('appsensor-server-config.json',
                                         new MySQLAttackStore(),
                                         new MySQLEventStore(),
                                         new MySQLResponseStore());
const eventManager = appSensorLocal.getAppSensorClient().getEventManager();

//following lines are added just for purpose of demonstration
//
const user1 = new User("user1");
const detectionPoint = new DetectionPoint(Category.REQUEST, "RE7");
const detectionSystem = new DetectionSystem("localhostme");

if (eventManager) {
   await eventManager.addEvent(new AppSensorEvent(user1, detectionPoint, detectionSystem)); 
   await eventManager.addEvent(new AppSensorEvent(user1, detectionPoint, detectionSystem)); //new instance every time to set timestamp
}

Check your db tables.

TypeScript support

You need TypeScript version >= 4.7 in order the paths exported by the module to be resolved.

Keywords

js

FAQs

Package last updated on 05 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts