GithubHelp home page GithubHelp logo

denizariyan / vsterilizer Goto Github PK

View Code? Open in Web Editor NEW
11.0 1.0 0.0 865 KB

VSterilizer is a USB scanning service that scans any USB device plugged into the computer that is running the scanner utility and reports the results through API endpoints.

License: MIT License

JavaScript 93.97% Shell 6.03%
cybersecurity linux usb usb-scanning virus virus-scanning clamav clamav-antivirus clamav-scanning

vsterilizer's Introduction

VSterilizer

node.js (https://github.com/denizariyan/VSterilizer/actions/workflows/codeql-analysis.yml)

VSterilizer is a USB scanning service that scans any USB device plugged into the computer that is running the scanner utility and reports the results through API endpoints.

Intro

flowchart use_case

Installation and Usage

This installation steps assume that you are running Fedora 35. There could be slight changes to the shell commands if you are running another distro but the steps in general will be the same.

1. Use the package manager dnf to install NodeJS

sudo dnf install nodejs

2. Clone the repo

git clone https://github.com/denizariyan/VSterilizer.git

3. Install the dependencies

npm install

4. Install ClamAV

sudo dnf install clamav clamd clamav-update

Usage

1. Run the main script using

sudo node main.js

2. After running the script you will get a response similar to the one below mentioning that both the the scanner utility and the API listener utility is running

Started to monitor for USB inserts!
Listening on port 8080!

3. Plug a USB device to the computer

4. The script will detect the newly plugged in USB device and start scanning it immediately and send a status message to the API endpoint that it is accessing a new USB device. Example API call below

{
  args: {},
  data: '{"status":"Accessing the USB Device..."}',
  files: {},
  form: {},
  headers: {
    Accept: 'application/json, text/plain, */*',
    'Content-Length': '40',
    'Content-Type': 'application/json',
    Host: 'httpbin.org',
    'User-Agent': 'axios/0.26.1',
    'X-Amzn-Trace-Id': 'Root=1-626fcfec-21c50ae55f9e79a838a867aa'
  },
  json: { status: 'Accessing the USB Device...' },
  origin: '<SENDER_IP_ADDRESS>',
  url: 'http://httpbin.org/post'
}

5. After the scanning is complete a result message will be sent to the API endpoint

For clean USB devices

{
  args: {},
  data: '{"status":"Scan completed, no infected files has been detected."}',
  files: {},
  form: {},
  headers: {
    Accept: 'application/json, text/plain, */*',
    'Content-Length': '65',
    'Content-Type': 'application/json',
    Host: 'httpbin.org',
    'User-Agent': 'axios/0.26.1',
    'X-Amzn-Trace-Id': 'Root=1-626fcff2-39b0b20222be8fd42873f046'
  },
  json: { status: 'Scan completed, no infected files has been detected.' },
  origin: '<SENDER_IP_ADDRESS>',
  url: 'http://httpbin.org/post'
}

For USB devices with infected files

First a status message that mentions that the USB device is infected will be sent.

{
  args: {},
  data: '{"status":"Scan completed, check infected file list!"}',
  files: {},
  form: {},
  headers: {
    Accept: 'application/json, text/plain, */*',
    'Content-Length': '54',
    'Content-Type': 'application/json',
    Host: 'httpbin.org',
    'User-Agent': 'axios/0.26.1',
    'X-Amzn-Trace-Id': 'Root=1-626fd172-2951bf061e93fc434ad08ce5'
  },
  json: { status: 'Scan completed, check infected file list!' },
  origin: '<SENDER_IP_ADDRESS>',
  url: 'http://httpbin.org/post'
}

After that a result message that includes the details of the infected file(s) will be sent.

{
  args: {},
  data: '{"badFile":"eicar.com","virus":"Win.Test.EICAR_HDB-1"}',
  files: {},
  form: {},
  headers: {
    Accept: 'application/json, text/plain, */*',
    'Content-Length': '54',
    'Content-Type': 'application/json',
    Host: 'httpbin.org',
    'User-Agent': 'axios/0.26.1',
    'X-Amzn-Trace-Id': 'Root=1-626fd172-2de80c305bd1bb492dd73e42'
  },
  json: { badFile: 'eicar.com', virus: 'Win.Test.EICAR_HDB-1' },
  origin: '<SENDER_IP_ADDRESS>',
  url: 'http://httpbin.org/post'
}

Testing

This will run all automated tests and report back the results.

npm test

Example test result

$ npm test

> [email protected] test /home/deari/projects/VSterilizer
> jest --silent=true

 PASS  tests/config.test.js
 PASS  tests/scan.test.js

Test Suites: 2 passed, 2 total
Tests:       5 passed, 5 total
Snapshots:   0 total
Time:        0.928 s, estimated 1 s

Flowchart

flowchart

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.