-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdnsmask_wrapper.py
40 lines (29 loc) · 1.04 KB
/
dnsmask_wrapper.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/python
import sys
from sys import argv as arguments
import subprocess
from netaddr import *
operation = arguments[1]
mac = EUI(arguments[2])
oui = mac.oui
vendor = oui.registration().org
ip = arguments[3]
try:
hostname = arguments[4]
except IndexError:
hostname = "Unknown"
posture="Healthy"
domain="global"
role="DHCP-Allocated"
user=hostname
type="Unknown"
os="Unknown"
version="Unknown"
model="Unknown"
hostname=user
if operation == "add":
subprocess.call([sys.executable, '/var/tmp/User-Logon.py', '-o','logon','-a',ip,'-d',domain,'-r',role,'-u',user,'-p',posture,'--vendor',vendor,'-t',type,'--os',os,'--version',version,'--model',model,'--hostname',hostname])
if operation == "del":
subprocess.call([sys.executable, '/var/tmp/User-Logon.py', '-o','logoff','-a',ip,'-u',user])
if operation == "old":
subprocess.call([sys.executable, '/var/tmp/User-Logon.py', '-o','logon','-a',ip,'-d',domain,'-r',role,'-u',user,'-p',posture,'--vendor',vendor,'-t',type,'--os',os,'--version',version,'--model',model,'--hostname',hostname])