1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Filebase
  4. Forum
  5. Zebradem-WIKI
  6. Foren-Regeln
  7. Spenden Liste
    1. Spenden
  • Anmelden
  • Registrieren
  • Suche
ZebraDem-Sponsoring
Dieses Thema
  • Alles
  • Dieses Thema
  • Dieses Forum
  • Seiten
  • Dateien
  • Forum
  • Erweiterte Suche
  1. Forum
  2. Computer Ecke
  3. Hardware
  4. Router/Modem

Schneller Reconnect der FRITZ!Box in Python

  • mandy28
  • 17. August 2011 um 09:29
  • mandy28
    Erleuchteter
    Reaktionen
    1
    Punkte
    88.996
    Beiträge
    16.178
    • 17. August 2011 um 09:29
    • #1

    Über dieses Add-on

    Fox!Box by Leland Grunt (Version 1.2.0)
    - A Mozilla Firefox extension for the AVM FRITZ!Box -


    -------------------------------------------------------------
    DESCRIPTION
    -------------------------------------------------------------
    You are now only one click away from getting a new public ip-address.
    Just click on "Reconnect FRITZ!Box" and your AVM FRITZ!Box will be reconnected to the internet.

    The extension offers the following advantages:
    - The current public ip-address will be displayed in the Firefox status bar. You don't need to connect to the FRITZ!Box Web-Admin-Site or to open the FRITZ!DSL Software.
    - One click and the FRITZ!Box will be terminate the current internet connection and then automatically reconnect.
    - The current public ip-address can be copied to the clipboard.
    - No additional software is required. If you don't like the extension, it is simple to uninstall it over the Firefox Add-on menu. No files will be left and clutter up your pc.
    - "Fox!Box" is independent from a special operation system. You only need Mozilla Firefox.
    - The extension is very small and don't need a lot system ressources as other software.
    - Guaranteed virus-free.


    For extension feedback, commentary and enhancement requests, please write an email to foxbox(at)needful-tools.de
    or got to https://addons.mozilla.org/de/firefox/addon/5681.

    This extension is for AVM FRITZ!Box owners only.

    Tested with:
    - FRITZ!Box Fon WLAN 7390 with Firmware-Version 84.04.89
    Note: If IPv6 Support of the FRITZ!Box is activated, the Firefox preference "network.dns.disableIPv6" must be set to true OR the value "fritz.box" must be added to the preference "network.dns.ipv4OnlyDomains".
    Firefox must be restarted, so the changes take effect.
    - FRITZ!Box Fon WLAN 7170 with Firmware-Version 29.04.80.
    - FRITZ!Box Fon WLAN 7141 with Firmware-Version 40.04.76.


    -------------------------------------------------------------
    MANUAL/HELP
    -------------------------------------------------------------

    There are five options to start the reconnect:
    1. Right click on the Fox!Box status bar and select "Reconnect FRITZ!Box".
    2. Right click anywhere in the browser window and select in the now appearing context menu "Reconnect FRITZ!Box".
    3. Open the Firefox tools menu and select "Reconnect FRITZ!Box".
    4. Click on the toolbar button "Reconnect FRITZ!Box" (First you have to add the button to the toolbar).
    5. Double click with left mouse button on the Fox!Box status bar.


    Options:
    - URL to FRITZ!Box UPnP Gateway: The URL to the FRITZ!Box UPnP gateway.
    Normally there is no need to change the default value.
    If the AVM FRITZ!Box is not reachable under "fritz.box", you can use the internal ip-address instead.
    Note: The FRITZ!Box setting "Änderungen der Sicherheitseinstellungen über UPnP gestatten" must not be activated.
    - Show 'Reconnect FRITZ!Box' in context menu: Self-explanatory!
    - Show 'Reconnect FRITZ!Box' in tools menu: Self-explanatory!
    - Show in status bar: Shows the public ip-address in the status bar.
    - Interval: Inverval in minutes in which Fox!Box looks after the status of the internet connection.
    - Reconnect by double click on status bar: Self-explanatory!
    - NEW! IP-Address check wait time: Time in seconds in which Fox!Box checks the IP-Address after reconnect.

    - Reset all:
    Restores the default values.


    Status bar:
    - The status bar shows the current public ip-address.
    The current public ip-address can be copyed to the clipboard by the function "Copy ip-address to clipboard".
    - Every time you open Firefox, the status bar will be refreshed.
    - Additionally a timer looks up every minute after the status of the internet connection.
    The timer can be disabled/enabled by the function "Fox!Box enable".
    The interval of the timer can be changed in the options.
    - If no internet connection exists, the status bar displays "No internet connection".
    - If the FRITZ!Box returns an error, the HTTP status code will be displayed in the status bar.
    - If you don't want to wait the next time the timer starts, you can manually update the status bar per right click on the status bar and then select "Update status bar".
    - For a fast review of the internet connection status, the label of the status bar displays green if everything is ok, and red if no internet connection exists.
    - The status bar tooltip shows the current FRITZ!Box DSL information (Link/Line Status, Current Downstream and Upstream bit rate in kBit/s).


    Direkt Download


    Copyright (c) 2007-2011 Leland Grunt
    All rights reserved.

    Quelle : https://addons.mozilla.org

    • Zitieren
  • mandy28
    Erleuchteter
    Reaktionen
    1
    Punkte
    88.996
    Beiträge
    16.178
    • 17. August 2011 um 09:33
    • #2

    Schneller Reconnect der FRITZ!Box in Python

    Zitat


    Wer hätte nicht gerne eine Möglichkeit mal eben schnell die FRITZ!Box per Shellskript zu einem Reconnect zu überreden? Ganz am Anfang (Jahr 2000 oder so?) gab es ja nur so eine “dubiose” Binary für Windows, welche per UPNP ulra schnell die FRITZ!Box reconnecten konnte.(2 Sekunden ca.)

    Heute machen wir das ein bisschen schöner(nicht nur für Linux!) in Python (Version 2.x):

    Code
    [color="#FF8C00"]#!/usr/bin/python[/color]
    # -*- coding: utf-8 -*-
    #
    # Copyright (C) 2011  Geekparadise.de
    #
    # This program is free software: you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    # the Free Software Foundation, either version 3 of the License, or
    # (at your option) any later version.
    #
    # This program is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # GNU General Public License for more details.
    #
    # You should have received a copy of the GNU General Public License
    # along with this program.  If not, see <http://www.gnu.org/licenses/>.
    #
    # Contact: http://geekparadise.de/contact/
    # Usage: ./reconnect.py
    # Version: 1.0
    # Only for Python 2.x!
     
    import re
    import pycurl
    import StringIO
    import sys
     
    def post_data(data):
            encoded_data = ["Content-Type: text/xml", \
            "charset: utf-8", "SoapAction: urn:schemas-upnp-org:service:WANIPConnection:1#"+data]
            encoded_data2=("""<?xml version="1.0" encoding="utf-8"?>
            <s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
            xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
            <s:Body>
            <u:"""+data+"""s xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1" />
            </s:Body>
            </s:Envelope>""")
            try:
                    b = StringIO.StringIO()
                    curl = pycurl.Curl()
                    curl.setopt(pycurl.POSTFIELDS, encoded_data2)
                    curl.setopt(pycurl.HTTPHEADER,encoded_data)
                    curl.setopt(pycurl.TIMEOUT,10)
                    curl.setopt(pycurl.CONNECTTIMEOUT,10)
                    curl.setopt(pycurl.URL, "http://fritz.box:49000/upnp/control/WANIPConn1")
                    curl.setopt(pycurl.WRITEFUNCTION, b.write)
                    curl.perform()
                    return b.getvalue()
            except:
                    print "Error: connection problems."
                    exit(-1)
     
    # Query actual IP and show it
    ip = re.split(r"<NewExternalIPAddress>",post_data("GetExternalIPAddress"))
    if len(ip) > 1:
            ip = re.split(r"</NewExternalIPAddress>",ip[1])
    else:
            print "Error: IP query failed."
            exit(-1)
    print "Actual IP: "+ip[0]
     
    # start reconnect
    sys.stdout.write("Reconnect...")
    sys.stdout.flush()
    post_data("ForceTermination")
    print "done."
     
    # Query actual IP
    ip2 = re.split(r"<NewExternalIPAddress>",post_data("GetExternalIPAddress"))
    if len(ip2) > 1:
            ip2 = re.split(r"</NewExternalIPAddress>",ip2[1])
    else:
            print "Error: IP query failed."
            exit(-1)
     
    # Check if IP has changed: True -> show new IP; False -> show error.
    if ip[0] != ip2[0]:
            print "New IP: "+ip2[0]
            exit(0)
    else:
            print "Error: IP did not change."
            exit(-1)
    Alles anzeigen


    Für Distributionen mit Python 3 als Standard sollte man die erste Zeile in

    Code
    [color="#FF8C00"]#!/usr/bin/python2[/color]


    ändern.

    Das ganze in reconnect.py (oder wie ihr es nennen wollt..) packen und mit chmod +x reconnect.py ausführbar machen.

    Weiterhin muss der UPNP Kram in der Fritz!Box aktiviert sein.(Bei mir ist das irgendwo bei “Netzwerkeinstellungen” und dort muss ” Statusinformationen über UPnP übertragen (empfohlen)” und “Änderungen der Sicherheitseinstellungen über UPnP gestatten” aktiviert sein.)

    Übrigens: Der reconnect selbst geht extrem schnell (~1-2 Sekunden) nur die Abfrage der neuen IP braucht einige Sekunden, in der Weboberfläche ist sie viel schneller sichtbar.

    Getestet hab ich das auf einer FRITZ!Box SL Wlan, ob das bei neueren Modellen auch noch geht, weiß ich nicht.

    Die Idee stammt übrigens nicht von mir, ursprl. kommt sie glaube ich aus einem Reconnect Binary für Windows,
    blog.Jbbr.net hat dann eine Curlvariante für Linux dazu geschrieben. Details zur Fritz!Box UPNP Geschichte hab ich dann bei OpenShots gefunden. Danke dafür!

    Falls ihr sagt “Wow, WTF ist eine FRITZ!Box?”, FRITZ!Box ist ein DSL-Router der Firma AVM. Falls ihr auch einen schnellen Reconnect wollt: Kauft euch eine FRITZ!Box, AVM freut sich

    Alles anzeigen

    Quelle geekparadise.de

    • Zitieren

Jetzt mitmachen!

Du hast noch kein Benutzerkonto auf unserer Seite? Registriere dich kostenlos und nimm an unserer Community teil!

Benutzerkonto erstellen Anmelden

Spenden

Vielen Dank für die Unterstützung!
Hiermit unterstützt du Zebradem.
Das beinhaltet überwiegend die Serverkosten und Lizenzgebühren.
Spenden

Letzte Beiträge

  • 6 GHz WLAN in der EU: Ein Machtkampf um dein Heimnetz

    heugabel 22. Mai 2025 um 09:27
  • Samsung TV Plus/Rakuten TV

    scarface247 21. Mai 2025 um 23:06
  • Miniatur-Handys im Gefängnis: Operation Prison Break deckt erheblichen Missbrauch auf

    heugabel 21. Mai 2025 um 16:27
  • Letsung GoLite 11: Testbericht eines Ultra-günstigen Mini-PCs

    heugabel 20. Mai 2025 um 14:27
  • IPTV-Piraterie in Indien: Großaktion gegen illegales Streaming-Netzwerk

    heugabel 20. Mai 2025 um 13:27
  • EU-Turbo-Takedowns: Ein neues Kapitel im Kampf gegen illegales Streaming?

    heugabel 20. Mai 2025 um 10:27
  • ACEMAGIC M1 Review – Der kompakte Kraftprotz mit Ryzen-Power

    heugabel 19. Mai 2025 um 08:27
  • Plex Live TV / LG Channels / Wedo TV

    Fellfresse 18. Mai 2025 um 17:06
  • Abmahngefahr durch Likes: Gericht in den USA sieht Social-Media-Interaktionen als Beweis

    heugabel 18. Mai 2025 um 15:27
  • BREIN Licht ins Dunkel: Illegale IPTV-Anbieter stark unter Druck

    heugabel 17. Mai 2025 um 16:27

Aktivste Themen

  • SammelThread : Aktuelle AVM Labor Firmwares

    263 Antworten
  • FRITZ!Box 6360 Cable 85.06.04 Recover

    146 Antworten
  • Suchthread FritzBox Firmwares

    87 Antworten
  • UM Fritzbox 6360 Firmware update

    62 Antworten
  • AVM Labor firmwares Disskussions Thread

    57 Antworten
  • (gelöst) (Crossposting) NO-IP Fritzbox 7390 IP wird nicht angepasst CS nicht möglich

    47 Antworten
  • AVM Fritzboxen Fernzugriff abschalten-Hackgefahr

    45 Antworten
  • Problem mit Dyndns

    44 Antworten
  • Alice und Router

    41 Antworten
  • (gelöst) Fritzbox ohne Freetz täglich NEUSTARTEN lassen!

    39 Antworten

Benutzer online in diesem Thema

  • 1 Besucher
  1. Kontakt
© 2024 Zebradem - Software by WoltLab