shadowbrokers-exploits/windows/Resources/Ops/PyScripts/lib/ops/networking/ifconfig.py
2017-04-14 11:45:07 +02:00

18 lines
No EOL
651 B
Python

import datetime
import ops.cmd
import ops
import ops.db
import ops.project
IFCONFIG_TAG = 'OPS_IFCONFIG_DATA'
MAX_CACHE_SIZE = 5
def get_ifconfig(maxage=datetime.timedelta(seconds=0), targetID=None):
status_cmd = ops.cmd.getDszCommand('ifconfig')
return ops.project.generic_cache_get(status_cmd, cache_tag=IFCONFIG_TAG, cache_size=MAX_CACHE_SIZE, maxage=maxage, targetID=targetID)
def get_interfaces(maxage=datetime.timedelta(0), targetID=None):
if (targetID is None):
targetID = ops.project.getTargetID()
ifconfig_data = get_ifconfig(maxage=maxage, targetID=targetID)
return ifconfig_data.interfaceitem