/
Watarie
/
Prinex
Обзор
Документация
Войти
/
Watarie
/
Prinex
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
3
CI/CD
Аналитика
Безопасность
main
scripts/quick_scan.py
39 строк
1 KB
Watarie
Reorganize backend: move scripts to scripts/, MD files to docs/
26 июн 2026, 17:36
26 июн 2026, 17:36
b061870
Код
Авторство
О чём код?
#!/usr/bin/env python3 """Quick ESP8266 scanner - проверка конкретного IP""" import requests import sys def check_ip(ip): """Проверка одного IP""" url = f"http://{ip}/info" try: r = requests.get(url, timeout=5) if r.status_code == 200: data = r.json() if 'id' in data and 'mac' in data: print("FOUND: " + data['id'] + " @ " + ip) print(" MAC: " + data['mac']) print(" mDNS: " + data.get('mdns', 'N/A')) return True else: print(str(ip) + " returned status " + str(r.status_code)) except requests.exceptions.Timeout: print(str(ip) + " timeout (5 sec)") except requests.exceptions.ConnectionError: print(str(ip) + " connection refused") except Exception as e: print(str(ip) + " error: " + str(e)) return False if __name__ == "__main__": if len(sys.argv) < 2: print("Usage: python quick_scan.py <IP>") print("Example: python quick_scan.py 192.168.1.124") sys.exit(1) ip = sys.argv[1] print("Checking ESP at " + ip + "...") if check_ip(ip): print("\nDevice found! You can bind it to a printer.") else: print("\nDevice not found. Check if it's online and accessible.")