Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/exe_root.../opt/support/lib
File: output.py
import sys
[0] Fix | Delete
from typing import Callable
[1] Fix | Delete
import netaddr
[2] Fix | Delete
from rads.color import green, red, bold
[3] Fix | Delete
[4] Fix | Delete
[5] Fix | Delete
def err_exit(*args, file=sys.stderr, rcode=1, **kwargs):
[6] Fix | Delete
color_print(*args, color=red, file=file, **kwargs)
[7] Fix | Delete
sys.exit(rcode)
[8] Fix | Delete
[9] Fix | Delete
[10] Fix | Delete
def warn(*args, file=sys.stderr, color: Callable = red, **kwargs):
[11] Fix | Delete
color_print(*args, color=color, file=file, **kwargs)
[12] Fix | Delete
[13] Fix | Delete
[14] Fix | Delete
def print_listed(ipaddr: netaddr.IPAddress, listed: bool, where: str):
[15] Fix | Delete
"""For printing whether an IP is listed in iptables"""
[16] Fix | Delete
print(
[17] Fix | Delete
f'The IP {ipaddr}',
[18] Fix | Delete
red('is listed') if listed else green('is not listed'),
[19] Fix | Delete
f'in {where}',
[20] Fix | Delete
)
[21] Fix | Delete
[22] Fix | Delete
[23] Fix | Delete
def header(*args, color: Callable = bold, **kwargs):
[24] Fix | Delete
color_print(*args, color=color, **kwargs)
[25] Fix | Delete
[26] Fix | Delete
[27] Fix | Delete
def color_print(*args, color: Callable = red, **kwargs):
[28] Fix | Delete
out = color(*args)
[29] Fix | Delete
if isinstance(out, str):
[30] Fix | Delete
print(out, **kwargs)
[31] Fix | Delete
else:
[32] Fix | Delete
print(*out, **kwargs)
[33] Fix | Delete
[34] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function