m = re.sub('^0x|L$', '', mac)
return '{:0>12}'.format(m)
-
-def get_users():
- out = check_output("/bin/ls /home", shell=True).strip()
- out = out.strip().split()
- return " ".join(out)
+def get_hostname():
+ return check_output("/bin/hostname", shell=True).strip();
def exec_ssh(port):
if port == None:
else:
raise Exception ('run ssh failed')
if payload['command'] == 'list':
- response = {'from': userdata['id'], 'type':'response', 'command':payload['command'], 'data': get_users()}
+ response = {'from': userdata['id'], 'type':'response', 'command':payload['command'], 'data': get_hostname()}
client.publish(payload['from'], str(response))