
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
chrome-track-activity
Advanced tools
Utility function to track browsing activity in a Chrome extension
Utility function to track browsing activity in a Chrome extension.
This package exports a single function startTrackingActivity
which can be used to track a user's browsing activity.
The following example demonstates its usage:
function onSessionStart(session) {
console.log("START", session.startTime, session.url);
}
function onSessionEnd(session) {
console.log("END", session.endTime, session.url);
}
var stopTracking = startTrackingActivity(onSessionStart, onSessionEnd);
startTrackingActivity
accepts two arguments:
onSessionStart
: Invoked each time the user loads a new page in the foreground tab or navigates to an existing page. The argument session
contains the url
, startTime
and tabId
for the new page.
onSessionEnd
: Invoked each time the user loads a new page in the foreground tab, changes the tab or window, closes the foreground tab, or leaves the browser window. The argument session
contains the url
, startTime
, tabId
and endTime
for the page that was closed/changed.
The return value of startTrackingActivity
is another function, which can called to discontinue tracking when it is no longer required.
IMPORTANT NOTE: To use startTrackingAcvitity
, you need to declare the "tabs" permission in your extension's manifest file.
The easiest way to add the utility startTrackingActivity
is to copy-paste the code from tracking.js
into your background script/page. It's only 70 lines!
<script>
tagFirst download the the file into your extension directory using the following command:
curl -O https://raw.githubusercontent.com/aakashns/chrome-track-activity/master/tracking.js
Then include it in your background page using a script tag:
<head>
<script src="tracking.js"></script>
</head>
Check out the example for an example of this approach.
npm
Install the package from npm by running:
npm install chrome-track-activity --save
Then include it in your script using require
:
var startTrackingActivity = require('chrome-track-activity');
The example
directory contains and example extension which uses startTrackingActivity
to log the browsing activity of the user.
First, clone the repository:
git clone https://github.com/aakashns/chrome-track-activity.git
Then, follow the instructions on this page to load the extension into your browser.
Then, visit chrome://extensions and inspect the background page:
Open the 'Console' tab, leave the inspector window, and continue using the browser normally. You should see a log of the browsing activity as you enter and leave pages, like this:
The logic for the extension lives is background.js.
FAQs
Utility function to track browsing activity in a Chrome extension
The npm package chrome-track-activity receives a total of 0 weekly downloads. As such, chrome-track-activity popularity was classified as not popular.
We found that chrome-track-activity demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.