!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/html/wincloud_gateway/node_modules/http-deceiver/test/   drwxr-xr-x
Free 12.99 GB of 57.97 GB (22.4%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     api-test.js (4.86 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
var assert = require('assert');
var net = require('net');
var http = require('http');
var streamPair = require('stream-pair');
var thing = require('handle-thing');

var httpDeceiver = require('../');

describe('HTTP Deceiver', function() {
  var handle;
  var pair;
  var socket;
  var deceiver;

  beforeEach(function() {
    pair = streamPair.create();
    handle = thing.create(pair.other);
    socket = new net.Socket({ handle: handle });

    // For v0.8
    socket.readable = true;
    socket.writable = true;

    deceiver = httpDeceiver.create(socket);
  });

  it('should emit request', function(done) {
    var server = http.createServer();
    server.emit('connection', socket);

    server.on('request', function(req, res) {
      assert.equal(req.method, 'PUT');
      assert.equal(req.url, '/hello');
      assert.deepEqual(req.headers, { a: 'b' });

      done();
    });

    deceiver.emitRequest({
      method: 'PUT',
      path: '/hello',
      headers: {
        a: 'b'
      }
    });
  });

  it('should emit response', function(done) {
    var agent = new http.Agent();
    agent.createConnection = function createConnection() {
      return socket;
    };
    var client = http.request({
      method: 'POST',
      path: '/ok',
      agent: agent
    }, function(res) {
      assert.equal(res.statusCode, 421);
      assert.deepEqual(res.headers, { a: 'b' });

      done();
    });

    process.nextTick(function() {
      deceiver.emitResponse({
        status: 421,
        reason: 'F',
        headers: {
          a: 'b'
        }
      });
    });
  });

  it('should override .execute and .finish', function(done) {
    var server = http.createServer();
    server.emit('connection', socket);

    server.on('request', function(req, res) {
      assert.equal(req.method, 'PUT');
      assert.equal(req.url, '/hello');
      assert.deepEqual(req.headers, { a: 'b' });

      var actual = '';
      req.on('data', function(chunk) {
        actual += chunk;
      });
      req.once('end', function() {
        assert.equal(actual, 'hello world');
        done();
      });
    });

    deceiver.emitRequest({
      method: 'PUT',
      path: '/hello',
      headers: {
        a: 'b'
      }
    });

    pair.write('hello');
    pair.end(' world');
  });

  it('should work with reusing parser', function(done) {
    var server = http.createServer();
    server.emit('connection', socket);

    function secondRequest() {
      pair = streamPair.create();
      handle = thing.create(pair.other);
      socket = new net.Socket({ handle: handle });

      // For v0.8
      socket.readable = true;
      socket.writable = true;

      server.emit('connection', socket);

      pair.end('PUT /second HTTP/1.1\r\nContent-Length:11\r\n\r\nhello world');
    }

    server.on('request', function(req, res) {
      var actual = '';
      req.on('data', function(chunk) {
        actual += chunk;
      });
      req.once('end', function() {
        assert.equal(actual, 'hello world');

        if (req.url === '/first')
          secondRequest();
        else
          done();
      });
    });

    deceiver.emitRequest({
      method: 'PUT',
      path: '/first',
      headers: {
        a: 'b'
      }
    });

    pair.write('hello');
    pair.end(' world');
  });

  it('should emit CONNECT request', function(done) {
    var server = http.createServer();
    server.emit('connection', socket);

    server.on('connect', function(req, socket, bodyHead) {
      assert.equal(req.method, 'CONNECT');
      assert.equal(req.url, '/hello');

      done();
    });

    deceiver.emitRequest({
      method: 'CONNECT',
      path: '/hello',
      headers: {
      }
    });
  });

  it('should emit Upgrade request', function(done) {
    var server = http.createServer();
    server.emit('connection', socket);

    server.on('upgrade', function(req, socket, bodyHead) {
      assert.equal(req.method, 'POST');
      assert.equal(req.url, '/hello');

      socket.on('data', function(chunk) {
        assert.equal(chunk + '', 'hm');
        done();
      });
    });

    deceiver.emitRequest({
      method: 'POST',
      path: '/hello',
      headers: {
        'upgrade': 'websocket'
      }
    });

    pair.write('hm');
  });

  it('should emit Upgrade response', function(done) {
    var agent = new http.Agent();
    agent.createConnection = function createConnection() {
      return socket;
    };
    var client = http.request({
      method: 'POST',
      path: '/ok',
      headers: {
        connection: 'upgrade',
        upgrade: 'websocket'
      },
      agent: agent
    }, function(res) {
      assert(false);
    });
    client.on('upgrade', function(res, socket) {
      assert.equal(res.statusCode, 421);
      done();
    });

    process.nextTick(function() {
      deceiver.emitResponse({
        status: 421,
        reason: 'F',
        headers: {
          upgrade: 'websocket'
        }
      });
    });
  });
});

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.065 ]--