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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@appsensorlike/appsensorlike_ui_web

v0.22.6

Published

AppSensorLikeUI web implementation

Downloads

5

Readme

@appsensorlike/appsensorlike Dashboard

alt text alt text

Installation

npm i @appsensorlike/appsensorlike_ui_web

Preparation

You have to create db tables, which hold users, user groups, and corresponding authorizations. Use MySQL script located in dependent module @appsensorlike/appsensorlike_ui under dist/appsensor-ui/security/mysql/sql.

Copy from the dependent module @appsensorlike/appsensorlike_ui dist/appsensor-ui/security/mysql/appsensor-ui-session-storage-mysql-config.json in your working directory and set "database", "user" and "password" under "poolOptions". This user is used to connect to db in order to check logging users credentials.

Usage

You have to have running websocket reporting engine server connected to running AppSensorLike server.

For example:

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 { AppSensorReportingWebSocketServer } from "@appsensorlike/appsensorlike_reporting_engines_websocket/server";

const appSensorLocal = new AppSensorLocal();
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) {
    //simulate some user malicious events
    //
    await eventManager.addEvent(new AppSensorEvent(user1, detectionPoint, detectionSystem)); 
    await eventManager.addEvent(new AppSensorEvent(user1, detectionPoint, detectionSystem)); //new instance every time to set timestamp
}

//simulate some user malicious events on interval
//see how Dashboard gets updated
setInterval(async () => {
    if (eventManager) {
        await eventManager.addEvent(new AppSensorEvent(user1, detectionPoint, detectionSystem));
    }
}, 10000);

//create and start the reporting engine server
const wsServer = new AppSensorReportingWebSocketServer(appSensorLocal.getAppSensorServer());
await wsServer.startServer();

If you have installed the geo locator module, you could also add geolocation along with the user's IP address. This will give you a visualization of user's location on GEO map.

For example:

import { AppSensorLocal } from '@appsensorlike/appsensorlike/execution-modes/appsensor-local/appsensor_local.js';
import { AppSensorEvent, Category, DetectionPoint, DetectionSystem, User, IPAddress } from "@appsensorlike/appsensorlike/core/core.js";
import { AppSensorReportingWebSocketServer } from "@appsensorlike/appsensorlike_reporting_engines_websocket/server";
import { FastGeoIPLocator } from "@appsensorlike/appsensorlike_geolocators_fast_geoip";

const appSensorLocal = new AppSensorLocal();
const eventManager = appSensorLocal.getAppSensorClient().getEventManager();

//following lines are added just for purpose of demonstration
//

const geoLocator = new FastGeoIPLocator();

const ipAddressUser = await IPAddress.fromString("83.228.0.0", geoLocator);
const user1 = new User("user1", ipAddressUser);

const ipAddressDetSystem = await IPAddress.fromString("80.80.128.0", geoLocator);
const detectionSystem = new DetectionSystem("localhostme", ipAddressDetSystem);

const detectionPoint = new DetectionPoint(Category.REQUEST, "RE7");


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

//simulate some user malicious events on interval
//see how Dashboard and Geo map get updated
setInterval(async () => {
    if (eventManager) {
        await eventManager.addEvent(new AppSensorEvent(user1, detectionPoint, detectionSystem));
    }
}, 10000);

//create and start the reporting engine server
const wsServer = new AppSensorReportingWebSocketServer(appSensorLocal.getAppSensorServer());
await wsServer.startServer();

Dashboard app creates a websocket reporting engine client, which by default tries to connect to ws://localhost:3000. By default it will try to reconnect on connection lost. You can change configuration as pointed in @appsensorlike/appsensorlike_reporting_engines_websocket under Configuration section.

  1. Run locally to installation of the module:

    npx @appsensorlike/appsensorlike_ui_web

  2. If you install the module globally (-g flag), you can run it with

    AppSensorLikeWeb

Authentication and authorization of clients

Authentication of the users is based on user name and password, which have to be set in advance by the administrator in ui_users table.

Authorization - authenticated users have to possess authorizations to access specific pages. They can be set for user or group.

  • VIEW_DATA - to access all pages but configuration
  • VIEW_CONFIGURATION - to access configuration

The authorizations are set by the administrator in ui_authorities table and link to a user or a group in corresponding ui_user_authorities and ui_groups, ui_group_authorities, ui_group_users.

Configuration

You can configure protocol http/s, port, etc via appsensor-ui-rest-server-config.json file in your working directory. You can copy the default configuration from the module's dist/appsensor-ui/web. Corresponding schem file appsensor-rest-server-config_schema.json is in the same directory.