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.
.. image:: https://travis-ci.org/lorien/user_agent.png?branch=master :target: https://travis-ci.org/lorien/user_agent?branch=master
.. image:: https://ci.appveyor.com/api/projects/status/jbyd2b9dfq99fvs3 :target: https://ci.appveyor.com/project/lorien/user-agent
.. image:: https://readthedocs.org/projects/user_agent/badge/?version=latest :target: http://user-agent.readthedocs.org
This module is for generating random, valid web user agents:
window.navigator
JavaScript object.. code:: python
>>> from user_agent import generate_user_agent, generate_navigator
>>> from pprint import pprint
>>> generate_user_agent()
'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.3; Win64; x64)'
>>> generate_user_agent(os=('mac', 'linux'))
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:36.0) Gecko/20100101 Firefox/36.0'
>>> pprint(generate_navigator())
{'app_code_name': 'Mozilla',
'app_name': 'Netscape',
'appversion': '5.0',
'name': 'firefox',
'os': 'linux',
'oscpu': 'Linux i686 on x86_64',
'platform': 'Linux i686 on x86_64',
'user_agent': 'Mozilla/5.0 (X11; Ubuntu; Linux i686 on x86_64; rv:41.0) Gecko/20100101 Firefox/41.0',
'version': '41.0'}
>>> pprint(generate_navigator_js())
{'appCodeName': 'Mozilla',
'appName': 'Netscape',
'appVersion': '38.0',
'platform': 'MacIntel',
'userAgent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:38.0) Gecko/20100101 Firefox/38.0'}
.. code:: shell
$ ua
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:49.0) Gecko/20100101 Firefox/49.0
$ ua -n chrome -e
{
"oscpu": "Linux i686 on x86_64",
"appName": "Netscape",
"appCodeName": "Mozilla",
"appVersion": "55.0.2909.25",
"platform": "X11; Linux i686 on x86_64",
"userAgent": "Mozilla/5.0 (X11; Linux i686 on x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2909.25 Safari/537.36"
}
.. code:: shell
$ pip install -U user_agent
Documentation is available at http://user-agent.readthedocs.org
Use github to submit bug,fix or wish request: https://github.com/lorien/user_agent/issues
FAQs
User-Agent generator
We found that user-agent demonstrated a healthy version release cadence and project activity because the last version was released less than 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.