mirror of https://github.com/n1nj4sec/pupy.git
port_scan module using scapy !
This commit is contained in:
parent
8ee7aa53a3
commit
c0bcd0637e
|
@ -0,0 +1,24 @@
|
|||
# -*- coding: UTF8 -*-
|
||||
from pupylib.PupyModule import *
|
||||
import logging
|
||||
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
|
||||
from scapy.all import *
|
||||
|
||||
__class_name__="PortScan"
|
||||
|
||||
class PortScan(PupyModule):
|
||||
""" run a TCP port scan """
|
||||
dependencies=['portscan', 'scapy']
|
||||
|
||||
def init_argparse(self):
|
||||
self.arg_parser = PupyArgumentParser(prog="port_scan", description=self.__doc__)
|
||||
self.arg_parser.add_argument('--ports','-p', default="21,22,23,80,139,443,445,3389,8000,8080", help='ports to scan ex: 22,80,443')
|
||||
self.arg_parser.add_argument('address', metavar="ip/range", help='IP/range to scan')
|
||||
|
||||
def run(self, args):
|
||||
ps=self.client.conn.modules['portscan'].PortScanner()
|
||||
ports=[int(x) for x in args.ports.split(',')]
|
||||
res=ps.scan(args.address, ports)
|
||||
self.rawlog(res)
|
||||
self.success("Scan finished !")
|
||||
|
Loading…
Reference in New Issue