Skip to content

Instantly share code, notes, and snippets.

@maceip
Created May 18, 2013 08:00
Show Gist options
  • Save maceip/5603657 to your computer and use it in GitHub Desktop.
Save maceip/5603657 to your computer and use it in GitHub Desktop.
test if company is using certain cloud services. uses first argument as company name to query
require 'open-uri'
open("https://#{ARGV[0]}.box.com/", 'User-Agent' => 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1468.0 Safari/537.36').read =~ /<title>(.*?)<\/title>/
box = $1
open("https://#{ARGV[0]}.okta.com/", 'User-Agent' => 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1468.0 Safari/537.36').read =~ /<title>(.*?)<\/title>/
okta = $1
printf("BOX: %s, OKTA %s\n", box.chars.first.eql?("C") ? "true" : "false", !okta.chars.first.eql?(" ") ? "true" : "false")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment