mirror of
https://github.com/trustedsec/social-engineer-toolkit
synced 2024-11-22 04:23:06 +00:00
Bitwise AND should be with decimal 31 to also compare QR flag.
The original version of pyminifakedns ignored the value of the Query/Response Flag ("QR flag"), which is the bit immediately prior to the DNS opcode field. The value of the QR flag should be checked for the value 0 along with the opcode bits, which should also be zero.
This commit is contained in:
parent
bee1a38d05
commit
ec37d317c9
1 changed files with 3 additions and 3 deletions
|
@ -96,15 +96,15 @@ class DNSQuery:
|
|||
# 000 0 0000
|
||||
#
|
||||
# To test for this reliably, we do a bitwise AND with a value
|
||||
# of decimal 15, which is 1111 in binary, exactly four bits:
|
||||
# of decimal 31, which is 11111 in binary, exactly five bits:
|
||||
#
|
||||
# 00000000 (Remember, 0 AND 1 equals 0.)
|
||||
# AND 00001111
|
||||
# AND 00011111
|
||||
# ------------
|
||||
# 00000000 = decimal 0
|
||||
#
|
||||
# In one line of Python code, we get the following:
|
||||
kind = (flags[0] >> 3) & 15 # Opcode is in bits 4, 5, 6, and 7 of first byte.
|
||||
kind = (flags[0] >> 3) & 31 # Opcode is in bits 4, 5, 6, and 7 of first byte.
|
||||
# QR bit is 8th bit, but it should be 0.
|
||||
# And now, we test to see if the result
|
||||
if 0 == kind: # was a standard query.
|
||||
|
|
Loading…
Reference in a new issue