During penetration testing, sometimes you encounter a scenario where your client is using some kind of an internal server that is not accessible through the internet. And just because of this they think it's secure. In this section, we will see how we can integrate a simple port scanner with our script to prevent a possible attack.
Usually, once you get into your target machine, you start looking for other possible targets. For example, if we were able to access machine A, then we can extend our attack and scan machine B to see what ports and services are running on that machine. The other usages are to make the target scan an online server on our behalf to hide our activities. Now, let's get to the coding ...