Damon Cortesi's blog

Musings of an entrepreneur.

Automatically Grab Screenshots Using Javascript

| Comments

I was on a job a while ago where there were numerous VNC servers. Being the diligent auditor that I am, I wanted to a) document all the connections and b) determine if there was any juicy material on those computers.

I got tired of opening VNC, inserting the IP address, entering the password, taking a screenshot, saving it, and closing everything down again after about 10 hosts…so I scripted it!

Using Javascript and the sendkeys method, I was able to automate the entire process. I must say, it was quite amusing to just lean back and watch hundreds of VNC sessions get opened one after another. The code is pretty simple:

It loops through an array of hosts, and for each host it opens a VNC session, uses sendkeys to send the password, and then fires up Irfanview to take the screenshot. Again using sendkeys, the screenshot gets saved, I kill both apps, and it does it again.

I love making life easier…

Comments