Show
Ignore:
Timestamp:
02/11/10 20:26:40 (7 months ago)
Author:
nopper
Message:

Refreshing scapy patches

Files:
1 moved

Legend:

Unmodified
Added
Removed
  • pm/trunk/deps/scapy-patches/smb.patch

    r5507 r5525  
    11diff -r 7a211173d33f scapy/fields.py 
    22--- a/scapy/fields.py   Mon Jan 11 17:59:00 2010 +0100 
    3 +++ b/scapy/fields.py   Fri Jan 29 13:54:42 2010 +0100 
     3+++ b/scapy/fields.py   Thu Feb 11 15:02:28 2010 +0100 
    44@@ -271,7 +271,7 @@ 
    55  
     
    6060diff -r 7a211173d33f scapy/layers/netbios.py 
    6161--- a/scapy/layers/netbios.py   Mon Jan 11 17:59:00 2010 +0100 
    62 +++ b/scapy/layers/netbios.py   Fri Jan 29 13:54:42 2010 +0100 
     62+++ b/scapy/layers/netbios.py   Thu Feb 11 15:02:28 2010 +0100 
    6363@@ -199,8 +199,22 @@ 
    6464 class NBTSession(Packet): 
     
    9595diff -r 7a211173d33f scapy/layers/smb.py 
    9696--- a/scapy/layers/smb.py       Mon Jan 11 17:59:00 2010 +0100 
    97 +++ b/scapy/layers/smb.py       Fri Jan 29 13:54:42 2010 +0100 
    98 @@ -7,6 +7,245 @@ 
     97+++ b/scapy/layers/smb.py       Thu Feb 11 15:02:28 2010 +0100 
     98@@ -7,6 +7,280 @@ 
    9999 from scapy.fields import * 
    100100 from scapy.layers.netbios import NBTSession 
     
    125125+    def guess_payload_class(self, payload): 
    126126+        index = self.Flags & 128 != 0 and 1 or 0 
    127 +        secure = self.Flags2 & 2048 != 0 and 1 or 0 
    128127+        protos = BINDER.get(self.Command, None) 
    129128+ 
    130129+        if isinstance(protos, tuple): 
    131 +            if isinstance(protos[index], tuple): 
    132 +                return protos[index][secure] 
    133 +            return protos[index] 
     130+            proto = protos[index].get(ord(payload[0])) 
     131+ 
     132+            if proto: 
     133+                return proto 
     134+ 
     135+        if self.Command == 0x72 and payload[0] == '\x11' and len(payload) > 23: 
     136+            if ord(payload[23]) & 128: # SERVER_CAP_EXTENDED_SECURITY 
     137+                return SMBNegociate_Response_Advanced_Security 
     138+            else: 
     139+                return SMBNegociate_Response 
    134140+ 
    135141+        return Packet.guess_payload_class(self, payload) 
     
    204210+                 NBTStrField("NativeOS","Windows 4.0"), 
    205211+                 NBTStrField("NativeLanManager","Windows 4.0"), 
    206 +                 StrLenField("ExtraBytes", "", length_from=lambda x:(x.ByteCount - x.ANSIPasswordLength - x.UnicodePasswordLength - (len(x.Account) + len(x.PrimaryDomain) + len(x.NativeOS) + len(x.NativeLanManager) + 4) * 2 + 1) / 2)] 
     212+                 #StrLenField("ExtraBytes", "", length_from=lambda x:(x.ByteCount - x.ANSIPasswordLength - x.UnicodePasswordLength - (len(x.Account) + len(x.PrimaryDomain) + len(x.NativeOS) + len(x.NativeLanManager) + 4) * 2 + 1) / 2)] 
     213+                 StrLenField("ExtraBytes", "", length_from=lambda x:(x.ByteCount - x.ANSIPasswordLength - x.UnicodePasswordLength - (len(x.Account) + len(x.PrimaryDomain) + len(x.NativeOS) + len(x.NativeLanManager) + 4) * 2) & ~1)] 
    207214+ 
    208215+    def guess_payload_class(self, payload): 
    209216+        protos = BINDER.get(self.AndXCommand, None) 
    210 +        if protos: 
    211 +            return protos[0] 
     217+ 
     218+        if isinstance(protos, tuple): 
     219+            proto = protos[0].get(ord(payload[0])) 
     220+ 
     221+            if proto: 
     222+                return proto 
     223+ 
    212224+        return Packet.guess_payload_class(self, payload) 
    213225+ 
     
    217229+                   ByteEnumField("AndXCommand",0x75,{0x75:"SMB_COM_TREE_CONNECT_ANDX"}), 
    218230+                   ByteField("Reserved",0), 
    219 +                   ShortField("AndXOffset",0), 
    220 +                   ByteField("Action",0), 
    221 +                   ShortField("SecurityBlobLength",0), 
    222 +                   ShortField("ByteCount",0), 
     231+                   LEShortField("AndXOffset",0), 
     232+                   LEShortField("Action",0), 
     233+                   LEShortField("SecurityBlobLength",0), 
     234+                   LEShortField("ByteCount",0), 
    223235+                   StrLenField("SecurityBlob", "", length_from=lambda x:x.SecurityBlobLength), 
    224236+                   NBTStrField("NativeOS","Windows 4.0"), 
    225237+                   NBTStrField("NativeLanManager","Windows 4.0")] 
    226238+ 
    227 +BINDER[0x73] = (SMBSetup_AndX_Request, (SMBSetup_AndX_Response, SMBSetup_AndX_Response_Advanced_Security)) 
     239+class SMBSetup_AndX_Request_Advanced_Security(Packet): 
     240+    name="SMBNegociate Protocol Response Advanced Security" 
     241+    fields_desc = [ByteField("WordCount",12), 
     242+                   ByteEnumField("AndXCommand",0x75,{0x75:"SMB_COM_TREE_CONNECT_ANDX"}), 
     243+                   ByteField("Reserved",0), 
     244+                   LEShortField("AndXOffset",0), 
     245+                   LEShortField("MaxBuffer",2920), 
     246+                   LEShortField("MaxMPXCount",50), 
     247+                   LEShortField("VCNumber",0), 
     248+                   LEIntField("SessionKey",0x0000), 
     249+                   LEShortField("SecurityBlobLength",0), 
     250+                   LEIntField("Reserved2", 0), 
     251+                   LEIntField("Capabilities", 0), 
     252+                   LEShortField("ByteCount",0), 
     253+                   StrLenField("SecurityBlob", "", length_from=lambda x:x.SecurityBlobLength), 
     254+                   NBTStrField("NativeOS","Windows 4.0"), 
     255+                   NBTStrField("NativeLanManager","Windows 4.0"), 
     256+                   NBTStrField("PrimaryDomain", "")] 
     257+ 
     258+BINDER[0x73] = ({13 : SMBSetup_AndX_Request, 
     259+                 12 : SMBSetup_AndX_Request_Advanced_Security}, 
     260+                { 0 : SMBSetup_AndX_Response, 
     261+                  4 : SMBSetup_AndX_Response_Advanced_Security}) 
    228262+ 
    229263+################################################################################ 
     
    246280+                 LEShortField("ByteCount",0)] 
    247281+ 
    248 +BINDER[0x80] = (SMBQueryInformationDisk_Request, SMBQueryInformationDisk_Response) 
     282+BINDER[0x80] = ({0 : SMBQueryInformationDisk_Request}, {5 : SMBQueryInformationDisk_Response}) 
    249283+ 
    250284+################################################################################ 
     
    276310+                 NBTStrField("NativeFileSystem","")] 
    277311+ 
    278 +BINDER[0x75] = (SMBTree_Connect_AndX_Request, SMBTree_Connect_AndX_Response) 
     312+BINDER[0x75] = ({4 : SMBTree_Connect_AndX_Request}, {3 : SMBTree_Connect_AndX_Response}) 
    279313+ 
    280314+################################################################################ 
     
    334368+                   StrLenField("SecurityBlob", "", length_from=lambda x:x.ByteCount+16)] 
    335369+ 
    336 +BINDER[0x72] = (SMBDialect, (SMBNegociate_Response, SMBNegociate_Response_Advanced_Security)) 
     370+BINDER[0x72] = ({0 : SMBDialect}, {}) 
     371+                #{17 : SMBNegociate_Response}) 
    337372+ 
    338373+################################################################################## 
     
    342377 # SMB NetLogon Response Header 
    343378 class SMBNetlogon_Protocol_Response_Header(Packet): 
    344 @@ -106,32 +345,6 @@ 
     379@@ -106,32 +380,6 @@ 
    345380                    StrNullField("ServerName","WIN"), 
    346381                    LEShortField("LM20Token", 0xffff)] 
     
    375410 class SMBNegociate_Protocol_Response_Advanced_Security(Packet): 
    376411     name="SMBNegociate Protocol Response Advanced Security" 
    377 @@ -211,8 +424,8 @@ 
     412@@ -211,8 +459,8 @@ 
    378413                    ByteField("EncryptionKeyLength",8), 
    379414                    LEShortField("ByteCount",24), 
     
    386421 # SMBNegociate Protocol Response No Security No Key 
    387422 class SMBNegociate_Protocol_Response_No_Security_No_Key(Packet): 
    388 @@ -290,10 +503,11 @@ 
     423@@ -290,10 +538,11 @@ 
    389424                  BitField("Reserved5",0,5), 
    390425                  LEShortField("ByteCount",35), 
     
    402437                  ByteEnumField("AndXCommand2",0xFF,{0xFF:"SMB_COM_NONE"}), 
    403438                  ByteField("Reserved6",0), 
    404 @@ -302,7 +516,7 @@ 
     439@@ -302,7 +551,7 @@ 
    405440                  LEShortField("PasswordLength",0x1), 
    406441                  LEShortField("ByteCount2",18), 
     
    411446  
    412447 # Session Setup AndX Response 
    413 @@ -328,9 +542,9 @@ 
     448@@ -328,9 +577,9 @@ 
    414449                  LEShortField("AndXOffset",66), 
    415450                  LEShortField("Action",0), 
     
    424459                  ByteEnumField("AndXCommand2",0xFF,{0xFF:"SMB_COM_NONE"}), 
    425460                  ByteField("Reserved3",0), 
    426 @@ -340,11 +554,3 @@ 
     461@@ -340,11 +589,3 @@ 
    427462                  StrNullField("Service","IPC"), 
    428463                  StrNullField("NativeFileSystem","")]