Skip to content

Instantly share code, notes, and snippets.

@rufo
Created July 20, 2017 01:32
Show Gist options
  • Save rufo/0e8ff4c44568f4b988fc958b32d18532 to your computer and use it in GitHub Desktop.
Save rufo/0e8ff4c44568f4b988fc958b32d18532 to your computer and use it in GitHub Desktop.
Sinatra app for unlocking your PC via VNC (for steam)
require 'bundler/inline'
gemfile true do
source 'https://rubygems.org'
gem 'ruby-vnc', '~>1.1.0', require: 'net/vnc'
gem 'sinatra', '~>2.0.0'
end
require 'sinatra/base'
class UnlockApp < Sinatra::Base
set :bind, '0.0.0.0'
get '/' do
"<html><body><a href='/unlock'>open your eyes</a></body></html>"
end
get '/unlock' do
Net::VNC.open '192.168.212.101:0', shared: true, password: 'vncpassword' do |vnc|
vnc.button_press
sleep 1
vnc.type 'pin'
vnc.key_press :return
end
"<html><body>door is open</body></html>"
end
run!
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment