Actually I don't have a script handy but killing these malicious processes won't do anything to solve you problem that you have these in the first place... I guess you are a webhost and these are miners that running on your VPS?
What you could do is instead of killing them to "starve them to death" using cgroups.
You'll have CPU and Network accounting there and a tool called
cgclassify. You can build flexible hierarchies. There is some good documentation for CentOS/RHEL here.
I'm not an expert on the details but I'll think it's possible in this way:
You create cgroups for CPU/Memory/Network and classify the processes according to used shares using cgclassify or the mentionend daemon. That means the daemons take care of of supervising ressource usage and you can move e.g. processes that use the network and a certain amount of CPU shares into a cgroup that severely limits CPU and Network access or outright kills the process (e.g. due to low memory).
Here is a presention with some details.
The problem with killing these processes every 15 minutes is that these are likely be respawned instantly and that they hog your complete resources in these 15 minutes.
With cgroups you can classify certain safe binaries (e.g. PHP, Apache) and limit all other processes... so using CPU/Network will not impact the server and it's soo slow that it's not worthwhile for the users to run these tasks.. It's also possible to shape the CPU shares in such a way that the process will get slower the more CPU it's using. The same for Network bandwidth.. you can limit e.g. all processes for each user to only use 1Mbit for outgoing network connections or even less.
You can also just use the accounting data from the cgroups to kill the processes.
Doing this "on the fly" looks like another problem but if the problem is persistent look into using and modifying
ulatencyd or similiar tools to your needs. With good rules this should take care of problematic processes faster than 15 Minutes and with some persistance.