There are solutions available, but from your other post it seems you don't want to use them, for some reason.
Don't expect the people here to create this script for you. This is a very complicated task that will take a long time to develop and test.
Let's say I did provide you with a solution... Wouldn't that be a "third-party solution" as well?
These tools are not compiled, you know. You have direct access to their source-code and can make sure they don't do anything else beside what they're supposed to do.