dataset/seed/relay-mail-client/funcs/relay_mail.py

13 lines
458 B
Python
Raw Normal View History

2023-06-23 08:12:05 +02:00
from ipaddress import ip_network as _ip_network, ip_address as _ip_address
from rougail.utils import normalize_family as _normalize_family
def get_local_smtp_info(ip_smtp, infos, network_eth, normalize=False):
ip_smtp_o = _ip_address(ip_smtp)
for idx, net in enumerate(network_eth):
if ip_smtp_o in _ip_network(net):
val = infos[idx]
if normalize:
val = _normalize_family(val)
return val