
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.
client-parser
Advanced tools
A utility to detect the device type (Android, iOS, Windows Phone, PC, unknown) based on the User Agent string.
The client-parser is a utility to detect detailed device information from the browser's User Agent string.
isMobile
, isTablet
) for quick checks.DeviceInfo
interface) for enhanced code safety and developer experience.To install the package, run the following command:
npm install client-parser
or
yarn add client-parser
or
pnpm add client-parser
or
bun add client-parser
const getDeviceType = require('client-parser');
const deviceInfo = getDeviceType();
// Log some of the detected information
console.log('Device Type:', deviceInfo.type); // Outputs: e.g., "pc", "android", "ios", "unknown"
console.log('Operating System:', deviceInfo.os); // Outputs: e.g., "Windows", "Android", "iOS"
console.log('Browser:', deviceInfo.browser); // Outputs: e.g., "Chrome", "Safari", "Firefox"
console.log('Is Mobile:', deviceInfo.isMobile); // Outputs: true or false
console.log('Is Tablet:', deviceInfo.isTablet); // Outputs: true or false
import getDeviceType from 'client-parser';
const deviceInfo = getDeviceType();
// Log some of the detected information
console.log('Device Type:', deviceInfo.type); // Outputs: e.g., "pc", "android", "ios", "unknown"
console.log('Operating System:', deviceInfo.os); // Outputs: e.g., "Windows", "Android", "iOS"
console.log('Browser:', deviceInfo.browser); // Outputs: e.g., "Chrome", "Safari", "Firefox"
console.log('Is Mobile:', deviceInfo.isMobile); // Outputs: true or false
console.log('Is Tablet:', deviceInfo.isTablet); // Outputs: true or false
import getDeviceType, { IDeviceInfo } from 'client-parser';
const currentDevice: IDeviceInfo = getDeviceType();
// Log some of the detected information
console.log('Device Type:', deviceInfo.type); // Outputs: e.g., "pc", "android", "ios", "unknown"
console.log('Operating System:', deviceInfo.os); // Outputs: e.g., "Windows", "Android", "iOS"
console.log('Browser:', deviceInfo.browser); // Outputs: e.g., "Chrome", "Safari", "Firefox"
console.log('Is Mobile:', deviceInfo.isMobile); // Outputs: true or false
console.log('Is Tablet:', deviceInfo.isTablet); // Outputs: true or false
The getDeviceType() function returns an object conforming to the DeviceInfo interface, providing comprehensive details about the client's environment.
export interface DeviceInfo {
/** The general category of the device: "android", "ios", "windows_phone", "pc", or "unknown". */
type: 'android' | 'ios' | 'windows_phone' | 'pc' | 'unknown';
/** The operating system name (e.g., "Android", "iOS", "Windows", "macOS", "Linux"). */
os?: string;
/** The version of the operating system. */
osVersion?: string;
/** True if the device is likely a tablet, false otherwise. */
isTablet?: boolean;
/** True if the device is a mobile phone or tablet, false otherwise. */
isMobile?: boolean;
/** The name of the browser (e.g., "Chrome", "Safari", "Firefox", "Edge", "IE", "Opera"). */
browser?: string;
/** The version of the browser. */
browserVersion?: string;
}
This project is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).
For more details, please visit the Creative Commons License Page.
Special thanks to the following resources:
User Agent string parsing is generally effective but not 100% foolproof. User Agents can be spoofed, incomplete, or vary across different browser versions and custom builds. For critical applications, consider combining this with feature detection (e.g., checking for specific browser APIs) for more robust results.
No, this library focuses on broader device categories (phone, tablet, PC) and operating systems. Detecting specific device models from the User Agent string alone is often unreliable and not within the scope of this lightweight utility.
You can remove the package by running:
npm uninstall client-parser
or
yarn remove client-parser
or
pnpm remove client-parser
or
bun remove client-parser
M♢NTΛSIM |
FAQs
A utility to detect the device type (Android, iOS, Windows Phone, PC, unknown) based on the User Agent string.
The npm package client-parser receives a total of 5 weekly downloads. As such, client-parser popularity was classified as not popular.
We found that client-parser 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.
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.