本文整理汇总了Python中impacket.dcerpc.v5.dtypes.MAXIMUM_ALLOWED属性的典型用法代码示例。如果您正苦于以下问题:Python dtypes.MAXIMUM_ALLOWED属性的具体用法?Python dtypes.MAXIMUM_ALLOWED怎么用?Python dtypes.MAXIMUM_ALLOWED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类impacket.dcerpc.v5.dtypes
的用法示例。
在下文中一共展示了dtypes.MAXIMUM_ALLOWED属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: connect
# 需要导入模块: from impacket.dcerpc.v5 import dtypes [as 别名]
# 或者: from impacket.dcerpc.v5.dtypes import MAXIMUM_ALLOWED [as 别名]
def connect(self):
rpctransport = transport.DCERPCTransportFactory(self.stringBinding)
if len(self.hashes) > 0:
lmhash, nthash = self.hashes.split(':')
else:
lmhash = ''
nthash = ''
if hasattr(rpctransport, 'set_credentials'):
# This method exists only for selected protocol sequences.
rpctransport.set_credentials(self.username,self.password, self.domain, lmhash, nthash)
dce = rpctransport.get_dce_rpc()
#dce.set_auth_level(RPC_C_AUTHN_LEVEL_PKT_INTEGRITY)
dce.connect()
dce.bind(lsat.MSRPC_UUID_LSAT, transfer_syntax = self.ts)
request = lsat.LsarOpenPolicy2()
request['SystemName'] = NULL
request['ObjectAttributes']['RootDirectory'] = NULL
request['ObjectAttributes']['ObjectName'] = NULL
request['ObjectAttributes']['SecurityDescriptor'] = NULL
request['ObjectAttributes']['SecurityQualityOfService'] = NULL
request['DesiredAccess'] = MAXIMUM_ALLOWED | lsat.POLICY_LOOKUP_NAMES
resp = dce.request(request)
return dce, rpctransport, resp['PolicyHandle']
示例2: test_SamrOpenGroup
# 需要导入模块: from impacket.dcerpc.v5 import dtypes [as 别名]
# 或者: from impacket.dcerpc.v5.dtypes import MAXIMUM_ALLOWED [as 别名]
def test_SamrOpenGroup(self):
dce, rpctransport, domainHandle = self.connect()
request = samr.SamrConnect()
request['DesiredAccess'] = dtypes.MAXIMUM_ALLOWED
request['ServerName'] = u'BETO\x00'
resp = dce.request(request)
request = samr.SamrOpenGroup()
request['DomainHandle'] = domainHandle
request['DesiredAccess'] = dtypes.MAXIMUM_ALLOWED
request['GroupId'] = samr.DOMAIN_GROUP_RID_USERS
try:
resp = dce.request(request)
resp.dump()
except Exception, e:
if str(e).find('STATUS_NO_SUCH_DOMAIN') < 0:
raise
示例3: test_SamrEnumerateDomainsInSamServer
# 需要导入模块: from impacket.dcerpc.v5 import dtypes [as 别名]
# 或者: from impacket.dcerpc.v5.dtypes import MAXIMUM_ALLOWED [as 别名]
def test_SamrEnumerateDomainsInSamServer(self):
dce, rpctransport, domainHandle = self.connect()
request = samr.SamrConnect()
request['ServerName'] = u'BETO\x00'
request['DesiredAccess'] = samr.SAM_SERVER_ENUMERATE_DOMAINS | samr.SAM_SERVER_LOOKUP_DOMAIN
resp = dce.request(request)
request = samr.SamrEnumerateDomainsInSamServer()
request['ServerHandle'] = resp['ServerHandle']
request['EnumerationContext'] = 0
request['PreferedMaximumLength'] = 500
resp2 = dce.request(request)
resp2.dump()
request = samr.SamrLookupDomainInSamServer()
request['ServerHandle'] = resp['ServerHandle']
request['Name'] = resp2['Buffer']['Buffer'][0]['Name']
resp3 = dce.request(request)
resp3.dump()
request = samr.SamrOpenDomain()
request['ServerHandle'] = resp['ServerHandle']
request['DesiredAccess'] = dtypes.MAXIMUM_ALLOWED
request['DomainId'] = resp3['DomainId']
resp4 = dce.request(request)
resp4.dump()
示例4: test_SamrAddMemberToGroup_SamrRemoveMemberFromGroup
# 需要导入模块: from impacket.dcerpc.v5 import dtypes [as 别名]
# 或者: from impacket.dcerpc.v5.dtypes import MAXIMUM_ALLOWED [as 别名]
def test_SamrAddMemberToGroup_SamrRemoveMemberFromGroup(self):
dce, rpctransport, domainHandle = self.connect()
request = samr.SamrConnect()
request['DesiredAccess'] = dtypes.MAXIMUM_ALLOWED
request['ServerName'] = u'BETO\x00'
resp = dce.request(request)
request = samr.SamrOpenGroup()
request['DomainHandle'] = domainHandle
request['DesiredAccess'] = dtypes.MAXIMUM_ALLOWED
request['GroupId'] = samr.DOMAIN_GROUP_RID_USERS
try:
resp = dce.request(request)
resp.dump()
except Exception, e:
if str(e).find('STATUS_NO_SUCH_DOMAIN') < 0:
raise
示例5: test_SamrSetMemberAttributesOfGroup
# 需要导入模块: from impacket.dcerpc.v5 import dtypes [as 别名]
# 或者: from impacket.dcerpc.v5.dtypes import MAXIMUM_ALLOWED [as 别名]
def test_SamrSetMemberAttributesOfGroup(self):
dce, rpctransport, domainHandle = self.connect()
request = samr.SamrConnect()
request['DesiredAccess'] = dtypes.MAXIMUM_ALLOWED
request['ServerName'] = u'BETO\x00'
resp = dce.request(request)
request = samr.SamrOpenGroup()
request['DomainHandle'] = domainHandle
request['DesiredAccess'] = dtypes.MAXIMUM_ALLOWED
request['GroupId'] = samr.DOMAIN_GROUP_RID_USERS
resp = dce.request(request)
request = samr.SamrSetMemberAttributesOfGroup()
request['GroupHandle'] = resp['GroupHandle']
request['MemberId'] = samr.DOMAIN_USER_RID_ADMIN
request['Attributes'] = samr.SE_GROUP_ENABLED_BY_DEFAULT
resp = dce.request(request)
resp.dump()
示例6: connect
# 需要导入模块: from impacket.dcerpc.v5 import dtypes [as 别名]
# 或者: from impacket.dcerpc.v5.dtypes import MAXIMUM_ALLOWED [as 别名]
def connect(self):
rpctransport = transport.DCERPCTransportFactory(self.stringBinding)
if len(self.hashes) > 0:
lmhash, nthash = self.hashes.split(':')
else:
lmhash = ''
nthash = ''
if hasattr(rpctransport, 'set_credentials'):
# This method exists only for selected protocol sequences.
rpctransport.set_credentials(self.username,self.password, self.domain, lmhash, nthash)
dce = rpctransport.get_dce_rpc()
#dce.set_auth_level(RPC_C_AUTHN_LEVEL_PKT_INTEGRITY)
dce.connect()
dce.bind(rrp.MSRPC_UUID_RRP, transfer_syntax = self.ts)
resp = rrp.hOpenLocalMachine(dce, MAXIMUM_ALLOWED | rrp.KEY_WOW64_32KEY | rrp.KEY_ENUMERATE_SUB_KEYS)
return dce, rpctransport, resp['phKey']
示例7: test_BaseRegEnumKey
# 需要导入模块: from impacket.dcerpc.v5 import dtypes [as 别名]
# 或者: from impacket.dcerpc.v5.dtypes import MAXIMUM_ALLOWED [as 别名]
def test_BaseRegEnumKey(self):
dce, rpctransport, phKey = self.connect()
request = rrp.BaseRegOpenKey()
request['hKey'] = phKey
request['lpSubKey'] = 'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\x00'
request['dwOptions'] = 0x00000001
request['samDesired'] = MAXIMUM_ALLOWED | rrp.KEY_ENUMERATE_SUB_KEYS
resp = dce.request(request)
request = rrp.BaseRegEnumKey()
request['hKey'] = resp['phkResult']
request['dwIndex'] = 1
# I gotta access the fields mannually :s
request.fields['lpNameIn'].fields['MaximumLength'] = 510
request.fields['lpNameIn'].fields['Data'].fields['Data'].fields['MaximumCount'] = 255
request['lpClassIn'] = ' '*100
request['lpftLastWriteTime'] = NULL
resp = dce.request(request)
resp.dump()
示例8: test_BaseRegEnumValue
# 需要导入模块: from impacket.dcerpc.v5 import dtypes [as 别名]
# 或者: from impacket.dcerpc.v5.dtypes import MAXIMUM_ALLOWED [as 别名]
def test_BaseRegEnumValue(self):
dce, rpctransport, phKey = self.connect()
request = rrp.BaseRegOpenKey()
request['hKey'] = phKey
request['lpSubKey'] = 'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\x00'
request['dwOptions'] = 0x00000001
request['samDesired'] = MAXIMUM_ALLOWED
resp = dce.request(request)
request = rrp.BaseRegEnumValue()
request['hKey'] = resp['phkResult']
request['dwIndex'] = 6
request['lpValueNameIn'] = ' '*100
request['lpData'] = ' '*100
request['lpcbData'] = 100
request['lpcbLen'] = 100
resp = dce.request(request)
resp.dump()
示例9: test_BaseRegQueryValue
# 需要导入模块: from impacket.dcerpc.v5 import dtypes [as 别名]
# 或者: from impacket.dcerpc.v5.dtypes import MAXIMUM_ALLOWED [as 别名]
def test_BaseRegQueryValue(self):
dce, rpctransport, phKey = self.connect()
request = rrp.BaseRegOpenKey()
request['hKey'] = phKey
request['lpSubKey'] = 'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\x00'
request['dwOptions'] = 0x00000001
request['samDesired'] = MAXIMUM_ALLOWED
resp = dce.request(request)
resp.dump()
request = rrp.BaseRegQueryValue()
request['hKey'] = resp['phkResult']
request['lpValueName'] = 'ProductName\x00'
request['lpData'] = ' '*100
request['lpcbData'] = 100
request['lpcbLen'] = 100
resp = dce.request(request)
resp.dump()
示例10: test_BaseRegSaveKey
# 需要导入模块: from impacket.dcerpc.v5 import dtypes [as 别名]
# 或者: from impacket.dcerpc.v5.dtypes import MAXIMUM_ALLOWED [as 别名]
def test_BaseRegSaveKey(self):
dce, rpctransport, phKey = self.connect()
request = rrp.OpenCurrentUser()
request['ServerName'] = NULL
request['samDesired'] = MAXIMUM_ALLOWED
resp = dce.request(request)
resp.dump()
request = rrp.BaseRegSaveKey()
request['hKey'] = resp['phKey']
request['lpFile'] = 'BETUSFILE2\x00'
request['pSecurityAttributes'] = NULL
resp = dce.request(request)
resp.dump()
# I gotta remove the file now :s
smb = rpctransport.get_smb_connection()
smb.deleteFile('ADMIN$', 'System32\\BETUSFILE2')
示例11: test_LsarOpenAccount
# 需要导入模块: from impacket.dcerpc.v5 import dtypes [as 别名]
# 或者: from impacket.dcerpc.v5.dtypes import MAXIMUM_ALLOWED [as 别名]
def test_LsarOpenAccount(self):
dce, rpctransport, policyHandle = self.connect()
request = lsad.LsarEnumerateAccounts()
request['PolicyHandle'] = policyHandle
request['PreferedMaximumLength'] = 0xffffffff
resp = dce.request(request)
resp.dump()
request = lsad.LsarOpenAccount()
request['PolicyHandle'] = policyHandle
request['AccountSid'] = resp['EnumerationBuffer']['Information'][0]['Sid']
request['DesiredAccess'] = MAXIMUM_ALLOWED
resp = dce.request(request)
resp.dump()
request = lsad.LsarClose()
request['ObjectHandle'] = resp['AccountHandle']
resp = dce.request(request)
resp.dump()
示例12: test_LsarCreateAccount_LsarDeleteObject
# 需要导入模块: from impacket.dcerpc.v5 import dtypes [as 别名]
# 或者: from impacket.dcerpc.v5.dtypes import MAXIMUM_ALLOWED [as 别名]
def test_LsarCreateAccount_LsarDeleteObject(self):
dce, rpctransport, policyHandle = self.connect()
request = lsad.LsarQueryInformationPolicy2()
request['PolicyHandle'] = policyHandle
request['InformationClass'] = lsad.POLICY_INFORMATION_CLASS.PolicyAccountDomainInformation
resp = dce.request(request)
sid = resp['PolicyInformation']['PolicyAccountDomainInfo']['DomainSid'].formatCanonical()
sid = sid + '-9999'
request = lsad.LsarCreateAccount()
request['PolicyHandle'] = policyHandle
request['AccountSid'].fromCanonical(sid)
request['DesiredAccess'] = MAXIMUM_ALLOWED
resp = dce.request(request)
resp.dump()
request = lsad.LsarDeleteObject()
request['ObjectHandle'] = resp['AccountHandle']
resp = dce.request(request)
resp.dump()
示例13: test_LsarGetSystemAccessAccount_LsarSetSystemAccessAccount
# 需要导入模块: from impacket.dcerpc.v5 import dtypes [as 别名]
# 或者: from impacket.dcerpc.v5.dtypes import MAXIMUM_ALLOWED [as 别名]
def test_LsarGetSystemAccessAccount_LsarSetSystemAccessAccount(self):
dce, rpctransport, policyHandle = self.connect()
sid = 'S-1-5-32-544'
request = lsad.LsarOpenAccount()
request['PolicyHandle'] = policyHandle
request['AccountSid'].fromCanonical(sid)
request['DesiredAccess'] = MAXIMUM_ALLOWED
resp = dce.request(request)
resp.dump()
request = lsad.LsarGetSystemAccessAccount()
request['AccountHandle'] = resp['AccountHandle']
resp2 = dce.request(request)
resp.dump()
request = lsad.LsarSetSystemAccessAccount()
request['AccountHandle'] = resp['AccountHandle']
request['SystemAccess'] = resp2['SystemAccess']
resp = dce.request(request)
resp.dump()
示例14: test_LsarQuerySecret
# 需要导入模块: from impacket.dcerpc.v5 import dtypes [as 别名]
# 或者: from impacket.dcerpc.v5.dtypes import MAXIMUM_ALLOWED [as 别名]
def test_LsarQuerySecret(self):
dce, rpctransport, policyHandle = self.connect()
request = lsad.LsarOpenSecret()
request['PolicyHandle'] = policyHandle
request['SecretName'] = 'DPAPI_SYSTEM'
request['DesiredAccess'] = MAXIMUM_ALLOWED
resp0 = dce.request(request)
resp0.dump()
request = lsad.LsarQuerySecret()
request['SecretHandle'] = resp0['SecretHandle']
request['EncryptedCurrentValue']['Buffer'] = NULL
request['EncryptedOldValue']['Buffer'] = NULL
request['OldValueSetTime'] = NULL
resp = dce.request(request)
resp.dump()
示例15: test_SamrConnect5
# 需要导入模块: from impacket.dcerpc.v5 import dtypes [as 别名]
# 或者: from impacket.dcerpc.v5.dtypes import MAXIMUM_ALLOWED [as 别名]
def test_SamrConnect5(self):
dce, rpctransport, domainHandle = self.connect()
request = samr.SamrConnect5()
request['ServerName'] = u'BETO\x00'
request['DesiredAccess'] = dtypes.MAXIMUM_ALLOWED
request['InVersion'] = 1
request['InRevisionInfo']['tag'] = 1
resp = dce.request(request)
resp.dump()