add ssh ignore option
This commit is contained in:
parent
ee0180e618
commit
9dfadb8eaa
11
scripts/ifpi
11
scripts/ifpi
@ -60,7 +60,7 @@ def classify_traffic(
|
|||||||
for pattern in patterns:
|
for pattern in patterns:
|
||||||
if pattern.match(str(hostname)):
|
if pattern.match(str(hostname)):
|
||||||
return service
|
return service
|
||||||
|
|
||||||
# Fallbacks in case we can't figure anything else out
|
# Fallbacks in case we can't figure anything else out
|
||||||
if packet_proto == "TCP" and destination_port == 443:
|
if packet_proto == "TCP" and destination_port == 443:
|
||||||
return f"HTTPS ({hostname})"
|
return f"HTTPS ({hostname})"
|
||||||
@ -82,6 +82,11 @@ def main() -> int:
|
|||||||
help="Subnet(s) to consider local",
|
help="Subnet(s) to consider local",
|
||||||
action="append",
|
action="append",
|
||||||
)
|
)
|
||||||
|
ap.add_argument(
|
||||||
|
"--ignore-ssh",
|
||||||
|
help="Ignore SSH traffic",
|
||||||
|
action="store_true",
|
||||||
|
)
|
||||||
ap.add_argument(
|
ap.add_argument(
|
||||||
"-v", "--verbose", help="Enable verbose logging", action="store_true"
|
"-v", "--verbose", help="Enable verbose logging", action="store_true"
|
||||||
)
|
)
|
||||||
@ -153,6 +158,10 @@ def main() -> int:
|
|||||||
classification = classify_traffic(
|
classification = classify_traffic(
|
||||||
destination, int(destination_port), metadata.lstrip().split(" ")[0]
|
destination, int(destination_port), metadata.lstrip().split(" ")[0]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Handle ignoring SSH traffic
|
||||||
|
if args.ignore_ssh and classification == "SSH":
|
||||||
|
continue
|
||||||
|
|
||||||
print(f"{source}\t{classification}")
|
print(f"{source}\t{classification}")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user