replacement for VNCsnapshot

Hey,

Its my first post here and i hope its in the right place.
I came from debian and windows so FreeBSD is a bit of a puzzle on some parts.

I am looking for a way to take screenshots of my VNC hosts from a script.
Previously i used VNCsnapshot for this, yes i know that pice of software is from 2004... but still it did what i needed it to do.
I was wondering if there is another tool that can do the same.

What i need it to do is as follows: i have a script (posted below) and it should take screenshots and move on to the next client. One thing is, this box is headless so everything needs to be done from the cli.

Code:
#!/bin/sh
awk '{print $1}' < ../Lists/vnc-ip.txt | while read ip; do
    echo "Running: $ip"
    timeout 5s vncsnapshot "$ip" "../VNC/$ip.jpg"
done

Can anyone help me with this?

My OS is Freenas 11.3U4.1 - FreeBSD 11.4-RELEASE-p3 Jail
 
I’m afraid I don’t know an existing tool that does what you want.

However, it might be possible to construct something yourself. Basically, you could start a virtual X server (x11-servers/xorg-vfbserver). It does not use a physical display, so it can run on a headless machine. See the Xvfb(1) manual page. Then your script can start a vncviewer(1) (net/tightvnc) in the background, sleep for a few seconds, then use another tool to take a screenshot of the vncviewer (for example, using the import(1) utility of the graphics/ImageMagick7 package). Then you can kill the vncviewer and continue with the next machine.

Admittedly it’s kind of a “hack” and requires some work, but I think it should work.
 
There is a vnc2mpg sample here: https://github.com/LibVNC/libvncserver/tree/master/client_examples
You will need to compile it yourself. libvncserver is a pain to compile (use the package) but then this single c file isn't so bad.

You could perhaps hack at this fairly easily to integrate lodepng or std_image_write to save the screen buffer as an image rather than mpg file.
https://lodev.org/lodepng/
https://github.com/nothings/stb

Also, I could have sworn OpenCV had the functionality to stream from a VNC input but I must have been dreaming. Shame because there are loads of tools to export the pixel buffers. If you don't mind Python that would have been like 5 lines (if it existed...).
 
Admittedly it’s kind of a “hack” and requires some work, but I think it should work.
Do you know how to start xvfb , I tried running the command, also find didn't find it at all, how would I start it at all. Linux people say xvfb-run app
 
sajansen welcome to FreeBSD Forums.

… FreeBSD 11.4-RELEASE-p3 Jail

If you're not already aware, it reached end of life around five months ago, so please be prepared for the possibility of something not working as expected.

More formally:


Security context: Unsupported FreeBSD Releases | The FreeBSD Project

Ports and Packages for Supported Releases | The FreeBSD Project (ignore the lines for stable/11 and releng/11.4; a fix for the page is in the pipeline).
 
Back
Top