Valentine’s Headless Girlfriend
Creepy way to crack adult streaming service

Intro/Motivation
Surfing through the pages of the Internet without AdBlock I very often get to view different popups. This time the popup was special, something in the spirit of “you do not have a girl on 14 February? Visit us and spend time with webcam models” Ok challenge accepted
TLDR: The article itself is an irony as well as instructions to the headless way of running GUI applications with subsequent tracking of their visual states

Service
The service itself is a collection of mostly Slavic webcam models. The main method of interaction — streaming. After a brief study of all streams from a desktop to go through RTSP encryption. But the iPad version is vice versa — go unencrypted across the MPEG-DASH protocol
One piece of video data is a few seconds m4v, after about 10 seconds old pieces are no longer available.
In order to get a solid stream could make a script that collects discrete 5 seconds video fragments, but in my opinion is the interaction with the “girl” is extremely difficult. Let’s try something a little more direct xvfb

Tooling
xvfb — X virtual framebuffer probably many coders have been exposed to it using TravisCI … <any other CI service> for automating UI testing through eg selenium, but in my experience, and among my friends I have no one who has used it to really live projects.
Further, in order to interact with the “girl”, we need webdriver and selenium framework and some fancy language. Alas, all the fancy new languages are not suited for the task, but the logo Ruby seemed to me a clear hit in holiday theme

Implementation
Code implementation
As an auxiliary library, I made a fork of gem called “headless”. It’s really simple command line interface for xvfb. By my additions it will add capture audio in addition to video recording
Entry point in girlfriend.rb file:
Dude, your girl is waiting. But first Find her name nl.bongacams.com
Usage: ruby girlfriend.rb her_name love_duration_in_milliseconds
Now we have our own girl, just like in the commercials :)
Each segments will mark and save in “girlstapes” folder
But do not forget that 720p and 30 frames also takes place, so for this purpose, we can use the new apartment somewhere on the S3, but it another time.
It is important to note that the video source recording without a mouse cursor (we disable our virtual display) as well as we have little changes to the page for better quality

Improvements
In addition to the beautiful apartment at S3 penthouse our majesty may need new clothes, we can put her into docker container and move it to a more powerful server. By that, you can easily achieve 1080p at 30 frames, but for now, not all of the streaming is supported full HD.
Just do not forget that in servers there is no external sound card, so the sound capture through the server can be difficult. But we have a whole two options for ffmpeg
ALSA
pulse
You will be able to experiment at meantime
OR
You can find the real girlfriend and record any stream you like to watch with her on the weekend :)
Happy Valentine’s Day

