
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
The 'platform' npm package is a platform detection library that can be used to identify the operating system, browser, and engine of the platform on which the current script is running. It can be used in both browser and Node.js environments.
Operating System Detection
This feature allows you to detect the operating system of the user's device. The code sample demonstrates how to import the platform module and log the operating system information to the console.
const platform = require('platform');
console.log(platform.os);
Browser Detection
This feature enables you to detect the browser name and version. The code sample shows how to log the browser name and version to the console.
const platform = require('platform');
console.log(platform.name + ' ' + platform.version);
Engine Detection
This feature is used to detect the layout engine of the browser. The code sample illustrates how to log the layout engine information to the console.
const platform = require('platform');
console.log(platform.layout);
Device Detection
This feature allows you to detect the specific device (e.g., 'iPad', 'iPhone'). The code sample demonstrates how to log the device information to the console.
const platform = require('platform');
console.log(platform.product);
User-Agent Parsing
This feature provides a method to parse a user-agent string and extract detailed information about the platform. The code sample shows how to parse a user-agent string and log the resulting object.
const platform = require('platform');
const info = platform.parse('Mozilla/5.0 (Windows NT 10.0; Win64; x64)');
console.log(info);
ua-parser-js is a user-agent string parser that can detect browser, engine, OS, CPU, and device type/model from the user-agent string. It offers similar functionality to 'platform' but with a focus on user-agent string parsing and additional details like CPU architecture.
detect-browser is a simple package for detecting a browser. It is smaller and more lightweight than 'platform' but does not provide as much detailed information about the operating system or device.
bowser is a browser detection library that is more feature-rich than 'platform', providing detailed information about the browser, engine, platform, OS, and whether certain features are supported in the browser.
A platform detection library that works on nearly all JavaScript platforms.
Platform.js is for informational purposes only & not intended as a substitution for feature detection/inference checks.
In a browser:
<script src="platform.js"></script>
In an AMD loader:
require(['platform'], function(platform) {/*…*/});
Using npm:
$ npm i --save platform
In Node.js:
var platform = require('platform');
Usage example:
// on IE10 x86 platform preview running in IE7 compatibility mode on Windows 7 64 bit edition
platform.name; // 'IE'
platform.version; // '10.0'
platform.layout; // 'Trident'
platform.os; // 'Windows Server 2008 R2 / 7 x64'
platform.description; // 'IE 10.0 x86 (platform preview; running in IE 7 mode) on Windows Server 2008 R2 / 7 x64'
// or on an iPad
platform.name; // 'Safari'
platform.version; // '5.1'
platform.product; // 'iPad'
platform.manufacturer; // 'Apple'
platform.layout; // 'WebKit'
platform.os; // 'iOS 5.0'
platform.description; // 'Safari 5.1 on Apple iPad (iOS 5.0)'
// or parsing a given UA string
var info = platform.parse('Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7.2; en; rv:2.0) Gecko/20100101 Firefox/4.0 Opera 11.52');
info.name; // 'Opera'
info.version; // '11.52'
info.layout; // 'Presto'
info.os; // 'Mac OS X 10.7.2'
info.description; // 'Opera 11.52 (identifying as Firefox 4.0) on Mac OS X 10.7.2'
Tested in Chrome 82-83, Firefox 77-78, IE 11, Edge 82-83, Safari 12-13, Node.js 4-14, & PhantomJS 2.1.1.
Platform.js is part of the BestieJS “Best in Class” module collection. This means we promote solid browser/environment support, ES5+ precedents, unit testing, & plenty of documentation.
FAQs
A platform detection library that works on nearly all JavaScript platforms.
The npm package platform receives a total of 1,666,287 weekly downloads. As such, platform popularity was classified as popular.
We found that platform demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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 Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.