Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
next-useragent
Advanced tools
next-useragent
parses browser user-agent strings for next.js.
$ npm install next-useragent
next-useragent
is simple to use.
First parse a string with parse
and then access the fields of UserAgent
for the required information.
Example usage:
import React from 'react'
import { UserAgent, parse } from 'next-useragent'
interface Props {
ua: UserAgent
}
export default class IndexPage extends React.Component<Props> {
static async getInitialProps(ctx) {
const ua = parse(ctx)
return { ua }
}
render() {
const { ua } = this.props
return (
<ul>
<li>Original source: { ua.source }</li>
<li>Device Type: { ua.deviceType }</li>
<li>Device Vendor: { ua.deviceVendor }</li>
<li>OS Name: { ua.os }</li>
<li>OS Version: { ua.osVersion }</li>
<li>Browser Name: { ua.browser }</li>
<li>Browser Version: { ua.browserVersion }</li>
<li>is iPhone?: { ua.isIphone ? 'yes' : 'no' }</li>
<li>is iPad?: { ua.isIpad ? 'yes' : 'no' }</li>
<li>is mobile?: { ua.isMobile ? 'yes' : 'no' }</li>
<li>is tablet?: { ua.isTablet ? 'yes' : 'no' }</li>
<li>is desktop?: { ua.isDesktop ? 'yes' : 'no' }</li>
<li>is Chrome?: { ua.isChrome ? 'yes' : 'no' }</li>
<li>is Firefox?: { ua.isFirefox ? 'yes' : 'no' }</li>
<li>is Safari?: { ua.isSafari ? 'yes' : 'no' }</li>
<li>is Internet Explorer?: { ua.isIE ? 'yes' : 'no' }</li>
<li>is Mac?: { ua.isMac ? 'yes' : 'no' }</li>
<li>is ChromeOS?: { ua.isChromeOS ? 'yes' : 'no' }</li>
<li>is Windows?: { ua.isWindows ? 'yes' : 'no' }</li>
<li>is iOS?: { ua.isIos ? 'yes' : 'no' }</li>
<li>is Android?: { ua.isAndroid ? 'yes' : 'no' }</li>
<li>is bot?: { ua.isBot ? 'yes' : 'no' }</li>
</ul>
)
}
}
next-useragent
is licensed under MIT License.
See LICENSE for more information.
FAQs
next-useragent parses browser user-agent strings for next.js.
The npm package next-useragent receives a total of 0 weekly downloads. As such, next-useragent popularity was classified as not popular.
We found that next-useragent 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
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.