Skip to content
Snippets Groups Projects
Commit 92abd32c authored by developer7's avatar developer7
Browse files

ver 4.0.3.5

GetHandler()->do_POST:add subprocess check_out method for display full hostname IP address where platform is linux;
parent 1516f785
No related merge requests found
...@@ -142,13 +142,19 @@ class GetHandler(BaseHTTPRequestHandler): ...@@ -142,13 +142,19 @@ class GetHandler(BaseHTTPRequestHandler):
if f == 'IP': if f == 'IP':
from socket import gethostname, gethostbyname from socket import gethostname, gethostbyname
from uuid import getnode from uuid import getnode
ip = gethostbyname(gethostname())
mac = getnode() mac = getnode()
macAddress = ':'.join(("%012X" % mac)[i:i+2] for i in range(0, 12, 2)) lIP = ''
ipMac = "IP address : %s\nMAC address : %s\n" % (ip, macAddress) macAddress = ':'.join(("%012X" % mac)[i:i+2] for i in range(0, 12, 2))
if sys.platform.startswith('linux'):
from subprocess import check_output
lIP = check_output(['hostname ', '--all-ip-address'])
ip = gethostbyname(gethostname())
ipMac = "IP address : %s : %s\nMAC address : %s\n" % (ip,lIP, macAddress)
self.wfile.write(ipMac) self.wfile.write(ipMac)
if f == 'U': if f == 'U':
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment