Code Monkey home page Code Monkey logo

front-end-tracker's Introduction

Front-End Tracker

Keep track of events that can happen in a webpage.

Disclaimer: This add-on is not for web development. It is meant for testing web sites (debug, security). Its features may cause sites to break entirely, and which can cause privacy or even security issues. Use at your own risk.

Installation

npm install --save @zaproxy/front-end-tracker

Usage

When imported into a webpage, it exposes a mailbox variable in the global scope, which is a PubSub object with the following topics:

  • dom-events
  • storage

You can then react to these topics by subscribing to the mailbox.

For example, one can log DOM events' information using the following code:

const topic = 'dom-events';
mailbox.subscribe(topic, (_, data) => {
  console.log(data);
});

Import in your application

Use a CDN

The latest bundled version of this module is available at unpkg.com/browse/@zaproxy/front-end-tracker.

Insert the following snippet, preferably first in the <head> tag (to ensure it is run before anything else), to have it available in your webpage.

<script src="https://unpkg.com/@zaproxy/front-end-tracker@latest/dist/front-end-tracker.js"
    crossorigin="anonymous"></script>
If you use a JavaScript bundler

Such as webpack, rollup, browserify, ... All you need to do is to require this package in your application.

require('@zaproxy/front-end-tracker');

Import in any HTML page

You can use ZAP to inject a bundle of this package in HTTP responses.

inject.js is an HTTP Sender script (see more here) to inject any kind of JavaScript content into webpages that interest us.

  • Install the Script Console from the add-on marketplace.
  • Install the Community Scripts from the add-on marketplace.
  • Bundle the tracker from the source
git clone [email protected]:zaproxy/front-end-tracker.git
cd front-end-tracker
npm install
npm run build
  • Copy the bundled content to the imported location: cp dist/front-end-tracker.js /tmp/test.js
  • Enable the HTTP Sender > inject_js_in_html_page.js script from ZAP's interface

front-end-tracker's People

Contributors

dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar pamplemousse avatar psiinon avatar thc202 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

front-end-tracker's Issues

Publish on a CDN for ease of use

It would be handy for people to be able to inject into their HTML directly, using something like:

<script src='front-end-tracker.js'></script>

UNPKG is a web service serving content from npm.
As it is now, the version 1.0.0 of the front-end-tracker is published on there already: unpkg.com/@zaproxy/[email protected]/.
However, there is no bundled version to inject directly in the page.

One solution would be to have travis to run the build and push it to npm, without cleaning the generated dist/ file (see some example on my fork).

Then, hopefully, this would work:

<script src='https://unpkg.com/@zaproxy/[email protected]/dist/front-end-tracker.js'></script>

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.