/chatur

A kiddy approach to scan open ports of client workstation using CORS https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS approach.

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Chatur: A Javascript based Port Scanner👁️

License

Docker

Description

Demonstrates possible way to identify services running at client workstation. The tool makes request to range of ports to identify services running on that port or not.

Calculation on each port

  1. Measure time before sending request to port.
  2. Measure time took to send headers
  3. Measure time took to send body
  4. Calculate an average time took for sending headers and response body.
  5. If the average response time is above or equal to 100 Microseconds, assume there is any service running on port.

The strategy is inspired from similar well-known tool JS-Recon.

Dependencies

Testing (Optional)

Install dependency

make install

Make sure npm is installed. This command will install npm based dependencies.

Build

make build

Will create an output directory. Open the file index.html at your browser.

Run

make run

It will run start the HTTP server on port 8080. Make sure you have ran make build to get output of latest code.

Docker (Testing)

Docker hub

docker run --rm --port 8080:8080 jaysinhp/javascript-port-scanner:latest

Above command will fetch the latest image from the Docker hub. You can access the tool at port http://localhost:8080. Make sure the port 8080 is empty.

Lint

make javascript-lint

Will lint source/assests/js/main.js file against common Javascript conventions.

make html-lint

Will lint source/html/index.html file against common HTML5 based conventions.

Local

make docker-build

It command will make the build of the docker image. Make sure [Docker][docker] is installed.

make docker-run

It will start the container and bind on port 8080 of the host.

End to End tests

Tests are written in Selenium wrapper of Python.

Build

Install Pipenv tool to create virtual-environment. Locate to end-to-end-tests directory. Make sure Selenium is installed.

pipenv shell

Use this command to activate virtual-environment prioer to running end to end tests.

pipenv install

Run this command once to install all the Python dependencies.

make test-end-to-end

This command will run bunch of functional tests on the tool. Make sure the tool is running at http://localhost:8080. You can find instrucions to run the tool. You can override the target host and port values by creating environment variables TARGET_HOST and TARGET_PORT respectively.

License

GPL v3