<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://wiki.ixheim.de/index.php?action=history&amp;feed=atom&amp;title=Python_Netzwerkcheck</id>
	<title>Python Netzwerkcheck - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.ixheim.de/index.php?action=history&amp;feed=atom&amp;title=Python_Netzwerkcheck"/>
	<link rel="alternate" type="text/html" href="https://wiki.ixheim.de/index.php?title=Python_Netzwerkcheck&amp;action=history"/>
	<updated>2026-06-29T12:41:45Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Xinux Wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.ixheim.de/index.php?title=Python_Netzwerkcheck&amp;diff=19737&amp;oldid=prev</id>
		<title>Terry.dailey: /* Netzwerkcheck */</title>
		<link rel="alternate" type="text/html" href="https://wiki.ixheim.de/index.php?title=Python_Netzwerkcheck&amp;diff=19737&amp;oldid=prev"/>
		<updated>2019-12-04T14:06:33Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Netzwerkcheck&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 4. Dezember 2019, 14:06 Uhr&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Zeile 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Netzwerkcheck==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Netzwerkcheck==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Mit diesem script lassen sich Erreichbarkeit, Portstatus und Proxyserver Status einer Netzwerkadresse überprüfen.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#!/usr/bin/python&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#!/usr/bin/python&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key my_wiki:diff::1.12:old-19708:rev-19737 --&gt;
&lt;/table&gt;</summary>
		<author><name>Terry.dailey</name></author>
	</entry>
	<entry>
		<id>https://wiki.ixheim.de/index.php?title=Python_Netzwerkcheck&amp;diff=19708&amp;oldid=prev</id>
		<title>Thomas.will: Die Seite wurde neu angelegt: „==Netzwerkcheck== &lt;syntaxhighlight&gt; #!/usr/bin/python #pip install pyping colorama wget  dat_sys=&quot;/usr/local/etc/funktion.cfg&quot; import os import socket, datetim…“</title>
		<link rel="alternate" type="text/html" href="https://wiki.ixheim.de/index.php?title=Python_Netzwerkcheck&amp;diff=19708&amp;oldid=prev"/>
		<updated>2019-12-04T12:02:45Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „==Netzwerkcheck== &amp;lt;syntaxhighlight&amp;gt; #!/usr/bin/python #pip install pyping colorama wget  dat_sys=&amp;quot;/usr/local/etc/funktion.cfg&amp;quot; import os import socket, datetim…“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Netzwerkcheck==&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
#pip install pyping colorama wget &lt;br /&gt;
dat_sys=&amp;quot;/usr/local/etc/funktion.cfg&amp;quot;&lt;br /&gt;
import os&lt;br /&gt;
import socket, datetime&lt;br /&gt;
import pyping,sys&lt;br /&gt;
from colorama import init, Fore, Style&lt;br /&gt;
dat=open(dat_sys,&amp;quot;r&amp;quot;)&lt;br /&gt;
init()&lt;br /&gt;
def ping_status(name, hostname):&lt;br /&gt;
  r = pyping.ping(hostname, timeout=100, count=1)&lt;br /&gt;
  if r.ret_code == 0:&lt;br /&gt;
      print(Style.RESET_ALL + &amp;quot; ping status &amp;quot;  +  name + &amp;quot; &amp;quot; +  Fore.GREEN + &amp;quot;ok&amp;quot;)&lt;br /&gt;
  else:&lt;br /&gt;
     print(Style.RESET_ALL + &amp;quot; ping status &amp;quot;   + name + &amp;quot; &amp;quot; + Fore.RED + &amp;quot;failed&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
def port_status(name,hostname,port):&lt;br /&gt;
   socket.setdefaulttimeout(1)&lt;br /&gt;
   start_time = datetime.datetime.now()&lt;br /&gt;
   try:&lt;br /&gt;
     sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)&lt;br /&gt;
     connect = sock.connect_ex((hostname, int(port)))&lt;br /&gt;
     if connect == 0:&lt;br /&gt;
        print(Style.RESET_ALL + &amp;quot; port status &amp;quot;  +  name + &amp;quot; &amp;quot; +  Fore.GREEN + &amp;quot;ok&amp;quot;)&lt;br /&gt;
     else:&lt;br /&gt;
        print(Style.RESET_ALL + &amp;quot; port status hostname can't connect &amp;quot;  +  name + &amp;quot; &amp;quot; +  Fore.RED + &amp;quot;not ok&amp;quot;)&lt;br /&gt;
     sock.close()&lt;br /&gt;
   except socket.gaierror:&lt;br /&gt;
        print(Style.RESET_ALL + &amp;quot; port status hostname can't resolved &amp;quot;  +  name + &amp;quot; &amp;quot; +  Fore.RED + &amp;quot;not ok&amp;quot;)&lt;br /&gt;
   except socket.error:&lt;br /&gt;
        print(Style.RESET_ALL + &amp;quot; port status hostname can't connect &amp;quot;  +  name + &amp;quot; &amp;quot; +  Fore.RED + &amp;quot;not ok&amp;quot;)&lt;br /&gt;
   end_time = datetime.datetime.now()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def proxy_status(name,url,proxy,port):&lt;br /&gt;
    x = os.system(&amp;quot;env http_proxy=&amp;quot;+proxy+&amp;quot;:&amp;quot;+port + &amp;quot; &amp;quot; + &amp;quot; https_proxy=&amp;quot;+proxy+&amp;quot;:&amp;quot;+port + &amp;quot; &amp;quot;  +  &amp;quot;wget --spider --tries  3 -T 1 -q &amp;quot; + url)&lt;br /&gt;
    if x == 0:&lt;br /&gt;
       print(Style.RESET_ALL + &amp;quot; proxy status &amp;quot;  +  name + &amp;quot; &amp;quot; +  Fore.GREEN + &amp;quot;ok&amp;quot;)&lt;br /&gt;
    else:&lt;br /&gt;
       print(Style.RESET_ALL + &amp;quot; proxy status &amp;quot;  +  name + &amp;quot; &amp;quot; +  Fore.RED + &amp;quot;not ok&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
for l in dat:&lt;br /&gt;
    line = l.rstrip().split(&amp;quot;;&amp;quot;)&lt;br /&gt;
    if (len(line)) == 2:&lt;br /&gt;
        ping_status(line[0], line[1])&lt;br /&gt;
    if (len(line)) == 3:&lt;br /&gt;
        port_status(line[0], line[1], line[2])&lt;br /&gt;
    if (len(line)) == 4:&lt;br /&gt;
        proxy_status(line[0], line[1], line[2], line[3])&lt;br /&gt;
&lt;br /&gt;
dat.close()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Thomas.will</name></author>
	</entry>
</feed>