PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /proc/self/root/opt/sharedrads/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //proc/self/root/opt/sharedrads/quick_post

#!/opt/imh-python/bin/python3
import pp_api
import sys
import argparse
import rads
from rads.color import red, green


def get_arguments():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        '-u', '--user', action='store', dest='User', help='Define your User'
    )
    parser.add_argument(
        '-n',
        '--note',
        action='store',
        dest='Note',
        help='Enter the note to post',
    )
    results = parser.parse_args()
    if not results.User:
        results.User = input('Enter cpanel user : ')
    if not rads.is_cpuser(results.User):
        print(red('Not a valid user'))
        sys.exit(1)
    if not results.Note:
        results.Note = input('Enter note for Power Panel : ')
    return results


def post_note_now(user, note):
    whoami = f'{rads.get_login()}@inmotionhosting.com'
    type_ = "Resource Management"
    pp = pp_api.PowerPanel()
    pp_r = pp(
        'hosting.insert-note',
        user=user,
        admin_user=whoami,
        flagged=False,
        type=type_,
        note=f'{whoami}: {note}',
    )
    if pp_r is None or not hasattr(pp_r, 'status') or pp_r.status != 0:
        print(red('Note failed to post. Post manually'))
    else:
        print(green('Successfully posted note'))


def main():
    results = get_arguments()
    post_note_now(results.User, results.Note)


if __name__ == "__main__":
    main()