Added testcase for Nmap, refactored Nmap a bit for better testability