Metadata-Version: 2.1
Name: python-mikrotik-login
Version: 3.0.5
Summary: Python code to login to Mikrotik WebClient without GUI
Home-page: https://github.com/castrix/Python-Mikrotik-WebClient-WiFi-Login
Author: castrix
Author-email: castrix.ihsan@gmail.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: backports.zoneinfo (==0.2.1)
Requires-Dist: certifi (==2020.12.5)
Requires-Dist: chardet (==4.0.0)
Requires-Dist: idna (==2.10)
Requires-Dist: Js2Py (==0.70)
Requires-Dist: pyjsparser (==2.7.1)
Requires-Dist: requests (==2.25.1)
Requires-Dist: six (==1.15.0)
Requires-Dist: speedtest-cli (==2.1.2)
Requires-Dist: tzlocal (==3.0b1)
Requires-Dist: urllib3 (==1.26.2)

# 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](https://github.com/castrix/Python-Mikrotik-WebClient-WiFi-Login/tree/master/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](https://github.com/castrix)

[MarchelAce](https://github.com/Marchel-Ace)

