Package net.continuumsecurity.scanner

Examples of net.continuumsecurity.scanner.PortScanner


        targetHost = new URL(Config.getBaseUrl()).getHost();
    }

    @When("TCP ports from $from to $to are scanned using $threads threads and a timeout of $timeout milliseconds")
    public void scanPorts(int from, int to, int threads, int timeout) throws ExecutionException, InterruptedException {
        portScanner = new PortScanner(targetHost,from,to,threads,timeout);
        portScanResults = portScanner.scan();
    }
View Full Code Here


public class PortScannerTest {
    PortScanner scanner;

    @Test
    public void testPortOpen() throws ExecutionException, InterruptedException {
        scanner = new PortScanner("www.google.com",80,80,1,500);
        List<PortResult> results = scanner.scan();
        assert results.size() == 1;
        assert results.get(0).getPort() == 80;
        assert results.get(0).getState() == PortResult.PortState.OPEN;
    }
View Full Code Here

    }


    @Test
    public void testPortClosed() throws ExecutionException, InterruptedException {
        scanner = new PortScanner("127.0.0.1",65531,65531,1,500);
        List<PortResult> results = scanner.scan();
        assert results.size() == 1;
        assert results.get(0).getPort() == 65531;
        assert results.get(0).getState() == PortResult.PortState.CLOSED;
    }
View Full Code Here

        assert results.get(0).getState() == PortResult.PortState.CLOSED;
    }

    @Test
    public void testPortTimedOut() throws ExecutionException, InterruptedException {
        scanner = new PortScanner("www.google.com",83,83,1,500);
        List<PortResult> results = scanner.scan();
        assert results.size() == 1;
        assert results.get(0).getPort() == 83;
        assert results.get(0).getState() == PortResult.PortState.TIMEDOUT;
    }
View Full Code Here

TOP

Related Classes of net.continuumsecurity.scanner.PortScanner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.