AnonSec Shell
Server IP : 185.86.78.101  /  Your IP : 216.73.216.124
Web Server : Apache
System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /www/wwwroot/mifepriston.org/node_modules/localtunnel/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /www/wwwroot/mifepriston.org/node_modules/localtunnel/test/index.js
var http = require('http');
var https = require('https');
var url = require('url');
var assert = require('assert');

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

test('setup local http server', function(done) {
    var server = http.createServer();
    server.on('request', function(req, res) {
        res.write(req.headers.host);
        res.end();
    });
    server.listen(function() {
        var port = server.address().port;

        test._fake_port = port;
        console.log('local http on:', port);
        done();
    });
});

test('setup localtunnel client', function(done) {
    localtunnel(test._fake_port, function(err, tunnel) {
        assert.ifError(err);
        assert.ok(new RegExp('^https:\/\/.*localtunnel.me' + '$').test(tunnel.url));
        test._fake_url = tunnel.url;
        done();
    });
});

test('query localtunnel server w/ ident', function(done) {
    var uri = test._fake_url;
    var parsed = url.parse(uri);

    var opt = {
        host: parsed.host,
        port: 443,
        headers: {
            host: parsed.hostname
        },
        path: '/'
    };

    var req = https.request(opt, function(res) {
        res.setEncoding('utf8');
        var body = '';

        res.on('data', function(chunk) {
            body += chunk;
        });

        res.on('end', function() {
            assert(/.*[.]localtunnel[.]me/.test(body), body);
            done();
        });
    });

    req.end();
});

test('request specific domain', function(done) {
    localtunnel(test._fake_port, { subdomain: 'abcd' }, function(err, tunnel) {
        assert.ifError(err);
        assert.ok(new RegExp('^https:\/\/abcd.localtunnel.me' + '$').test(tunnel.url));
        tunnel.close();
        done();
    });
});

suite('--local-host localhost');

test('setup localtunnel client', function(done) {
    var opt = {
        local_host: 'localhost'
    };
    localtunnel(test._fake_port, opt, function(err, tunnel) {
        assert.ifError(err);
        assert.ok(new RegExp('^https:\/\/.*localtunnel.me' + '$').test(tunnel.url));
        test._fake_url = tunnel.url;
        done();
    });
});

test('override Host header with local-host', function(done) {
    var uri = test._fake_url;
    var parsed = url.parse(uri);

    var opt = {
        host: parsed.host,
        port: 443,
        headers: {
            host: parsed.hostname
        },
        path: '/'
    };

    var req = https.request(opt, function(res) {
        res.setEncoding('utf8');
        var body = '';

        res.on('data', function(chunk) {
            body += chunk;
        });

        res.on('end', function() {
            assert.equal(body, 'localhost');
            done();
        });
    });

    req.end();
});

suite('--local-host 127.0.0.1');

test('setup localtunnel client', function(done) {
    var opt = {
        local_host: '127.0.0.1'
    };
    localtunnel(test._fake_port, opt, function(err, tunnel) {
        assert.ifError(err);
        assert.ok(new RegExp('^https:\/\/.*localtunnel.me' + '$').test(tunnel.url));
        test._fake_url = tunnel.url;
        done();
    });
});

test('override Host header with local-host', function(done) {
    var uri = test._fake_url;
    var parsed = url.parse(uri);

    var opt = {
        host: parsed.host,
        port: 443,
        headers: {
            host: parsed.hostname
        },
        path: '/'
    };

    var req = https.request(opt, function(res) {
        res.setEncoding('utf8');
        var body = '';

        res.on('data', function(chunk) {
            body += chunk;
        });

        res.on('end', function() {
            assert.equal(body, '127.0.0.1');
            done();
        });
    });

    req.end();
});

test('send chunked request', function(done) {
    var uri = test._fake_url;
    var parsed = url.parse(uri);

    var opt = {
        host: parsed.host,
        port: 443,
        headers: {
            host: parsed.hostname,
            'Transfer-Encoding': 'chunked'
        },
        path: '/'
    };

    var req = https.request(opt, function(res) {
        res.setEncoding('utf8');
        var body = '';

        res.on('data', function(chunk) {
            body += chunk;
        });

        res.on('end', function() {
            assert.equal(body, '127.0.0.1');
            done();
        });
    });

    req.end(require('crypto').randomBytes(1024 * 8).toString('base64'));
});

Anon7 - 2022
AnonSec Team