Skip to content

Commit 3617c19

Browse files
committed
Updated sharehound/targets.py
1 parent 16576fb commit 3617c19

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

sharehound/targets.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,27 @@
1616

1717
from sharehound.core.Config import Config
1818
from sharehound.core.Logger import Logger
19+
from sharehound.utils.utils import is_port_open
1920

2021

2122
def load_targets(options: argparse.Namespace, config: Config, logger: Logger):
2223
targets = []
2324

24-
if options.targets_file is not None or len(options.target) != 0:
25+
if (
26+
options.auth_dc_ip is not None
27+
and options.auth_user is not None
28+
and (options.auth_password is not None or options.auth_hashes is not None)
29+
):
30+
if not is_port_open(
31+
options.auth_dc_ip, (389 if not options.ldaps else 636), timeout=10
32+
):
33+
logger.error(
34+
"Domain controller %s is not reachable on port %d"
35+
% (options.auth_dc_ip, (389 if not options.ldaps else 636))
36+
)
37+
return []
2538

39+
if options.targets_file is not None or len(options.target) != 0:
2640
# Loading targets line by line from a targets file
2741
if options.targets_file is not None:
2842
if os.path.exists(options.targets_file):

0 commit comments

Comments
 (0)