diff --git a/readme.md b/readme.md index cde9fe0..01a4cc7 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -# Web Knocking +# Web Knocking for MikroTik ![Screenshot](https://user-images.githubusercontent.com/43970835/79135939-3172f900-7dc1-11ea-9d26-f923c47d47b6.png) ## How it works @@ -12,6 +12,7 @@ For users who need to connect outside the office, we give a link like this: http://100.100.1.2:2020/access_SeCrEtCoDe +It is possible to support other vendors' devices with help of [netmiko](https://github.com/ktbyers/netmiko), but have MikroTik-s only. ## Setup ### Option 1: EXE @@ -27,6 +28,8 @@ Just download the project. ## Usage Change settings in *settings.ini* to your own. +It is highly recommended to add your IP address to *safe_hosts* to avoid blacklisting during testing. + Forward a port in the router from the settings to the computer where Web Knocking is running. Enable API access on the router from this computer (*ip services - api-ssl* or *api*). @@ -36,5 +39,6 @@ For white and black lists, make the rules according to your needs. For example, /ip firewall nat add src-address-list=white_list in-interface=WAN \ dst-port=80 action=dst-nat to-addresses=192.168.0.10 to-ports=80 -## Project Support +## Support project - [Donate via PayPal](https://www.paypal.me/vikil) +- Correct my mistakes diff --git a/readme_ru.md b/readme_ru.md index 57e5a05..8e15bc3 100644 --- a/readme_ru.md +++ b/readme_ru.md @@ -1,4 +1,4 @@ -# Web Knocking +# Web Knocking для MikroTik ![Screenshot](https://user-images.githubusercontent.com/43970835/79136043-63845b00-7dc1-11ea-9e30-6d4e011c2bc3.png) ## Как это работает @@ -12,6 +12,7 @@ http://100.100.1.2:2020/access_SeCrEtCoDe +Теоретически можно сделать и для других устройств с помощью [netmiko](https://github.com/ktbyers/netmiko), но мне не на чём проверить. ## Установка ### Вариант 1: EXE @@ -27,6 +28,8 @@ ## Использование Измените настройки в settings.ini на свои. +Очень рекомендуется добавить свой IP адрес в *safe_hosts*, чтобы при тестировании не занести себя в чёрный список. + Пробросьте в маршрутизаторе порт из настроек на компьютер, на котором запущен Web Knocking. Включите в маршрутизаторе доступ к API с этого компьютера (*ip services - api-ssl* или *api*). @@ -37,4 +40,5 @@ dst-port=80 action=dst-nat to-addresses=192.168.0.10 to-ports=80 ## Помощь проекту -- Расскажите о проекте друзьям. +- Расскажите о проекте друзьям +- Присылайте отчёты об ошибках diff --git a/resources.py b/resources.py index 136371b..8d15bd7 100644 --- a/resources.py +++ b/resources.py @@ -1,4 +1,4 @@ -class Language(): +class Language(): def __init__(self, language:str='en'): if language == 'ru': lang_str = dictionary_ru diff --git a/web_knocking.ini b/web_knocking.ini index 1f777ac..d1fc409 100644 --- a/web_knocking.ini +++ b/web_knocking.ini @@ -3,14 +3,25 @@ language=en ; Web server listening port on PC: port=8008 -white_list=WHITE_LIST -black_list=BLACK_LIST +; White and black list names on your device: +white_list=FRIENDS +black_list=BAD_GUYS +; Hosts that can't be blacklisted +; Add your own IP address to make sure that you +; won't be blacklisted +safe_hosts=127.0.0.1, 100.64.1.2 +; Logging to a file: +log_file=false [Device] +; Your router settings host=192.168.88.1 +; For non-SSL connection to MikroTik +; use 8728: port=8729 username=admin password=admin +; Use SSL connection: secure=True [Users] @@ -24,4 +35,3 @@ secure=True ; Examples: John Smith=Ye7gfV John Doe=n5Bwif 2030-4-6 -Jane=DaTe 2020-4-1 diff --git a/web_knocking.py b/web_knocking.py index 0010d89..fab074e 100644 --- a/web_knocking.py +++ b/web_knocking.py @@ -1,4 +1,3 @@ -# 2020.04.01 import configparser import logging @@ -88,7 +87,7 @@ def __init__(s, keep_setting_case:bool=False): config.optionxform = str try: with open(INI_FILE, 'tr' - , encoding='utf-8-sig') as fd: + , encoding='utf-8') as fd: config.read_file(fd) except FileNotFoundError: log_error(f'{INI_FILE} file not found' @@ -559,7 +558,7 @@ def main(): logger.addHandler(fh) if os.path.exists('files/index.html'): with open('files/index.html' - , encoding='utf-8-sig') as fd: + , encoding='utf-8') as fd: sett.html = fd.read() else: sett.html = resources.HTML_DEFAULT