Beispiel #1
0
def initialNmapScan(ip, ports='1-1024'):
    nmap = Nmap(ip, ports)
    serviceScan = nmap.tcpVersionScan()
    openPorts = {'tcp': nmap.getOpenTcpPorts()}
    os = nmap.getOs()

    services = {}
    ports = []

    for port in openPorts['tcp']:
        ports.append(port)
        serviceName = serviceScan[port]['name']
        serviceProduct = serviceScan[port]['product']
        serviceVersion = serviceScan[port]['version']
        state = serviceScan[port]['state']

        services[port] = {
            'name': serviceName,
            'product': serviceProduct,
            'version': serviceVersion,
            'state': state
        }

    scanResults = {'ports': ports, 'services': services, 'os': os}
    return scanResults
Beispiel #2
0
    def __init__(self, target, port=139):

        # consider implementing multiple port numbers (ex. 139,445)

        self.target = target
        self.port = port
        self.nmap = Nmap(self.target, str(self.port))
Beispiel #3
0
def nmapVulnScan(ip, portList):
    nmap = Nmap(ip)
    scanResults = {'vuln-scan': nmap.vulnScan(portList)}
    return scanResults
Beispiel #4
0
def nmapVulnScan(ip, ports='1-1024'):
    nmap = Nmap(ip)
    scanResults = {'vuln-scan': nmap.vulnScan(ports)}
    return scanResults
Beispiel #5
0
 def __init__(self, target, port=21):
     self.target = target
     self.port = port
     self.nmap = Nmap(target, str(self.port))
Beispiel #6
0
                    '--target',
                    type=str,
                    help='specify the target IP address',
                    required=True)
parser.add_argument('-p', '--ports', type=str, help='specify port range')

args = parser.parse_args()
target = args.target
portRange = args.ports if args.ports != None else '1-1024'

print('Target: ' + target)
print('Ports: ' + portRange)

# ============================== setup nmap ==============================

nmap = Nmap(target, portRange)

services = nmap.tcpVersionScan()

# ============================== service scan ==============================

printHeader('Service Scan')

httpPorts = []

print('  Port       State    Service, Product, Version')
print('  ------------------------------------')

for port in nmap.getOpenTcpPorts():
    serviceName = services[port]['name']
    serviceProduct = services[port]['product']