
Research
Using Trusted Protocols Against You: Gmail as a C2 Mechanism
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.
AmIUnique is an npm package designed to generate a comprehensive browser fingerprint using various techniques. This package collects information about the user's browser and device to create a unique identifier, which can be used for analytics, fraud detection, or personalization.
Browser fingerprinting is a technique used to collect information about a user's device and browser configuration. By combining multiple pieces of information, such as installed fonts, screen resolution, and browser plugins, it is possible to create a unique identifier for a browser without using cookies or other tracking mechanisms.
The accuracy of browser fingerprinting depends on the amount and uniqueness of the collected data. Studies have shown that combining multiple attributes can achieve a high level of uniqueness, potentially identifying individual browsers with high accuracy. However, factors like browser updates, user configuration changes, and privacy measures can affect fingerprint stability.
Comprehensive Data Collection: Gathers a wide range of attributes, including:
User Behavior Tracking: Monitors user interactions such as mouse movements, clicks, and keyboard events.
Navigation Tracking: Tracks page visits, transitions, and time spent on pages.
Request Sequence Tracking: Monitors and analyzes sequences of network requests.
Asynchronous Operations: Utilizes asynchronous functions for non-blocking data collection.
Modular Design: Easily extensible with additional fingerprinting techniques.
Install AmIUnique using npm:
npm install amiunique
To utilize the full capabilities of AmIUnique, you can import the following functions and types:
amiunique()
: Generates a unique fingerprint of the user's browser.trackUserBehavior()
: Tracks user interactions such as mouse movements, clicks, and keyboard events.UserBehaviorTracker
: Type definition for the user behavior tracker.trackNavigation()
: Monitors navigation events like page visits and transitions.NavigationTracker
: Type definition for the navigation tracker.RequestSequenceTracker
: Utility class for tracking sequences of network requests.Attributes
: Type definition for the fingerprint attributes.Use the amiunique
function to generate a unique fingerprint:
import { amiunique, Attributes } from 'amiunique';
(async () => {
const fingerprint: Attributes | null = await amiunique();
console.log('Generated fingerprint:', fingerprint);
})();
The amiunique
function returns a Promise
that resolves to an Attributes
object containing various browser attributes and behavior patterns.
Use the trackUserBehavior
function to monitor user interactions:
import { trackUserBehavior, UserBehaviorTracker } from 'amiunique';
const tracker: UserBehaviorTracker = trackUserBehavior();
// Start tracking user behavior
tracker.start();
// Retrieve user behavior data
const behaviorPattern = tracker.getBehaviorPattern();
console.log('User behavior pattern:', behaviorPattern);
// Stop the tracker when done
tracker.stop();
The UserBehaviorTracker
captures mouse movements, clicks, and keyboard events.
Use the trackNavigation
function to track navigation events:
import { trackNavigation, NavigationTracker } from 'amiunique';
const navigationTracker: NavigationTracker = trackNavigation();
// Start tracking navigation events
navigationTracker.start();
// Retrieve navigation events data
const navigationEvents = navigationTracker.getNavigationEvents();
console.log('Navigation events:', navigationEvents);
// Stop the tracker when done
navigationTracker.stop();
Use the trackRequestSequence
to monitor and analyze sequences of network requests:
import { trackRequestSequence } from 'amiunique';
const requestTracker = trackRequestSequence();
// Start tracking request sequences
requestTracker.start();
// Perform network requests or operations
// Retrieve the recorded request sequences
const sequences = requestTracker.getSequences();
console.log('Request sequences:', sequences);
// Stop the tracker when done
requestTracker.stop();
The Attributes
type represents the structure of the fingerprint data returned by amiunique()
. Here's an updated version based on the current implementation:
interface Attributes {
user_agent: string;
language: string;
color_depth: number;
device_memory: number | 'not available';
hardware_concurrency: number | 'not available';
screen_resolution: string;
available_screen_resolution: string;
timezone_offset: number;
timezone: string;
session_storage: boolean;
local_storage: boolean;
indexed_db: boolean;
add_behavior: boolean;
open_database: boolean;
cpu_class: string;
platform: string;
plugins: string[] | 'not available';
canvas: string;
webgl: WebGLFingerprint | 'not available';
webgl_vendor: string | 'not available';
ad_block: boolean;
has_lied_languages: boolean;
has_lied_resolution: boolean;
has_lied_os: boolean;
has_lied_browser: boolean;
touch_support: TouchSupport;
fonts: string[] | 'not available';
audio: string;
enumerateDevices: string[] | 'not available';
available_resolution_height: number;
available_resolution_width: number;
battery_level: number | null;
charging: boolean | null;
chargingTime: number | null;
dischargingTime: number | null;
doNotTrack: string | null;
installed_fonts: string[];
installed_languages: string[];
cpu_architecture: string | null;
cpu_cores: number | null;
navigator_cpu_concurrency: number | null;
devicePixelRatio: number;
productSub: string;
emit_non_tri_dimpacts: boolean;
event_listener: boolean;
window_external: string;
window_status: string;
math_tan: string;
date_get_time_zone_off_set: string;
regexp_error_to_string: string;
error_generator: string;
// ... other attributes ...
}
This project is licensed under the MIT License. See the LICENSE file for more details.
We welcome contributions to AmIUnique! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
FAQs
Browser fingerprinting library
The npm package amiunique receives a total of 2 weekly downloads. As such, amiunique popularity was classified as not popular.
We found that amiunique demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Research
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.
Product
We redesigned Socket's first logged-in page to display rich and insightful visualizations about your repositories protected against supply chain threats.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.