Port scanning and monitoring with Ruby and TCP sockets
Craig Webster has posted several times over the few days about his adventures with sockets in Ruby. He provides nice code examples (even doing socket stuff direct from irb!) and his explanations are useful if you know what you're doing with Ruby, but haven't tried doing any TCP or socket work yet:
- Absolute basics: Connecting to ports - First, Craig looks at how easy it is to connect to a remote port and how to check if a port is open.
- Concurrent socket programming - Craig moves on to using Ruby threads to connect to multiple ports at the same time, building a very basic port scanner.
- A more advanced port checker - Using forking and threads to build a more advanced port checker.
I hope Craig continues to post stuff like this as his blog could soon become a must-read.