Exemple, hors cours, poste sur le forum

This commit is contained in:
Fred Z 2018-02-12 22:21:29 +01:00
parent bf2d5e50ca
commit 952d1c0269
1 changed files with 27 additions and 0 deletions

27
listlocalip.py Normal file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Author:
https://openclassrooms.com/forum/sujet/exercices-du-cours-python-postez-ici?page=25#message-92220709
"""
from os import system
import subprocess
print("$ AFIGO")
input("Check ENTREE for scan dhcp")
system("clear")
print("")
print("IP LIST")
print("------------------------------------------------------------")
print("")
for i in range(0, 255):
a = subprocess.getoutput("host 192.168.1."+str(i))
if a == (str(i)+".1.168.192.in-addr.arpa has no PTR record"):
pass
else:
print(a)
pass
print("")
print("------------------------------------------------------------")