mirror of
https://github.com/codingo/Interlace.git
synced 2025-12-17 14:54:21 +01:00
Fixed errors with ports and exclusions. Also added in domain name compatibility.
This commit is contained in:
@@ -2,6 +2,7 @@ from argparse import ArgumentParser
|
||||
from netaddr import IPNetwork, IPRange, IPGlob
|
||||
from Interlace.lib.core.output import OutputHelper, Level
|
||||
import os.path
|
||||
from re import compile
|
||||
|
||||
|
||||
class InputHelper(object):
|
||||
@@ -96,6 +97,10 @@ class InputHelper(object):
|
||||
target = target.replace(" ", "")
|
||||
|
||||
for ips in target.split(","):
|
||||
# check if it is a domain name
|
||||
if ips.split(".")[-1][0].isalpha():
|
||||
targets.add(ips)
|
||||
continue
|
||||
# checking for CIDR
|
||||
if not arguments.nocidr and "/" in ips:
|
||||
targets.update(InputHelper._get_cidr_to_ips(ips))
|
||||
@@ -113,6 +118,10 @@ class InputHelper(object):
|
||||
exclusion = exclusion.replace(" ", "")
|
||||
|
||||
for ips in exclusion.split(","):
|
||||
# check if it is a domain name
|
||||
if ips.split(".")[-1][0].isalpha():
|
||||
targets.add(ips)
|
||||
continue
|
||||
# checking for CIDR
|
||||
if not arguments.nocidr and "/" in ips:
|
||||
exclusions.update(InputHelper._get_cidr_to_ips(ips))
|
||||
@@ -138,16 +147,24 @@ class InputHelper(object):
|
||||
# replace flags
|
||||
for command in commands:
|
||||
tmp_command = command
|
||||
for port in ports:
|
||||
if arguments.port:
|
||||
for port in ports:
|
||||
command = tmp_command
|
||||
command = str(command).replace("_target_", target)
|
||||
command = str(command).replace("_host_", target)
|
||||
if arguments.output:
|
||||
command = str(command).replace("_output_", arguments.output)
|
||||
command = str(command).replace("_port_", str(port))
|
||||
if arguments.realport:
|
||||
command = str(command).replace("_realport_", arguments.realport)
|
||||
final_commands.add(command)
|
||||
output.terminal(Level.VERBOSE, command, "Added after processing")
|
||||
else:
|
||||
command = tmp_command
|
||||
command = str(command).replace("_target_", target)
|
||||
command = str(command).replace("_host_", target)
|
||||
if arguments.output:
|
||||
command = str(command).replace("_output_", arguments.output)
|
||||
if arguments.port:
|
||||
command = str(command).replace("_port_", str(port))
|
||||
if arguments.realport:
|
||||
command = str(command).replace("_realport_", arguments.realport)
|
||||
final_commands.add(command)
|
||||
output.terminal(Level.VERBOSE, command, "Added after processing")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user