Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
CLI 🖥 + API for Google PageSpeed Insights
PageSpeed Insights (PSI) reports on the performance of a page on both mobile and desktop devices, and provides suggestions on how that page may be improved.
PSI provides both lab and field data about a page. Lab data is useful for debugging performance issues, as it is collected in a controlled environment. However, it may not capture real-world bottlenecks. Field data is useful for capturing true, real-world user experience - but has a more limited set of metrics.
PyPSI
uses PageSpeed Insights API v5
pip install PythonPSI
Google seems to have made it mandatory to use an API key, otherwise you may reach service quota limits too soon. Get one from here.
psi <SITE_URL> <OPTION1> <OPTION2> ...
Example:
$ psi developers.google.com --category seo --stratergy desktop --locale en
{
"captchaResult": "CAPTCHA_NOT_NEEDED",
"kind": "pagespeedonline#result",
"id": "https://developers.google.com/",
"loadingExperience": {
...
},
"originLoadingExperience": {
...
},
"lighthouseResult": {
...
},
"analysisUTCTimestamp": {
...
}
$ psi --help
Usage: psi [OPTIONS] URL
Options:
--api_key TEXT Required to use the API in an automated way and make
multiple requests per second
--category TEXT A Lighthouse category to run; if none are given, only
Performance category will be run
--metrics TEXT Returns metrics of a particular field in response
object
--locale TEXT The locale used to localize formatted results
--stratergy TEXT The analysis stratergy (desktop or mobile) to use, and
desktop is the default
--threshold TEXT Threshold score to pass the PageSpeed test. Useful for
setting a performance budget.
--links TEXT If passed adds links with more info about
opportunities. Useful for checking documentation about
opportunities.
--utm_campaign TEXT Campaign name for analytics.
--utm_source TEXT Campaign source for analytics.
--captcha_token TEXT The captcha token passed when filling out a captcha.
--help Show this message and exit.
from PythonPSI.api import PSI
PSI('google.com', category='seo', locale='en', stratergy='desktop')
# Returns JSON output
PSI
- Required arguments: 1, Optional arguments: 9
URL
:
api_key
:
category
:
accessibility
, best_practices
, performance
, pwa
, seo
metrics
:
kind
, captchaResult
, id
, loadingExperience
, originLoadingExperience
, analysisUTCTimestamp
, lighthouseResult
, version
locale
:
stratergy
:
desktop
, mobile
threshold
:
INT
0-100links
:
true
, false
utm_campaign
:
utm_source
:
captcha_token
:
FAQs
CLI + API for Google PageSpeed Insights
We found that PythonPSI 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.