Help me automatize network discovery and scan hosts

Hi,

I created a c++ rootkit, and I want to create a new file ( that can be a .exe or .dll file), that can be capable to scan every host on the network (like nmap do) and know the http traffic of those target (like wireshark do).

Anyone can know a solution to this?