Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/smanonr..../opt/tier2c
File: safe_removeacct.py
#!/opt/imh-python/bin/python3
[0] Fix | Delete
"""removeacct wrapper for T2C"""
[1] Fix | Delete
import argparse
[2] Fix | Delete
import sys
[3] Fix | Delete
import rads
[4] Fix | Delete
[5] Fix | Delete
sys.path.insert(0, '/opt/support/lib')
[6] Fix | Delete
from arg_types import cpuser_safe_arg
[7] Fix | Delete
from run_cmd import cpuwatch_execv
[8] Fix | Delete
[9] Fix | Delete
[10] Fix | Delete
def parse_args():
[11] Fix | Delete
"""Parse commandline arguments"""
[12] Fix | Delete
parser = argparse.ArgumentParser(
[13] Fix | Delete
description=(
[14] Fix | Delete
"Wrapper around CPanel removeacct. Do not use this unless you have "
[15] Fix | Delete
"a valid backup of the account, as it is irreversible. Improper "
[16] Fix | Delete
"use may result in loss of access and disciplinary action."
[17] Fix | Delete
)
[18] Fix | Delete
)
[19] Fix | Delete
parser.add_argument('user', help='Account to destroy', type=cpuser_safe_arg)
[20] Fix | Delete
args = parser.parse_args()
[21] Fix | Delete
return args.user
[22] Fix | Delete
[23] Fix | Delete
[24] Fix | Delete
def main():
[25] Fix | Delete
"""main: parse args, determine size, prompt, and run removeacct"""
[26] Fix | Delete
user = parse_args()
[27] Fix | Delete
msg = (
[28] Fix | Delete
'WARNING: This cannot be undone. Please confirm that you have a'
[29] Fix | Delete
' valid backup of this account. Misuse of this tool can lead to '
[30] Fix | Delete
'downgrading of access and disciplinary action.'
[31] Fix | Delete
)
[32] Fix | Delete
if not rads.prompt_y_n(rads.color.red(msg)):
[33] Fix | Delete
sys.exit("Exiting on user input")
[34] Fix | Delete
cpuwatch_execv(["/usr/local/cpanel/scripts/removeacct", user])
[35] Fix | Delete
[36] Fix | Delete
[37] Fix | Delete
if __name__ == '__main__':
[38] Fix | Delete
main()
[39] Fix | Delete
[40] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function