Giter VIP home page Giter VIP logo

jasmin_telnet's Introduction

Jasmin Telnet

Manage Jasmin SMS Gateway's configurations through telnet

I wrote some of it and collected most of from: jasmin-api and jasmin-web-panel.

Also some of the logic is ported from this PHP package jasmin-web by nnikitos95

Table of Contents

  1. Installation Instructions
  2. Usage Instructions

Installation Instructions

PYPI

pip3 install -U jasmin-telnet

From Source

git clone https://github.com/BlackOrder/jasmin_telnet.git
cd jasmin_telnet
pip3 install .

Usage Instructions

Import

from jasmin_telnet.proxy import Proxy as JasminTelnetProxy

Initialize variables

jasmin_proxy = JasminTelnetProxy(
    host=**jasmin_cli_host**,                               # Default: 127.0.0.1
    port=**jasmin_cli_port**,                               # Default: 8990
    timeout=**jasmin_cli_timeout**,                         # Default: 10
    auth=**jasmin_cli_auth**,                               # Default: True
    username=**jasmin_cli_username**,                       # Default: "jcliadmin"
    password=**jasmin_cli_password**,                       # Default: "jclipwd"
    standard_prompt=**jasmin_cli_standard_prompt**,         # Default: "jcli : "
    interactive_prompt=**jasmin_cli_interactive_prompt**,   # Default: "> "
    log_status=True,                                        # Default: False
    logger=self.logger_callback                             # Default: None
)

Sync

Single Module

To sync, remove any sub-module not sent and add not existing and update existing.

jasmin_proxy.sync(
    module="smppccm",
    sub_modules_data={
        "cid1":{
            "cid":"cid1",
            "username":"someUsername1",
            "host":"127.0.0.1"
        },
        "cid2":{
            "cid":"cid2",
            "username":"someUsername2",
            "host":"127.0.0.2"
        },
        "cid3":{
            "cid":"cid3",
            "username":"someUsername3",
            "host":"127.0.0.3"
        }
    }
)

Sync All

jasmin_proxy.syncAll(
    collection_data={
        "smppccm": {
            "cid1":{
                "cid":"cid1",
                "username":"USERNAME",
                "host":"127.0.0.1"
            },
            "cid2":{
                "cid":"cid2",
                "username":"USERNAME",
                "host":"127.0.0.2"
            },
            "cid3":{
                "cid":"cid3",
                "username":"USERNAME",
                "host":"127.0.0.3"
            }
        },
        "group":{
            "gid1":{
                "gid": "gid1"
            }
        },
        "user":{
            "uid1": {
                "uid": "uid1",
                "gid": "gid1",
                "username": "USERNAME",
                "password": "PASS"
            }
        }
    }
)

Beware, any module not included will be flushed. if you send this:

jasmin_proxy.syncAll()

or

jasmin_proxy.syncAll(collection_data={})

or

jasmin_proxy.syncAll(collection_data=None)

This will flush all of Jasmin configurations.

Add New

jasmin_proxy.add(
    module="user",
    sub_id="uid3",
    options={
                "uid": "uid3",
                "gid": "gid1",
                "username": "USERNAME",
                "password": "PASS"
            }
)

Edit

jasmin_proxy.edit(
    module="user",
    sub_id="uid3",
    options={
                "password": "NEW_PASS"
            }
)

Remove

jasmin_proxy.remove(
    module="user",
    sub_id="uid3"
)

jasmin_telnet's People

Contributors

blackorder avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.