Added delete flask webapp
This commit is contained in:
parent
4f7d88f995
commit
90990ab1c0
10 changed files with 969 additions and 2 deletions
42
scripts/webapps/phpmyadmin/delete_phpmyadmin.py
Normal file
42
scripts/webapps/phpmyadmin/delete_phpmyadmin.py
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/python3 -u
|
||||
|
||||
import argparse
|
||||
import os
|
||||
#from pastafariutils.unix import add_user, del_user
|
||||
from pathlib import Path
|
||||
from subprocess import call, DEVNULL
|
||||
import json
|
||||
import time
|
||||
import shutil
|
||||
import pwd
|
||||
import distro
|
||||
import subprocess
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
parser=argparse.ArgumentParser(prog='delete_phpmyadmin.py', description='A tool for delete phpmyadmin')
|
||||
|
||||
parser.add_argument('--home_user', help='Home where phpmyadmin resides', required=True)
|
||||
parser.add_argument('--user', help='The user', required=True)
|
||||
|
||||
print('Deleting PHPMyAdmin..')
|
||||
|
||||
args=parser.parse_args()
|
||||
|
||||
home_user=args.home_user
|
||||
|
||||
if home_user.find('/htdocs/', -8)!=-1:
|
||||
|
||||
if subprocess.call("sudo su %s -s /bin/bash -c 'rm -f -r %s && mkdir %s'" % (args.user, args.home_user, args.home_user), shell=True) > 0:
|
||||
print('Error: cannot delete %s' % args.home_user)
|
||||
sys.exit(1)
|
||||
|
||||
else:
|
||||
|
||||
if subprocess.call("sudo su %s -s /bin/bash -c 'rm -f -r %s'" % (args.user, args.home_user), shell=True) > 0:
|
||||
print('Error: cannot delete %s' % args.home_user)
|
||||
sys.exit(1)
|
||||
|
||||
print('Deleted PHPMyAdmin successfully...')
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue