Skip to content

LibreNetworks/mofh-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MOFH-CLI Documentation

Overview

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.


Installation

Prerequisites

  • Python 3.6 or higher.
  • MOFH Python package (mofh).
  • A valid MOFH API account with a username and password.

Setup

  1. Install Required Packages
    Before using mofh-cli, ensure that the necessary Python packages are installed:

    pip install mofh
  2. Configuration File
    The tool relies on a configuration file named config.ini to store API credentials. Create this file in the same directory as mofh-cli with the following content:

    [default]
    api_username = your_api_username
    api_password = your_api_password
  3. Run the Script
    The script can be run directly from the command line:

    ./mofh-cli.py [command] [options]

Usage

Commands

1. Create a New Account

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.com

2. Suspend an Account

Suspends an existing account by username.

Syntax:

./mofh-cli.py suspend <username> <reason>

Example:

./mofh-cli.py suspend johndoe "Violation of terms"

3. Unsuspend an Account

Unsuspends a previously suspended account.

Syntax:

./mofh-cli.py unsuspend <username>

Example:

./mofh-cli.py unsuspend johndoe

4. Delete an Account

Deletes an account by username.

Syntax:

./mofh-cli.py delete <username>

Example:

./mofh-cli.py delete johndoe

5. Change Account Password

Resets the password for an account.

Syntax:

./mofh-cli.py change_password <username> <new_password>

Example:

./mofh-cli.py change_password johndoe newpass123

6. Change Hosting Plan

Changes the hosting plan/package for an account.

Syntax:

./mofh-cli.py change_package <username> <new_plan>

Example:

./mofh-cli.py change_package johndoe premium_plan

7. Check Domain Availability

Checks if a domain is available for registration.

Syntax:

./mofh-cli.py check_available <domain>

Example:

./mofh-cli.py check_available example.com

8. Retrieve User Domains

Lists all domains associated with a username.

Syntax:

./mofh-cli.py get_user_domains <username>

Example:

./mofh-cli.py get_user_domains johndoe

9. Get User for Domain

Retrieves the username associated with a domain.

Syntax:

./mofh-cli.py get_domain_user <domain>

Example:

./mofh-cli.py get_domain_user example.com

10. Retrieve CNAME Record

Gets the CNAME record for a domain.

Syntax:

./mofh-cli.py get_cname <domain>

Example:

./mofh-cli.py get_cname example.com

11. Create Support Ticket

Creates 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.1

12. Reply to a Support Ticket

Replies 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.1

Options

  • username: 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.

Error Handling

The tool includes error handling to ensure a clear response is provided if something goes wrong.

Example:

Failed to create account: <Error Message>

Configuration File Example

[default]
api_username = your_mofh_api_username
api_password = your_mofh_api_password

Place this file in the same directory as mofh-cli.py.


Contributing

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.

About

Python CLI for MyOwnFreeHost

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages