class AgentSmith::CLI
Public Instance Methods
delete_all()
click to toggle source
# File lib/agent_smith.rb, line 14 def delete_all prov_profiles = Dir["#{PROVISIONING_PATH}/*.mobileprovision"] prov_profiles.each do |file| system "rm \"#{file}\"" puts "#{File.basename(file)} removed" end puts "done" end
install()
click to toggle source
# File lib/agent_smith.rb, line 35 def install delete_all Dir.chdir (options[:temp_dir] || Dir.mktmpdir) do system "mkdir -p #{PROVISIONING_PATH.gsub(" ","\\ ")}" system "git clone #{options[:repo]} repo &> /dev/null" certificate = open(APPLE_ROOT_CERTIFICATE_URL).read() prov_profiles = Dir["repo/**/**.mobileprovision"] puts "#{prov_profiles.count} provisioning profiles found" prov_profiles.each do |prov_profile| prov_profile_content = File.read(prov_profile) p7 = OpenSSL::PKCS7.new(prov_profile_content) store = OpenSSL::X509::Store.new cert = OpenSSL::X509::Certificate.new(certificate) store.add_cert(cert) verification = p7.verify([cert], store) if verification plist = Plist::parse_xml(p7.data) uuid = plist["UUID"] system "cp #{prov_profile} #{PROVISIONING_PATH.gsub(" ","\\ ")}#{uuid}.mobileprovision" puts "#{File.basename(prov_profile)} installed" else puts "#{File.basename(prov_profile)} is not valid" end end end end