Fun with Perl: rdesktop launcher

dagolden on 2008-11-21T03:46:29

I've started experimenting with using rdesktop to remotely access my (Windows) laptop from my Ubuntu desktop. The annoying part was figuring out what DHCP address was assigned to the laptop each time.

Then, of course, I realized this was a job for Perl! (Plus some system tools)

So I wrote a "laptop-launcher" program and here's what it does:

  • run 'nmap' to scan for hosts with open remote desktop ports
  • parse the nmap output to map MAC addresses to IP addresses (thank you Regexp::Common qw/net/)
  • run 'rdesktop' with the IP address corresponding to my laptop's MAC address

Just a couple minutes work and now launching a remote desktop session to my laptop is a snap.

Thank you, Perl!

-- dagolden


Avahi and/or Bonjour...

mattk on 2008-11-21T05:15:51

will get you multicast DNS for free, so instead of nmapping your network, you can use a hostname of laptop.local, for example. MacOS supports this out of the box, too.

Re:Avahi and/or Bonjour...

dagolden on 2008-11-21T11:02:16

It's a Windows laptop. From what I can tell, the Apple Bonjour for Windows program lets the Windows laptop resolve *.local but doesn't automatically advertise anything, and I don't regularly have any Bonjour services running.

So unless I want to download the Windows Bonjour SDK and write a taskbar program to just advertise "_workstation" for identity, nmap seems like an easier approach.

Thanks for the suggestion, though. I wish Bonjour on Windows was more usable -- it would have been easier.

-- dagolden