Mint21 mit Conky IP aus Fritzbox auslesen

Support-Forum für deutschsprachige Benutzer

Moderator: karlchen

Forum rules
Topics in this forum are automatically closed 6 months after creation.
Alwiz
Level 1
Level 1
Posts: 13
Joined: Wed Feb 08, 2023 7:00 pm

Mint21 mit Conky IP aus Fritzbox auslesen

Post by Alwiz »

Hallo
Mit conky habe unter unter Mint20.3 die IP aus Fritzbox 7590 ausgelesen:

Code: Select all

${execi 30 curl -s "http://fritz.box:49000/igdupnp/control/WANIPConn1" -H "Content-Type: text/xml; charset="utf-8"" -H "SoapAction:urn:schemas-upnp-org:service:WANIPConnection:1#GetExternalIPAddress" -d "<?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:GetExternalIPAddress xmlns:u='urn:schemas-upnp-org:service:WANIPConnection:1' /> </s:Body> </s:Envelope>" -s | grep -Eo '\<[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}\>'}
  
Unter Mint21.1 kernel 5.15 funktioniert das so nicht meher, aber im Terminal (curl ...) wird die IP-Addresse ausgegeben. Kann es sein, dass hier ein Darstellungsproblem vorliegt. Kennt jemand eine Lösung?

Alwiz
Last edited by LockBot on Tue Aug 08, 2023 10:00 pm, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Alwiz
User avatar
Bleys
Level 4
Level 4
Posts: 426
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: Mint21 mit Conky IP aus Fritzox auslesen

Post by Bleys »

Die externe IP auslesen:

Code: Select all

${execi 7200 curl https://ipinfo.io/ip}
Ist etwas einfacher als der komplizierte Weg über die FB.
Screen Capture_select-area_20230209082111.jpg
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
Alwiz
Level 1
Level 1
Posts: 13
Joined: Wed Feb 08, 2023 7:00 pm

Re: Mint21 mit Conky IP aus Fritzox auslesen

Post by Alwiz »

Nun, Ich wil auch die IP6 Addresse und das IP6-Prefix aus der Fritzbox holen. Dafür wird das oben eingefügte Script entsprehend verändert.
Wie gesagt, via Kommandozeile funktinert es

IP6 Adresse holen:
curl -s "http://fritz.box:49000/igdupnp/control/WANIPConn1" -H "Content-Type: text/xml; charset="utf-8"" -H "SoapAction:urn:schemas-upnp-org:service:WANIPConnection:1#X_AVM_DE_GetExternalIPv6Address" -d "<?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:X_AVM_DE_GetExternalIPv6Address xmlns:u='urn:schemas-upnp-org:service:WANIPConnection:1' /> </s:Body> </s:Envelope>" -s | grep -Eo '\<[[:alnum:]]{0,}(\:[[:alnum:]]{0,4}){7}\>'

IP6 Prefix holen:
curl -s "http://fritz.box:49000/igdupnp/control/WANIPConn1" -H "Content-Type: text/xml; charset="utf-8"" -H "SoapAction:urn:schemas-upnp-org:service:WANIPConnection:1#X_AVM_DE_GetIPv6Prefix" -d "<?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:X_AVM_DE_GetIPv6Prefix xmlns:u='urn:schemas-upnp-org:service:WANIPConnection:1' /> </s:Body> </s:Envelope>" -s | grep -Eo '\<[[:alnum:]]{0,}(\:[[:alnum:]]{0,4}){3}\>'
Alwiz
User avatar
Bleys
Level 4
Level 4
Posts: 426
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: Mint21 mit Conky IP aus Fritzox auslesen

Post by Bleys »

Das funktioniert mit der aktuellen FB Firmware 7.50 z.B. nicht mehr. Du kannst auch alle Daten zu IP Adressen aus dem SYstem selbst per ip holen:

Code: Select all

ip -6 addr show dev <interface>
ipv6 Adresse inkl. Prefix:

Code: Select all

ip -6 addr show dev <interface> | grep inet6 | awk '{print $2}'
IP und Prefix getrennt. IP:

Code: Select all

ip -6 addr show dev <interface> | grep inet6 | awk -F '[/]' '{print $1}' | awk '{print $2}'
Prefix:

Code: Select all

ip -6 addr show dev enp7s0 | grep inet6 | awk -F '[/]' '{print $2}' | awk '{print $1}'
Screen Capture_select-area_20230209110152.jpg
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
Alwiz
Level 1
Level 1
Posts: 13
Joined: Wed Feb 08, 2023 7:00 pm

Re: Mint21 mit Conky IP aus Fritzox auslesen

Post by Alwiz »

Hi
Dankeschön für deine Infos. Da ist wohl ein kleines Missverständnis:
FB 7590/7.50 und MINT19 sowie MINT20 da funktionert meine Vorgehnsweise, aber nicht mit Mint21.
Deine Tipps sind mir bekannt, das ist aber nicht was ich möchte, denn damit erhalte ich die Host-Addressen.
Ich möchte aber die IP6-Addresse des INet Providers an der FB auslesen. Mit "ip -6 addr show ..." sehe ich die aber nicht.
Alwiz
Alwiz
Level 1
Level 1
Posts: 13
Joined: Wed Feb 08, 2023 7:00 pm

Re: Mint21 mit Conky IP aus Fritzox auslesen

Post by Alwiz »

Achso:
und im Teminal/Befehlszeile funkitionieren meine curl scripte. Da hat sicher version Firmware 7.50 keine "Schuld"
Alwiz
Alwiz
Level 1
Level 1
Posts: 13
Joined: Wed Feb 08, 2023 7:00 pm

Re: Mint21 mit Conky IP aus Fritzbox auslesen

Post by Alwiz »

Code: Select all

System:
  Kernel: 5.15.0-60-generic x86_64 bits: 64 compiler: gcc v: 11.3.0 Desktop: Cinnamon 5.6.7
    tk: GTK 3.24.33 wm: muffin dm: LightDM Distro: Linux Mint 21.1 Vera base: Ubuntu 22.04 jammy
Machine:
  Type: Laptop System: LENOVO product: 20KS001JGE v: ThinkPad E580 serial: <superuser required>
    Chassis: type: 10 serial: <superuser required>
  Mobo: LENOVO model: 20KS001JGE v: SDK0J40697 WIN serial: <superuser required> UEFI: LENOVO
    v: R0PET71W (1.48 ) date: 07/12/2022
Battery:
  ID-1: BAT0 charge: 13.1 Wh (35.3%) condition: 37.1/45.7 Wh (81.2%) volts: 10.8 min: 11.1
    model: Celxpert 01AV448 serial: <filter> status: Discharging
CPU:
  Info: quad core model: Intel Core i5-8250U bits: 64 type: MT MCP arch: Coffee Lake rev: A cache:
    L1: 256 KiB L2: 1024 KiB L3: 6 MiB
  Speed (MHz): avg: 1688 high: 1700 min/max: 400/3400 cores: 1: 1643 2: 1672 3: 1696 4: 1699
    5: 1700 6: 1700 7: 1700 8: 1700 bogomips: 28800
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Graphics:
  Device-1: Intel UHD Graphics 620 vendor: Lenovo driver: i915 v: kernel ports: active: eDP-1
    empty: DP-1,HDMI-A-1,HDMI-A-2 bus-ID: 00:02.0 chip-ID: 8086:5917
  Device-2: Chicony Integrated Camera (1280x720@30) type: USB driver: uvcvideo bus-ID: 1-6:4
    chip-ID: 04f2:b604
  Display: x11 server: X.Org v: 1.21.1.3 driver: X: loaded: modesetting unloaded: fbdev,vesa
    gpu: i915 display-ID: :0 screens: 1
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96
  Monitor-1: eDP-1 model: Lenovo res: 1920x1080 dpi: 142 diag: 395mm (15.5")
  OpenGL: renderer: Mesa Intel UHD Graphics 620 (KBL GT2) v: 4.6 Mesa 22.2.5 direct render: Yes
Audio:
  Device-1: Intel Sunrise Point-LP HD Audio vendor: Lenovo driver: snd_hda_intel v: kernel
    bus-ID: 00:1f.3 chip-ID: 8086:9d71
  Sound Server-1: ALSA v: k5.15.0-60-generic running: yes
  Sound Server-2: PulseAudio v: 15.99.1 running: yes
  Sound Server-3: PipeWire v: 0.3.48 running: yes
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Lenovo driver: r8169
    v: kernel pcie: speed: Unknown lanes: 63 port: d000 bus-ID: 03:00.0 chip-ID: 10ec:8168
  IF: enp3s0 state: down mac: <filter>
  Device-2: Intel Dual Band Wireless-AC 3165 Plus Bluetooth driver: iwlwifi v: kernel pcie:
    speed: 2.5 GT/s lanes: 1 bus-ID: 05:00.0 chip-ID: 8086:3166
  IF: wlp5s0 state: up mac: <filter>
Bluetooth:
  Device-1: Intel Bluetooth wireless interface type: USB driver: btusb v: 0.8 bus-ID: 1-5:5
    chip-ID: 8087:0a2a
  Report: hciconfig ID: hci0 rfk-id: 2 state: up address: <filter> bt-v: 2.1 lmp-v: 4.2
    sub-v: 1000
Drives:
  Local Storage: total: 704.24 GiB used: 220.67 GiB (31.3%)
  ID-1: /dev/nvme0n1 vendor: Lenovo model: LENSE30256GMSP34MEAT3TA size: 238.47 GiB
    speed: 31.6 Gb/s lanes: 4 serial: <filter> temp: 35.9 C
  ID-2: /dev/sda vendor: Samsung model: SSD 850 EVO 500GB size: 465.76 GiB speed: 6.0 Gb/s
    serial: <filter>
Partition:
  ID-1: / size: 113.78 GiB used: 26.07 GiB (22.9%) fs: ext4 dev: /dev/nvme0n1p5
  ID-2: /boot/efi size: 256 MiB used: 38.8 MiB (15.1%) fs: vfat dev: /dev/nvme0n1p1
Swap:
  ID-1: swap-1 type: file size: 2 GiB used: 0 KiB (0.0%) priority: -2 file: /swapfile
USB:
  Hub-1: 1-0:1 info: Hi-speed hub with single TT ports: 12 rev: 2.0 speed: 480 Mb/s
    chip-ID: 1d6b:0002
  Device-1: 1-4:2 info: Logitech Unifying Receiver type: Keyboard,Mouse
    driver: logitech-djreceiver,usbhid rev: 2.0 speed: 12 Mb/s chip-ID: 046d:c534
  Device-2: 1-5:5 info: Intel Bluetooth wireless interface type: Bluetooth driver: btusb
    rev: 2.0 speed: 12 Mb/s chip-ID: 8087:0a2a
  Device-3: 1-6:4 info: Chicony Integrated Camera (1280x720@30) type: Video driver: uvcvideo
    rev: 2.0 speed: 480 Mb/s chip-ID: 04f2:b604
  Hub-2: 2-0:1 info: Super-speed hub ports: 6 rev: 3.0 speed: 5 Gb/s chip-ID: 1d6b:0003
Sensors:
  System Temperatures: cpu: 46.0 C pch: 39.5 C mobo: N/A
  Fan Speeds (RPM): fan-1: 0
Repos:
  Packages: 2373 apt: 2353 flatpak: 20
  No active apt repos in: /etc/apt/sources.list
  Active apt repos in: /etc/apt/sources.list.d/danielrichter2007-grub-customizer-jammy.list
    1: deb [arch=amd64 signed-by=/etc/apt/keyrings/danielrichter2007-grub-customizer-jammy.gpg] https: //ppa.launchpadcontent.net/danielrichter2007/grub-customizer/ubuntu jammy main
  Active apt repos in: /etc/apt/sources.list.d/official-package-repositories.list
    1: deb https: //ftp-stud.hs-esslingen.de/pub/Mirrors/packages.linuxmint.com vera main upstream import backport
    2: deb http: //ftp-stud.hs-esslingen.de/ubuntu jammy main restricted universe multiverse
    3: deb http: //ftp-stud.hs-esslingen.de/ubuntu jammy-updates main restricted universe multiverse
    4: deb http: //ftp-stud.hs-esslingen.de/ubuntu jammy-backports main restricted universe multiverse
    5: deb http: //security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
Info:
  Processes: 290 Uptime: 2h 6m Memory: 7.53 GiB used: 2.56 GiB (34.0%) Init: systemd v: 249
  runlevel: 5 Compilers: gcc: 11.3.0 alt: 11/12 Client: Unknown python3.10 client inxi: 3.3.13
Alwiz
User avatar
Bleys
Level 4
Level 4
Posts: 426
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: Mint21 mit Conky IP aus Fritzox auslesen

Post by Bleys »

Alwiz wrote: Thu Feb 09, 2023 7:04 am Achso:
und im Teminal/Befehlszeile funkitionieren meine curl scripte. Da hat sicher version Firmware 7.50 keine "Schuld"
Inzwischen habe ich mir mal die aktuelle TR-64 Doku auf den AVM Seiten angesehen.
Anscheinend haben wir unterschiedliche 7.50 Versionen (1und1 FB bei mir). Mit http://fritz.box:49000/tr64desc.xml erhält man die möglichen Service Typen. igdupnp ist nicht mehr dabei. Alle Control Aufrufe fangen mit /upnp/control/..... an. Ich habe jetzt keinen SOAP Clienten installiert um die einzelnen Aufrufe mal zu senden und die Rückgaben zu sehen. Aber das wäre wohl Dein Weg wieder an die IP6 der Box zu kommen.

Der Teil zu WAN aus der XML Rückgabe:

Code: Select all

<service>
<serviceType>
urn:dslforum-org:service:WANCommonInterfaceConfig:1
</serviceType>
<serviceId>
urn:WANCIfConfig-com:serviceId:WANCommonInterfaceConfig1
</serviceId>
<controlURL>/upnp/control/wancommonifconfig1</controlURL>
<eventSubURL>/upnp/control/wancommonifconfig1</eventSubURL>
<SCPDURL>/wancommonifconfigSCPD.xml</SCPDURL>
</service>
<service>
<serviceType>urn:dslforum-org:service:WANDSLInterfaceConfig:1</serviceType>
<serviceId>
urn:WANDSLIfConfig-com:serviceId:WANDSLInterfaceConfig1
</serviceId>
<controlURL>/upnp/control/wandslifconfig1</controlURL>
<eventSubURL>/upnp/control/wandslifconfig1</eventSubURL>
<SCPDURL>/wandslifconfigSCPD.xml</SCPDURL>
</service>
</serviceList>
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
Alwiz
Level 1
Level 1
Posts: 13
Joined: Wed Feb 08, 2023 7:00 pm

Re: Mint21 mit Conky IP aus Fritzbox auslesen

Post by Alwiz »

Hallo
Nun, wie erkärt sich der Umstand, dass unter Mint21.1 die Eingabe in der Terminal-Befehlszeile von z.B.:

curl -s "http://fritz.box:49000/igdupnp/control/WANIPConn1" -H "Content-Type: text/xml; charset="utf-8"" -H "SoapAction:urn:schemas-upnp-org:service:WANIPConnection:1#X_AVM_DE_GetExternalIPv6Address" -d "<?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:X_AVM_DE_GetExternalIPv6Address xmlns:u='urn:schemas-upnp-org:service:WANIPConnection:1' /> </s:Body> </s:Envelope>" -s | grep -Eo '\<[[:alnum:]]{0,}(\:[[:alnum:]]{0,4}){7}\>'

die IP6 Addresse ausgelesen wird, aber in conky eben nicht, aber unter Mint19.3 und Mint20.3 sehr wohl. Das Ganze mit der selben FB 7590/7.50
Alwiz
User avatar
Bleys
Level 4
Level 4
Posts: 426
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: Mint21 mit Conky IP aus Fritzbox auslesen

Post by Bleys »

Alwiz wrote: Fri Feb 10, 2023 6:01 am die IP6 Addresse ausgelesen wird, aber in conky eben nicht, aber unter Mint19.3 und Mint20.3 sehr wohl. Das Ganze mit der selben FB 7590/7.50
Auf meinem Laptop läuft noch Ubuntu Budgie 20.04. Da kommt tatsächlich die IP6 zurück. Dann hab ich mal Ubuntu 22.04 in einer VM installiert. Auch da kommt die IP6 zurück. Und just for fun mache ich den Aufruf auch noch mal in meinem leufenden 21.1 System:

Code: Select all

ralf@Nexus:~$ curl -s "http://192.168.3.1:49000/igdupnp/control/WANIPConn1" -H "Content-Type: text/xml; charset="utf-8"" -H "SoapAction:urn:schemas-upnp-org:service:WANIPConnection:1#X_AVM_DE_GetExternalIPv6Address" -d "<?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:X_AVM_DE_GetExternalIPv6Address xmlns:u='urn:schemas-upnp-org:service:WANIPConnection:1' /> </s:Body> </s:Envelope>" -s | grep -Eo '\<[[:alnum:]]{0,}(\:[[:alnum:]]{0,4}){7}\>'
2001:9e8:4039:1fed:1eed:6fff:xxxx:xxxx
Ich bin gerade etwas sprachlos :/
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
User avatar
Bleys
Level 4
Level 4
Posts: 426
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: Mint21 mit Conky IP aus Fritzbox auslesen

Post by Bleys »

Der Aufruf aus deinem Startpost unterscheidet sich an mehreren Stellen vom (funktionierenden) Aufruf Deines letzten Post. Der erste im Conky Aufruf liefert nichts.
Bildschirmfoto vom 2023-02-10 12-24-08.png
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
Alwiz
Level 1
Level 1
Posts: 13
Joined: Wed Feb 08, 2023 7:00 pm

Re: Mint21 mit Conky IP aus Fritzbox auslesen

Post by Alwiz »

Siehe Anhang; einmal für IP4 und einmal IP6 aus FB7590 /7.50 ; Mint21.1
Attachments
Bildschirmfoto vom 2023-02-10 21-20-31.png
Alwiz
User avatar
grndplane
Level 4
Level 4
Posts: 245
Joined: Tue Jan 12, 2010 4:08 pm
Location: Sunny California - Where everything cost's twice what it should.

Re: Mint21 mit Conky IP aus Fritzbox auslesen

Post by grndplane »

Auf Mint 21.1 funktioniert das für mich.

Code: Select all

Ext IP: ${alignr}$color3${exec wget http://ipinfo.io/ip -qO -}
-grndplane (Mike)
Linux Mint 21.x 64-bit
Kernel: 6.X-liquorix-amd64
WM: LeftWM
Alwiz
Level 1
Level 1
Posts: 13
Joined: Wed Feb 08, 2023 7:00 pm

Re: Mint21 mit Conky IP aus Fritzbox auslesen

Post by Alwiz »

Der Unterschied zum Startpost ist:
GetExternalIPAddress -> für IP4
X_AVM_DE_GetExternalIPv6Address -> für IP6
Alwiz
User avatar
Bleys
Level 4
Level 4
Posts: 426
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: Mint21 mit Conky IP aus Fritzbox auslesen

Post by Bleys »

grndplane wrote: Fri Feb 10, 2023 4:41 pm Auf Mint 21.1 funktioniert das für mich.

Code: Select all

Ext IP: ${alignr}$color3${exec wget http://ipinfo.io/ip -qO -}
Hatte ich ganz oben schon mal ähnlich vorgeschlagen:

Code: Select all

${execi 7200 curl https://ipinfo.io/ip}
Das liefert aber nur die IP4 Adresse und der TS möchte die IP6 Adresse des Routers.
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
Alwiz
Level 1
Level 1
Posts: 13
Joined: Wed Feb 08, 2023 7:00 pm

Re: Mint21 mit Conky IP aus Fritzbox auslesen

Post by Alwiz »

Zusammenfassend:
Diese codes will ich in Conky einsetzen. Unter Mint21.1 Fritzbox 7590 /7.50 erfolgt keine Ausgabe, aber im Terminal/Befehlszeile funktioniert es.
In älteren Ubuntu - Mint Versionen gibt Conky die Adressen aus.

IP4 Addresse

Code: Select all

curl "http://fritz.box:49000/igdupnp/control/WANIPConn1" -H "Content-Type: text/xml; charset="utf-8"" -H "SoapAction:urn:schemas-upnp-org:service:WANIPConnection:1#GetExternalIPAddress" -d "<?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:GetExternalIPAddress xmlns:u='urn:schemas-upnp-org:service:WANIPConnection:1' /> </s:Body> </s:Envelope>" -s | grep -Eo '\<[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}\>'
IP6 Addresse des Routers (FB) am Internet

Code: Select all

curl -s "http://fritz.box:49000/igdupnp/control/WANIPConn1" -H "Content-Type: text/xml; charset="utf-8"" -H "SoapAction:urn:schemas-upnp-org:service:WANIPConnection:1#X_AVM_DE_GetExternalIPv6Address" -d "<?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:X_AVM_DE_GetExternalIPv6Address xmlns:u='urn:schemas-upnp-org:service:WANIPConnection:1' /> </s:Body> </s:Envelope>" -s | grep -Eo '\<[[:alnum:]]{0,}(\:[[:alnum:]]{0,4}){7}\>'
IP6 Prefix vom Provider gestellt (hier ist nur der Filter (gep) anders gesetzt

Code: Select all

curl -s "http://fritz.box:49000/igdupnp/control/WANIPConn1" -H "Content-Type: text/xml; charset="utf-8"" -H "SoapAction:urn:schemas-upnp-org:service:WANIPConnection:1#X_AVM_DE_GetIPv6Prefix" -d "<?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:X_AVM_DE_GetIPv6Prefix xmlns:u='urn:schemas-upnp-org:service:WANIPConnection:1' /> </s:Body> </s:Envelope>" -s | grep -Eo '\<[[:alnum:]]{0,}(\:[[:alnum:]]{0,4}){3}\>'
Alwiz
User avatar
Bleys
Level 4
Level 4
Posts: 426
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: Mint21 mit Conky IP aus Fritzbox auslesen

Post by Bleys »

Ich habe das jetzt mal in meinem Conky eingebaut. Allerdings wird mein Conky komplett per LUA realisiert. Also habe ich den Aufruf in ein sh Script verlegt:

Code: Select all

#!/bin/sh
echo $(curl -s "http://192.168.3.1:49000/igdupnp/control/WANIPConn1" -H "Content-Type: text/xml; charset="utf-8 -H "SoapAction:urn:schemas-upnp-org:service:WANIPConnection:1#X_AVM_DE_GetExternalIPv6Address" -d "<?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:X_AVM_DE_GetExternalIPv6Address xmlns:u='urn:schemas-upnp-org:service:WANIPConnection:1' /> </s:Body> </s:Envelope>" -s | grep -Eo '\<[[:alnum:]]{0,}(\:[[:alnum:]]{0,4}){7}\>')
In meinem LUA Script rue ich das per conky_parse auf:

Code: Select all

ipv6=conky_parse('${execi 3600 sh '..home_path..'/.conky/ip6.sh}')
ipv6.jpg
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
Alwiz
Level 1
Level 1
Posts: 13
Joined: Wed Feb 08, 2023 7:00 pm

Re: Mint21 mit Conky IP aus Fritzbox auslesen

Post by Alwiz »

DANKE!
Ja, über den kleinen Umweg via shell-script funzt es.
Das ist schon ein wenig merkwürdig, wie ich finde!
Alwiz
User avatar
Bleys
Level 4
Level 4
Posts: 426
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: Mint21 mit Conky IP aus Fritzbox auslesen

Post by Bleys »

Alwiz wrote: Sat Feb 11, 2023 4:25 am DANKE!
Ja, über den kleinen Umweg via shell-script funzt es.
Das ist schon ein wenig merkwürdig, wie ich finde!
Ich habe mal das sh Script erweitert:

Code: Select all

#!/bin/bash

case "$1" in
ip6)
            echo $(curl -s "http://192.168.3.1:49000/igdupnp/control/WANIPConn1" -H "Content-Type: text/xml; charset=utf-8" -H "SoapAction:urn:schemas-upnp-org:service:WANIPConnection:1#X_AVM_DE_GetExternalIPv6Address" -d "<?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:X_AVM_DE_GetExternalIPv6Address xmlns:u='urn:schemas-upnp-org:service:WANIPConnection:1' /> </s:Body> </s:Envelope>" -s | grep -Eo "\<[[:alnum:]]{0,}(\:[[:alnum:]]{0,4}){7}\>");;

prefix)

            echo $(curl -s "http://192.168.3.1:49000/igdupnp/control/WANIPConn1" -H "Content-Type: text/xml; charset=utf-8" -H "SoapAction:urn:schemas-upnp-org:service:WANIPConnection:1#X_AVM_DE_GetIPv6Prefix" -d "<?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:X_AVM_DE_GetIPv6Prefix xmlns:u='urn:schemas-upnp-org:service:WANIPConnection:1' /> </s:Body> </s:Envelope>" -s | grep -Eo '\<[[:alnum:]]{0,}(\:[[:alnum:]]{0,4}){3}\>');;

ip4)

#            echo $(curl "http://192.168.3.1:49000/igdupnp/control/WANIPConn1" -H "Content-Type: text/xml; charset=utf-8" -H "SoapAction:urn:schemas-upnp-org:service:WANIPConnection:1#X_AVM_DE_GetExternalIPAddress" -d "<?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:X_AVM_DE_GetExternalIPAddress xmlns:u='urn:schemas-upnp-org:service:WANIPConnection:1' /> </s:Body> </s:Envelope>" -s | grep -Eo '\<[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}\>');;

echo $(curl https://ipinfo.io/ip);;

esac
Aufruf per conkyrc:

Code: Select all

conky.text = [[
 ${execi 300 sh $HOME/.conky/ips.sh ip6}
 ${execi 300 sh $HOME/.conky/ips.sh prefix}
 ${execi 300 sh $HOME/.conky/ips.sh ip4}
]];
Der FB Aufruf für die IPv4 funktioniert bei mir nicht, deshalb noch die Variante über ipinfo.
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
Alwiz
Level 1
Level 1
Posts: 13
Joined: Wed Feb 08, 2023 7:00 pm

Re: Mint21 mit Conky IP aus Fritzbox auslesen

Post by Alwiz »

Versuche es mal damit! IP4 funktionierte bei mir auch nicht. Ich habe Anführungszeichen bei "Content-Type: text/xml; charset="utf-8"" gesetzt. Warum das für IP6 und prefix funzte - keine Ahnung.

Code: Select all

#!/bin/bash

case "$1" in
ip6)
            curl -s "http://fritz.box:49000/igdupnp/control/WANIPConn1" -H "Content-Type: text/xml; charset="utf-8"" -H "SoapAction:urn:schemas-upnp-org:service:WANIPConnection:1#X_AVM_DE_GetExternalIPv6Address" -d "<?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:X_AVM_DE_GetExternalIPv6Address xmlns:u='urn:schemas-upnp-org:service:WANIPConnection:1' /> </s:Body> </s:Envelope>" -s | grep -Eo "\<[[:alnum:]]{0,}(\:[[:alnum:]]{0,4}){7}\>";;

prefix)

            echo $(curl -s "http://fritz.box:49000/igdupnp/control/WANIPConn1" -H "Content-Type: text/xml; charset="utf-8"" -H "SoapAction:urn:schemas-upnp-org:service:WANIPConnection:1#X_AVM_DE_GetIPv6Prefix" -d "<?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:X_AVM_DE_GetIPv6Prefix xmlns:u='urn:schemas-upnp-org:service:WANIPConnection:1' /> </s:Body> </s:Envelope>" -s | grep -Eo '\<[[:alnum:]]{0,}(\:[[:alnum:]]{0,4}){3}\>');;

ip4)

           echo $(curl "http://fritz.box:49000/igdupnp/control/WANIPConn1" -H "Content-Type: text/xml; charset="utf-8"" -H "SoapAction:urn:schemas-upnp-org:service:WANIPConnection:1#GetExternalIPAddress" -d "<?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:GetExternalIPAddress xmlns:u='urn:schemas-upnp-org:service:WANIPConnection:1' /> </s:Body> </s:Envelope>" -s | grep -Eo '\<[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}\>');;


#           echo $(curl "http://fritz.box:49000/igdupnp/control/WANIPConn1" -H "Content-Type: text/xml; charset=utf-8" -H "SoapAction:urn:schemas-upnp-org:service:WANIPConnection:1#X_AVM_DE_GetExternalIPAddress" -d "<?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:X_AVM_DE_GetExternalIPAddress xmlns:u='urn:schemas-upnp-org:service:WANIPConnection:1' /> </s:Body> </s:Envelope>" -s | grep -Eo '\<[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}\>');;

#echo $(curl https://ipinfo.io/ip);;

esac
Alwiz
Locked

Return to “Deutsch - German”