Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 18.218.229.244
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : 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_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/node_modules/pm2/node_modules/netmask/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /lib/node_modules/pm2/node_modules/netmask/test/badnets.coffee
vows = require 'vows'
assert = require 'assert'
Netmask = require('../lib/netmask').Netmask

shouldFailWithError = (msg) ->
    context =
        topic: ->
            try
                return new Netmask(@context.name)
            catch e
                return e
        'should fail': (e) ->
            assert.ok isError(e), "is an Error object #{e}"
        "with error `#{msg}'": (e) ->
            assert.ok e.message?.toLowerCase().indexOf(msg.toLowerCase()) > -1, "'#{e.message}' =~ #{msg}"

    return context

isError = (e) ->
    return typeof e == 'object' and Object.prototype.toString.call(e) == '[object Error]'

vows.describe('IPs with bytes greater than 255')
    .addBatch
        '209.256.68.22/255.255.224.0': shouldFailWithError 'Invalid net'
        '209.180.68.22/256.255.224.0': shouldFailWithError 'Invalid mask'
        '209.500.70.33/19': shouldFailWithError 'Invalid net'
        '140.999.82': shouldFailWithError 'Invalid net'
        '899.174': shouldFailWithError 'Invalid net'
        '209.157.65536/19': shouldFailWithError 'Invalid net'
        '209.300.64.0.10': shouldFailWithError 'Invalid net'
        'garbage': shouldFailWithError 'Invalid net'
    .export(module)
    

vows.describe('Invalid IP format')
    .addBatch
        ' 1.2.3.4': shouldFailWithError 'Invalid net'
        '  1.2.3.4': shouldFailWithError 'Invalid net'
        '1. 2.3.4': shouldFailWithError 'Invalid net'
        '1.2. 3.4': shouldFailWithError 'Invalid net'
        '1.2.3. 4': shouldFailWithError 'Invalid net'
        '1.2.3.4 ': shouldFailWithError 'Invalid net'
        '1 .2.3.4': shouldFailWithError 'Invalid net'
        '018.0.0.0': shouldFailWithError 'Invalid net'
        '08.0.0.0': shouldFailWithError 'Invalid net'
        '0xfg.0.0.0': shouldFailWithError 'Invalid net'
    .export(module)

vows.describe('Ranges that are a power-of-two big, but are not legal blocks')
    .addBatch
        '218.0.0.0/221.255.255.255': shouldFailWithError 'Invalid mask'
        '218.0.0.4/218.0.0.11': shouldFailWithError 'Invalid mask'
    .export(module)

Anon7 - 2022
AnonSec Team