mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-24 06:59:52 +01:00
wombat: override window.crypto.getRandomValues() with seeded random
This commit is contained in:
parent
8e90ea6576
commit
08cb02c644
@ -678,6 +678,20 @@ var wombat_internal = function($wbwindow) {
|
|||||||
Math.random = seeded_random;
|
Math.random = seeded_random;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function init_crypto_random() {
|
||||||
|
var orig_getrandom = $wbwindow.Crypto.prototype.getRandomValues;
|
||||||
|
|
||||||
|
var new_getrandom = function(array) {
|
||||||
|
for (i = 0; i < array.length; i++) {
|
||||||
|
array[i] = parseInt(Math.random() * 65535);
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
|
$wbwindow.Crypto.prototype.getRandomValues = new_getrandom;
|
||||||
|
$wbwindow.crypto.getRandomValues = new_getrandom;
|
||||||
|
}
|
||||||
|
|
||||||
//============================================
|
//============================================
|
||||||
function override_history_func(func_name) {
|
function override_history_func(func_name) {
|
||||||
if (!$wbwindow.history) {
|
if (!$wbwindow.history) {
|
||||||
@ -2177,6 +2191,9 @@ var wombat_internal = function($wbwindow) {
|
|||||||
// Random
|
// Random
|
||||||
init_seeded_random(wbinfo.wombat_sec);
|
init_seeded_random(wbinfo.wombat_sec);
|
||||||
|
|
||||||
|
// Crypto Random
|
||||||
|
init_crypto_random();
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
init_date_override(wbinfo.wombat_sec);
|
init_date_override(wbinfo.wombat_sec);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user