One Hat Cyber Team
Your IP :
3.16.51.33
Server IP :
192.145.235.60
Server :
Linux ngx365.inmotionhosting.com 5.14.0-427.33.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Aug 30 09:45:56 EDT 2024 x86_64
Server Software :
Apache
PHP Version :
8.2.27
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
opt
/
tier1adv
/
bin
/
View File Name :
validate_zone
#!/opt/imh-python/bin/python3 import argparse import sys from pathlib import Path import subprocess from rads.color import green sys.path.insert(0, '/opt/support/lib') from arg_types import valid_domain from output import err_exit def get_args() -> str: """Parse domain from command arguments""" parser = argparse.ArgumentParser() parser.add_argument('domain', type=valid_domain, help='domain to check') return parser.parse_args().domain def main(): domain = get_args() zone_file = Path('/var/named', f"{domain}.db") if zone_file.is_file(): print(green(f'Zone File exists at {zone_file}')) else: err_exit(f'Zone file does not exist at {zone_file}') try: ret_code = subprocess.call(['named-checkzone', domain, str(zone_file)]) except FileNotFoundError as exc: # named-checkzone is missing err_exit(str(exc)) if ret_code: # non-zero return code err_exit(f'Failed to validate the zone file at {zone_file}') print(green(f'Successfully validated the zone file at {zone_file}')) if __name__ == "__main__": main()