예제 #1
0
	def run(self, plugin_Params, global_params):
		"""Get the help message for this plugin."""

		#----------------------------------------------------------------------
		# Packet layers
		TARGET            = global_params.target
		DST_MAC           = global_params.mac_dst
		DST_PORT          = int(plugin_Params.dest_port)
		CONN_NUM          = int(plugin_Params.max_connection)
		OUT_IFACE         = global_params.iface_out
		PAYLOAD           = PAYLOADS['payload3']
		SEND_FUNCTION     = global_params.send_function

		eth_header        = Ether(dst=DST_MAC)
		ip_header         = IPv6(dst=TARGET)
		# Add headers
		ip_payload        = make_payload(num_headers=global_params.headers_num, ext_type=global_params.payload_type)

		# Partial payload
		partial_payload   = None

		# Set communication level: 2 or 3.
		if global_params.level == 2:
			partial_payload = eth_header/ip_header
		else:
			partial_payload = ip_header

		# iS payload selected?
		if ip_payload:
			PARTIAL_HEADER    = partial_payload/ip_payload
		else:
			PARTIAL_HEADER    = partial_payload


		#
		# Shared data
		#
		# For controling the correspondence of SEQ <-> ACK
		#
		# {'sport': { 'ack': int, 'dport': int, 'seq': int}
		SESSION_NUMBERS      = multiprocessing.Manager().dict()

		# Processes
		dispatch          = multiprocessing.Process(target = send_push,
		                                            args   = (PARTIAL_HEADER, SESSION_NUMBERS, PAYLOAD, SEND_FUNCTION, OUT_IFACE))

		topera            = ToperaLoris(TARGET,
		                                dport             = DST_PORT,
		                                partial_header    = PARTIAL_HEADER,
		                                session_numbers   = SESSION_NUMBERS,
		                                output_iface      = OUT_IFACE,
		                                send_function     = SEND_FUNCTION,
		                                delay             = plugin_Params.delay,
		                                debuging          = global_params.verbosity,
		                                connection_number = CONN_NUM)
		try:
			dispatch.start()
			topera.start()

			# Launch all syn packets
			topera.send_syn()

			# Wait for topera and dispatcher
			topera.join()
			dispatch.join()


		except KeyboardInterrupt:
			IODebug.displayInfo("\nStoping, please be patient...\n")
			try:
				dispatch.terminate()
				topera.terminate()
			except Exception:
				pass
			IODebug.displayInfo("\n")
예제 #2
0
    def run(self, plugin_Params, global_params):
        """Get the help message for this plugin."""

        #----------------------------------------------------------------------
        # Packet layers
        TARGET = global_params.target
        DST_MAC = global_params.mac_dst
        OUT_IFACE = global_params.iface_out
        SEND_FUNCTION = global_params.send_function
        PORTS = split_ports(plugin_Params.ports_scan)
        SLEEP_TIME = plugin_Params.sleep / 1000.0

        eth_header = Ether(dst=DST_MAC)
        ip_header = IPv6(dst=TARGET)
        # Add headers
        ip_payload = make_payload(num_headers=global_params.headers_num,
                                  ext_type=global_params.payload_type)

        # Make the payload
        if ip_payload:
            PARTIAL_HEADER = eth_header / ip_header / ip_payload
        else:
            PARTIAL_HEADER = eth_header / ip_header

        #
        # Shared data
        # {'state': []}
        #
        # Example:
        # {
        #   'open'   : [80,8080],
        #   'closed' : [139,445]
        # }
        #
        global PORTS_OPEN, PORTS_CLOSED, PORTS_FILTERED

        # Init all ports as closed
        PORTS_CLOSED.extend(PORTS)

        # Process
        topera = ToperaPortScanner(TARGET,
                                   partial_header=PARTIAL_HEADER,
                                   send_function=SEND_FUNCTION,
                                   dest_ports=PORTS,
                                   sleep_time=SLEEP_TIME,
                                   output_iface=OUT_IFACE,
                                   debuging=global_params.verbosity)
        try:

            IODebug.displayInfo("Scanning %s [%s ports]" %
                                (TARGET, str(len(PORTS))))
            m_start_init = clock()
            m_timeout = len(PORTS) * 2
            m_timeout_counter = 0

            # Start
            topera.start()

            # Launch all syn packets
            topera.send_syn()

            topera.join()

            IODebug.displayInfo("Not shown: %s closed ports" %
                                str(len(PORTS_CLOSED)))

            # Display results
            IODebug.displayInfo("%s scan report for %s" % ("Topera", TARGET))
            IODebug.displayInfo("PORT\t\tSTATE")

            # Order results
            for po in PORTS_OPEN:
                IODebug.displayInfo("%s/tcp\t\topen" % (str(po)))

            IODebug.displayInfo(
                "\nTopera done: 1 IP address (1 host up) scanned in %s seconds"
                % (str(clock() - m_start_init)))

        except KeyboardInterrupt:
            print "\n[*] Stoping, please be patient..."
            topera.terminate()
            print ""
예제 #3
0
	def run(self, plugin_Params, global_params):
		"""Get the help message for this plugin."""

		#----------------------------------------------------------------------
		# Packet layers
		TARGET            = global_params.target
		DST_MAC           = global_params.mac_dst
		OUT_IFACE         = global_params.iface_out
		SEND_FUNCTION     = global_params.send_function
		PORTS             = split_ports(plugin_Params.ports_scan)
		SLEEP_TIME        = plugin_Params.sleep / 1000.0

		eth_header        = Ether(dst=DST_MAC)
		ip_header         = IPv6(dst=TARGET)
		# Add headers
		ip_payload        = make_payload(num_headers=global_params.headers_num, ext_type=global_params.payload_type)

		# Make the payload
		if ip_payload:
			PARTIAL_HEADER    = eth_header/ip_header/ip_payload
		else:
			PARTIAL_HEADER    = eth_header/ip_header

		#
		# Shared data
		# {'state': []}
		#
		# Example:
		# {
		#   'open'   : [80,8080],
		#   'closed' : [139,445]
		# }
		#
		global PORTS_OPEN, PORTS_CLOSED, PORTS_FILTERED

		# Init all ports as closed
		PORTS_CLOSED.extend(PORTS)

		# Process
		topera  = ToperaPortScanner(TARGET,
		            partial_header = PARTIAL_HEADER,
		            send_function  = SEND_FUNCTION,
		            dest_ports     = PORTS,
		            sleep_time     = SLEEP_TIME,
		            output_iface   = OUT_IFACE,
		            debuging       = global_params.verbosity)
		try:

			IODebug.displayInfo("Scanning %s [%s ports]" % (TARGET, str(len(PORTS))))
			m_start_init      = clock()
			m_timeout         = len(PORTS) * 2
			m_timeout_counter = 0

			# Start
			topera.start()

			# Launch all syn packets
			topera.send_syn()

			topera.join()

			IODebug.displayInfo("Not shown: %s closed ports" % str(len(PORTS_CLOSED)))

			# Display results
			IODebug.displayInfo("%s scan report for %s" % ("Topera", TARGET))
			IODebug.displayInfo("PORT\t\tSTATE")

			# Order results
			for po in PORTS_OPEN:
				IODebug.displayInfo("%s/tcp\t\topen" % (str(po)))

			IODebug.displayInfo("\nTopera done: 1 IP address (1 host up) scanned in %s seconds" % (str(clock() - m_start_init)))


		except KeyboardInterrupt:
			print "\n[*] Stoping, please be patient..."
			topera.terminate()
			print ""