Commit 47345f07 authored by Robert David Graham's avatar Robert David Graham
Browse files

SMBv2

parent b72e8ab6
Loading
Loading
Loading
Loading
+9 −18
Changes for src/proto-banout.c: 9 added lines, 18 removed lines.
Original line number Diff line number Diff line
@@ -203,36 +203,27 @@ banout_append_unicode(struct BannerOutput *banout, unsigned proto, unsigned c)
    if (c & ~0xFFFF) {
        unsigned c2;
        c2 = 0xF0 | ((c>>18)&0x03);
        banout_append(banout, proto, "\\x", 2);
        banout_append_hexint(banout, proto, c2, 2);
        banout_append_char(banout, proto, c2);
        c2 = 0x80 | ((c>>12)&0x3F);
        banout_append(banout, proto, "\\x", 2);
        banout_append_hexint(banout, proto, c2, 2);
        banout_append_char(banout, proto, c2);
        c2 = 0x80 | ((c>> 6)&0x3F);
        banout_append(banout, proto, "\\x", 2);
        banout_append_hexint(banout, proto, c2, 2);
        banout_append_char(banout, proto, c2);
        c2 = 0x80 | ((c>> 0)&0x3F);
        banout_append(banout, proto, "\\x", 2);
        banout_append_hexint(banout, proto, c2, 2);
        banout_append_char(banout, proto, c2);
    } else if (c & ~0x7FF) {
        unsigned c2;
        c2 = 0xE0 | ((c>>12)&0x0F);
        banout_append(banout, proto, "\\x", 2);
        banout_append_hexint(banout, proto, c2, 2);
        banout_append_char(banout, proto, c2);
        c2 = 0x80 | ((c>> 6)&0x3F);
        banout_append(banout, proto, "\\x", 2);
        banout_append_hexint(banout, proto, c2, 2);
        banout_append_char(banout, proto, c2);
        c2 = 0x80 | ((c>> 0)&0x3F);
        banout_append(banout, proto, "\\x", 2);
        banout_append_hexint(banout, proto, c2, 2);
        banout_append_char(banout, proto, c2);
    } else if (c & ~0x7f) {
        unsigned c2;
        c2 = 0xc0 | ((c>> 6)&0x1F);
        banout_append(banout, proto, "\\x", 2);
        banout_append_hexint(banout, proto, c2, 2);
        banout_append_char(banout, proto, c2);
        c2 = 0x80 | ((c>> 0)&0x3F);
        banout_append(banout, proto, "\\x", 2);
        banout_append_hexint(banout, proto, c2, 2);
        banout_append_char(banout, proto, c2);
    } else
        banout_append_char(banout, proto, c);
}
+1
Changes for src/proto-ntlmssp.c: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -174,6 +174,7 @@ ntlmssp_decode(struct NtlmsspDecode *x,
                  px[50] | px[51]<<8,
                  px[55]
                  );
        banout_append(banout, PROTO_SMB, buf, AUTO_LEN);
    }

    /* Parse all the fields */
+5 −5
Changes for src/proto-smb.c: 5 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -200,7 +200,6 @@ smb_params_parse(struct SMBSTUFF *smb, const unsigned char *px, size_t offset, s
    if (max > offset + (smb->hdr.smb1.param_length - smb->hdr.smb1.param_offset))
        max = offset + (smb->hdr.smb1.param_length - smb->hdr.smb1.param_offset);
    
    //printf("\n max=%04x  \n", *(unsigned short*)(px+max));
    
    /* Find the correct header */
    for (c=0; params[c].command != smb->hdr.smb1.command && params[c].command != 0xFF; c++)
@@ -419,7 +418,7 @@ smb1_parse_setup1(struct SMBSTUFF *smb, const unsigned char *px, size_t offset,
        max = offset + (smb->hdr.smb1.byte_count - smb->hdr.smb1.byte_offset);
    
    for (;offset<max; offset++) {
        //printf("\\x%02x", px[offset]);
        
        switch (state) {
            case D_PADDING:
                if (smb->hdr.smb1.flags2 & 0x8000) {
@@ -596,11 +595,11 @@ smb1_parse_setup2(struct SMBSTUFF *smb, const unsigned char *px, size_t offset,
        max = offset + (smb->hdr.smb1.byte_count - smb->hdr.smb1.byte_offset);
    
    for (;offset<max; offset++) {
        //printf("\\x%02x", px[offset]);
        
        switch (state) {
            case D_BLOB:
                if (smb->parms.setup.BlobOffset == 0) {
                    spnego_decode_init(&smb->spnego, smb->hdr.smb2.blob_length);
                    spnego_decode_init(&smb->spnego, smb->parms.setup.BlobLength);
                }
            {
                size_t new_max = max;
@@ -619,7 +618,7 @@ smb1_parse_setup2(struct SMBSTUFF *smb, const unsigned char *px, size_t offset,
            case D_PADDING:
                /* If the blog length is odd, then there is no padding. Otherwise,
                 * there is one byte of padding */
                if (smb->parms.setup.BlobLength & 1)
                //if (smb->parms.setup.BlobLength & 1)
                    offset--;
                state = D_PADDING2;
                break;
@@ -629,6 +628,7 @@ smb1_parse_setup2(struct SMBSTUFF *smb, const unsigned char *px, size_t offset,
                } else {
                    state = D_OSA1;
                }
                offset--;
                break;
            case D_OSA1:
                if (px[offset] == 0)
+1
Changes for src/proto-x509.c: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -1357,6 +1357,7 @@ spnego_decode(struct SpnegoDecode *spnego,
                 * ready to parse the 'value'. Push the current state on the
                 * stack, then decend into the child field.
                 */
                printf("\n%u\n", x->u.tag.remaining);
                ASN1_push(x, x->brother_state, x->u.tag.remaining);
                state = x->child_state;
                memset(&x->u, 0, sizeof(x->u));