Skip to main content

Python code to login to Mikrotik WebClient without GUI

Project description

Python Mikrotik WebClient WiFi Login

This is a python code to login to wifi Mikrotik Webclient for devices that has no access to GUI (such as headless Raspberry Pi, or Linux Terminal). Mikrotik Webclient is using unique keys or salts generated randomly at some time interval, this program is made to find that unique keys or salts and combine it with username and password to make final login request.

Installing the package

using pip

    pip install python-mikrotik-login

using git

    pip install git+https://github.com/castrix/Python-Mikrotik-WebClient-WiFi-Login

Using the program

First import the module

    from python_mikrotik_login import MikrotikLogin

    login = MikrotikLogin("username","password","http://url") #you can leave the unique key index empty or set it manually
    login.do_login()
    print(login) # to see status

Arguments

    MikrotikLogin(username_string, password_string, url_string, minkey1_integer_optional, maxkey1_integer_optional, minkey2_integer_optional, maxkey2_integer_optional)

if you are still confused, see the Example

How this works

This code works by finding the unique key from the Mikrotik Web Client and then combine it with username and password then send back the post request to the Mikrotik Web Client.

Finding the unique key

For the example this is the function where the login action is fired:

    function doLogin() {
    document.sendin.username.value = document.login.username.value;
    document.sendin.password.value = hexMD5('\340' + document.login.password.value + '\043\242\062\374\062\365\062\266\201\323\145\251\200\303\025\315');
    document.sendin.submit();
    return false;
    }

In this case you should find the index of:

    \340
    and
    \043\242\062\374\062\365\062\266\201\323\145\251\200\303\025\315

where:

    \340 is the first unique key or salt
    \043\242\062\374\062\365\062\266\201\323\145\251\200\303\025\315 is the second unique key salt

Contributors

Ihsan Fajar Ramadhan

MarchelAce

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-mikrotik-login-3.0.8.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

python_mikrotik_login-3.0.8-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file python-mikrotik-login-3.0.8.tar.gz.

File metadata

  • Download URL: python-mikrotik-login-3.0.8.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for python-mikrotik-login-3.0.8.tar.gz
Algorithm Hash digest
SHA256 54c5ab696b6a4b80fc36af44367fe09347e71b9134017a23b78c5d7f93441bc7
MD5 4afff6cb13c3173b05dda9d3f965023c
BLAKE2b-256 fe24e17e5fcb22e4e0cdea4983ebddaa4a11b59a805032ea375f5e00bcdee162

See more details on using hashes here.

File details

Details for the file python_mikrotik_login-3.0.8-py3-none-any.whl.

File metadata

  • Download URL: python_mikrotik_login-3.0.8-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for python_mikrotik_login-3.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 bd95f3278bc0a0f04321dcf0c4656c090d5e09c39a33f70378b3004c1b3a8967
MD5 45c74c4f30fca55b7bd62216061cc510
BLAKE2b-256 d2a8f23550f63c1ca4189118a172ad80f7fc9ca2b1d846e4427b427d3130e064

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page