
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.
puppeteer-capture
Advanced tools
A Puppeteer plugin for capturing page as a video with ultimate quality.
A Puppeteer plugin for capturing page as a video with ultimate quality.
This project is brought to you by Alexey Pelykh.
HeadlessExperimental
is used to
capture frames in a deterministic way. This approach allows to achieve better quality than using screencast.
const { capture, launch } = require('puppeteer-capture')
(async () => {
const browser = await launch()
const page = await browser.newPage()
const recorder = await capture(page)
await page.goto('https://google.com', {
waitUntil: 'networkidle0',
})
await recorder.start('capture.mp4')
await recorder.waitForTimeout(1000)
await recorder.stop()
await recorder.detach()
await browser.close()
})()
The browser is running in a deterministic mode, thus the time flow is not real time. To wait for a certain amount of
time within the page's timeline, PuppeteerCapture.waitForTimeout()
must be used:
await recorder.waitForTimeout(1000)
--headless=new
is not supportedSadly, it is so. For Puppeteer v23+, the plugin enforces use
of the chrome-headless-shell
binary.
117.0.5938.88
(default for puppeteer
version(s) 21.3.0
): reacts with targetCrashed
117.0.5938.92
(default for puppeteer
version(s) 21.3.2
…21.3.6
): reacts with targetCrashed
117.0.5938.149
(default for puppeteer
version(s) 21.3.7
…21.3.8
): reacts with targetCrashed
118.0.5993.70
(default for puppeteer
version(s) 21.4.0
…21.4.1
): reacts with targetCrashed
119.0.6045.105
(default for puppeteer
version(s) 21.5.0
…21.7.0
): reacts with targetCrashed
120.0.6099.109
(default for puppeteer
version(s) 21.8.0
): reacts with targetCrashed
Unfortunately, it is so.
This relates to timers, animations, clicks, etc. To process interaction with the page, frame requests have to be submitted and thus capturing have to be active.
defaultViewport
causes rendering to freezeThe exact origin of the issue is not yet known, yet it's likely to be related to the deterministic mode.
Calling page.setViewport()
before starting the capture behaves the same, yet calling it after starting the capture
works yet not always. Thus it's safe to assume that there's some sort of race condition, since adding
recorder.waitForTimeout(100)
just before setting the viewport workarounds the issue.
Also it should be taken into account that since frame size is going to change over the time of the recording, frame size autodetection will fail. To workaround this issue, frame size have to be specified:
const recorder = await capture(page, {
size: `${viewportWidth}x${viewportHeight}`,
})
await recorder.start('capture.mp4', { waitForFirstFrame: false })
await recorder.waitForTimeout(100)
await page.setViewport({
width: viewportWidth,
height: viewportHeight,
deviceScaleFactor: 1.0,
})
A friendlier workaround is enabled by default: recorder.start()
automatically waits for the first frame to be
captured. This approach seems to allow bypassing the alleged race condition:
const recorder = await capture(page, {
size: `${viewportWidth}x${viewportHeight}`,
})
await recorder.start('capture.mp4')
await page.setViewport({
width: viewportWidth,
height: viewportHeight,
deviceScaleFactor: 1.0,
})
start()
/stop()
failIt's unclear why, yet after disabling and re-enabling the capture, callbacks from browser stop arriving.
The following functions have to be overriden with injected versions:
setTimeout
& clearTimeout
setInterval
& clearInterval
requestAnimationFrame
& cancelAnimationFrame
Date()
& Date.now()
performance.now()
The injection should happen before page content loads:
const recorder = await capture(page) // Injection happens here during attach()
await page.goto('https://google.com') // Possible capture would happen here, thus injected versions would be captured
PuppeteerCapture
supports following events:
captureStarted
: capture was successfully startedframeCaptured
: frame was capturedframeCaptureFailed
: frame capture failedframeRecorded
: frame has been submitted to ffmpeg
captureStopped
: capture was stoppedffmpeg
It is resolved in the following order:
FFMPEG
environment variable, should point to the executablePATH
environment variable@ffmpeg-installer/ffmpeg
, if it's installed as dependencyFAQs
A Puppeteer plugin for capturing page as a video with ultimate quality.
The npm package puppeteer-capture receives a total of 16 weekly downloads. As such, puppeteer-capture popularity was classified as not popular.
We found that puppeteer-capture 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
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.