mofh-cli is a command-line tool that simplifies the management of MyOwnFreeHost (MOFH) accounts. This tool allows administrators to create, suspend, unsuspend, delete accounts, reset passwords, change packages, check domain availability, retrieve user domains, query CNAME records, and manage support tickets via the MOFH API.
- Python 3.6 or higher.
- MOFH Python package (
mofh). - A valid MOFH API account with a username and password.
-
Install Required Packages
Before usingmofh-cli, ensure that the necessary Python packages are installed:pip install mofh
-
Configuration File
The tool relies on a configuration file namedconfig.inito store API credentials. Create this file in the same directory asmofh-cliwith the following content:[default] api_username = your_api_username api_password = your_api_password
-
Run the Script
The script can be run directly from the command line:./mofh-cli.py [command] [options]
Creates a new hosting account.
Syntax:
./mofh-cli.py create <username> <password> <email> <plan> <domain>Example:
./mofh-cli.py create johndoe pass123 john@example.com basic_plan example.comSuspends an existing account by username.
Syntax:
./mofh-cli.py suspend <username> <reason>Example:
./mofh-cli.py suspend johndoe "Violation of terms"Unsuspends a previously suspended account.
Syntax:
./mofh-cli.py unsuspend <username>Example:
./mofh-cli.py unsuspend johndoeDeletes an account by username.
Syntax:
./mofh-cli.py delete <username>Example:
./mofh-cli.py delete johndoeResets the password for an account.
Syntax:
./mofh-cli.py change_password <username> <new_password>Example:
./mofh-cli.py change_password johndoe newpass123Changes the hosting plan/package for an account.
Syntax:
./mofh-cli.py change_package <username> <new_plan>Example:
./mofh-cli.py change_package johndoe premium_planChecks if a domain is available for registration.
Syntax:
./mofh-cli.py check_available <domain>Example:
./mofh-cli.py check_available example.comLists all domains associated with a username.
Syntax:
./mofh-cli.py get_user_domains <username>Example:
./mofh-cli.py get_user_domains johndoeRetrieves the username associated with a domain.
Syntax:
./mofh-cli.py get_domain_user <domain>Example:
./mofh-cli.py get_domain_user example.comGets the CNAME record for a domain.
Syntax:
./mofh-cli.py get_cname <domain>Example:
./mofh-cli.py get_cname example.comCreates a new support ticket.
Syntax:
./mofh-cli.py create_ticket <username> <subject> <comments> <ip>Example:
./mofh-cli.py create_ticket johndoe "Account Issue" "My account is not accessible" 192.168.0.1Replies to an existing support ticket.
Syntax:
./mofh-cli.py reply_ticket <username> <ticket_id> <comments> <ip>Example:
./mofh-cli.py reply_ticket johndoe 123456 "Issue resolved" 192.168.0.1username: Username associated with the account.password: Account password (required for account creation).email: Contact email (required for account creation).plan: Hosting plan/package (required for account creation or change).domain: Domain name (used for account creation and domain queries).reason: Reason for account suspension.new_password: New password for account.new_plan: New hosting plan/package.subject: Subject for support tickets.comments: Description or comments for support tickets.ip: IP address for support tickets.
The tool includes error handling to ensure a clear response is provided if something goes wrong.
Example:
Failed to create account: <Error Message>
[default]
api_username = your_mofh_api_username
api_password = your_mofh_api_passwordPlace this file in the same directory as mofh-cli.py.
We welcome contributions to mofh-cli. Whether you're fixing bugs, adding new features, or enhancing documentation, your input is appreciated. Fork the project, make changes, and submit a pull request.