mirror of
https://github.com/Pennyw0rth/NetExec
synced 2026-06-06 16:34:30 +00:00
9fefd167b0
Just fyi for anyone reading this, it's not even close to being finished. The amount of changes are pretty insane, this commit is to serve as a refrence point for myself. Highlights for v4.0: - The whole codebase has been re-written from scratch - Codebase has been cut around 2/4 - Protocols are now modular! In theory we could use CME for everything - Module chaining has been removed for now, still trying to figure out a more elegant solution - Workspaces have implemented in cmedb - The smb protocol's database schema has been changed to support storing users, groups and computers with their respective memberships and relations. - I'm in the process of re-writing most of the modules, will re-add them once i've finished
31 lines
886 B
Python
Executable File
31 lines
886 B
Python
Executable File
from netaddr import IPAddress, IPRange, IPNetwork, AddrFormatError
|
|
|
|
def parse_targets(target):
|
|
if '-' in target:
|
|
ip_range = target.split('-')
|
|
try:
|
|
hosts = IPRange(ip_range[0], ip_range[1])
|
|
except AddrFormatError:
|
|
try:
|
|
start_ip = IPAddress(ip_range[0])
|
|
|
|
start_ip_words = list(start_ip.words)
|
|
start_ip_words[-1] = ip_range[1]
|
|
start_ip_words = [str(v) for v in start_ip_words]
|
|
|
|
end_ip = IPAddress('.'.join(start_ip_words))
|
|
|
|
t = IPRange(start_ip, end_ip)
|
|
except AddrFormatError:
|
|
t = target
|
|
else:
|
|
try:
|
|
t = IPNetwork(target)
|
|
except AddrFormatError:
|
|
t = target
|
|
|
|
if type(t) == IPNetwork or type(t) == IPRange:
|
|
return list(t)
|
|
else:
|
|
return [t.strip()]
|