displays hostnames

This commit is contained in:
R3DDY97 2017-07-19 07:53:24 +05:30 committed by GitHub
parent 644bd81473
commit 14cb61370c

View File

@ -11,7 +11,7 @@ See License at nikolaskama.me (https://nikolaskama.me/kickthemoutproject)
import time, os, sys, logging, math import time, os, sys, logging, math
from time import sleep from time import sleep
import urllib2 as urllib import urllib2 as urllib
import traceback import traceback, socket
BLUE, RED, WHITE, YELLOW, MAGENTA, GREEN, END = '\33[94m', '\033[91m', '\33[97m', '\33[93m', '\033[1;35m', '\033[1;32m', '\033[0m' BLUE, RED, WHITE, YELLOW, MAGENTA, GREEN, END = '\33[94m', '\033[91m', '\33[97m', '\33[93m', '\033[1;35m', '\033[1;32m', '\033[0m'
notRoot = False notRoot = False
@ -163,8 +163,9 @@ def kickoneoff():
for host in hostsList: for host in hostsList:
if host[0] == onlineIPs[i]: if host[0] == onlineIPs[i]:
mac = host[1] mac = host[1]
hostname = socket.gethostbyaddr(onlineIPs[i])[0]
vendor = resolveMac(mac) vendor = resolveMac(mac)
print(" [{0}" + str(i) + "{1}] {2}" + str(onlineIPs[i]) + "{3}\t"+ vendor + "{4}").format(YELLOW, WHITE, RED, GREEN, END) print(" [{0}" + str(i) + "{1}] {2}" + str(onlineIPs[i]) + "{3}\t"+ vendor + " (" + hostname + ")""{4}").format(YELLOW, WHITE, RED, GREEN, END)
canBreak = False canBreak = False
while not canBreak: while not canBreak:
@ -227,8 +228,9 @@ def kicksomeoff():
for host in hostsList: for host in hostsList:
if host[0] == onlineIPs[i]: if host[0] == onlineIPs[i]:
mac = host[1] mac = host[1]
hostname = socket.gethostbyaddr(onlineIPs[i])[0]
vendor = resolveMac(mac) vendor = resolveMac(mac)
print(" [{0}" + str(i) + "{1}] {2}" + str(onlineIPs[i]) + "{3}\t" + vendor + "{4}").format(YELLOW, WHITE, RED, GREEN, END) print(" [{0}" + str(i) + "{1}] {2}" + str(onlineIPs[i]) + "{3}\t" + vendor + " (" + hostname + ")" "{4}").format(YELLOW, WHITE, RED, GREEN, END)
canBreak = False canBreak = False
while not canBreak: while not canBreak: