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.
screenshotmachine
Advanced tools
node.js API library for the ScreenshotMachine - online website capturing service
This demo shows how to call online screenshot machine API using Node.js - JavaScript run-time environment.
Install Node.js package:
npm install screenshotmachine --save
First, you need to create a free/premium account at www.screenshotmachine.com website. After registration, you will see your customer key in your user profile. Also secret phrase is maintained here. Please, use secret phrase always, when your API calls are called from publicly available websites.
Set-up your customer key and secret phrase (if needed) in the script:
var customerKey = 'PUT_YOUR_CUSTOMER_KEY_HERE';
secretPhrase = ''; //leave secret phrase empty, if not needed
Set other options to fulfill your needs:
options = {
//mandatory parameter
url : 'https://www.google.com',
// all next parameters are optional, see our API guide for more details
dimension : '1366xfull', // or "1366xfull" for full length screenshot
device : 'desktop',
format: 'png',
cacheLimit: '0',
delay: '200'
}
More info about options can be found in our API guide.
var screenshotmachine = require('screenshotmachine');
var customerKey = 'PUT_YOUR_CUSTOMER_KEY_HERE';
secretPhrase = ''; //leave secret phrase empty, if not needed
options = {
//mandatory parameter
url : 'https://www.google.com',
// all next parameters are optional, see our API guide for more details
dimension : '1366xfull', // or "1366xfull" for full length screenshot
device : 'desktop',
format: 'png',
cacheLimit: '0',
delay: '200'
}
var apiUrl = screenshotmachine.generateApiUrl(customerKey, secretPhrase, options);
//put link to your html code
console.log('<img src="' + apiUrl + '">');
Generated apiUrl
link can be placed in <img>
tag or used in your business logic later.
If you need to store captured screenshot as an image, just call:
var screenshotmachine = require('screenshotmachine');
var customerKey = 'PUT_YOUR_CUSTOMER_KEY_HERE';
secretPhrase = ''; //leave secret phrase empty, if not needed
options = {
//mandatory parameter
url : 'https://www.google.com',
// all next parameters are optional, see our API guide for more details
dimension : '1366xfull', // or "1366xfull" for full length screenshot
device : 'desktop',
format: 'png',
cacheLimit: '0',
delay: '200'
}
var apiUrl = screenshotmachine.generateApiUrl(customerKey, secretPhrase, options);
//save screenshot as an image
var fs = require('fs');
var output = 'output.png';
screenshotmachine.readScreenshot(apiUrl).pipe(fs.createWriteStream(output).on('close', function() {
console.log('Screenshot saved as ' + output);
}));
Captured screenshot will be saved as output.png
file in current directory.
The MIT License (MIT)
FAQs
Captures website screenshot and converts website to PDF using Screenshot machine - online website screenshot generator and website to PDF converter
The npm package screenshotmachine receives a total of 19 weekly downloads. As such, screenshotmachine popularity was classified as not popular.
We found that screenshotmachine 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.
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.