rapid7/metasploit-framework — pull request #4102 by jhart-r7 (2014-10-29 22:26:47+00:00)
Title: Use correct destination port for NBNS spoofer

When working on something unrelated, I was looking at this module to see how spoofing is done. While testing it, I noticed that the destination port in the replies is hardcoded to 137. In e89dcc5ab0a5cb8e56922bc81a61c688d79cef54, this was changed from 1337, which was even more wrong. 137 is only correct for systems that use this as their source port when sending the NBNS queries, which AFAIK is just Windows. Samba (nmblookup), for example, does not use this port. I've changed it to use the source port of the request.

# Validation
- [ ] Run nbns_response
- [ ] Validate that queries from Windows system are properly intercepted and the responses are correct
- [ ] Validate that queries from non-Windows system (nmblookup) are properly intercepted and the responses are correct