Skip to content

Instantly share code, notes, and snippets.

@whiteley
Created September 1, 2015 16:22
Show Gist options
  • Save whiteley/6ddc1d00b4560d0c46de to your computer and use it in GitHub Desktop.
Save whiteley/6ddc1d00b4560d0c46de to your computer and use it in GitHub Desktop.
630239CC130E1A7FD81A27B140976EAF437D05B5|0X1C4CBDCDCD2EFD2A|false
C5986B4F1257FFA86632CBA746181433FBB75451|0X1C4CBDCDCD2EFD2A|false
790BC7277767219C42C86F933B4FE6ACC0B21F32|0X1C4CBDCDCD2EFD2A|false
843938DF228D22F7B3742BC0D94AA3F0EFE21092|0X1C4CBDCDCD2EFD2A|false
7B0FAB3A13B907435925D9C954422A4B98AB5139|0X1C4CBDCDCD2EFD2A|false
430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A|0X1C4CBDCDCD2EFD2A|false
126C0D24BD8A2942CC7DF8AC7638D0442B90D010|0X1C4CBDCDCD2EFD2A|false
D21169141CECD440F2EB8DDA9D6D8F6BC857C906|0X1C4CBDCDCD2EFD2A|false
75DDC3C4A499F1A18CB5F3C8CBF8D6FD518E17E1|0X1C4CBDCDCD2EFD2A|false
9FED2BCBDCD29CDF762678CBAED4B06F473041FA|0X1C4CBDCDCD2EFD2A|false
0E4EDE2C7F3E1FC0D033800E64481591B98321F9|0X1C4CBDCDCD2EFD2A|false
A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553|0X1C4CBDCDCD2EFD2A|false
ED6D65271AACF0FF15D123036FB2A1C265FFB764|0X1C4CBDCDCD2EFD2A|false
9DBB0BE9366964F134855E2255F96FCF8231B6DD|0X1C4CBDCDCD2EFD2A|false
#!/usr/bin/env ruby
require 'mixlib/shellout'
def extract_fingerprints_from_cmd(cmd)
so = Mixlib::ShellOut.new(cmd, env: { 'LANG' => 'en_US', 'LANGUAGE' => 'en_US' })
so.run_command
so.stdout.split(/\n/).map do |t|
if z = t.match(/^ +Key fingerprint = ([0-9A-F ]+)/)
z[1].split.join
end
end.compact
end
key = '0x1C4CBDCDCD2EFD2A'
key_present = extract_fingerprints_from_cmd('apt-key finger').any? do |fingerprint|
puts "#{fingerprint}|#{key.upcase}|#{fingerprint.end_with?(key.upcase)}"
fingerprint.end_with?(key.upcase)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment