Multiple gpg keyid search (script?)
January 13, 2013 11:25 AM   Subscribe

I have a file listing all my long keyID's for GPG and want to lookup the emails associated with these.

I know the URL to do this is:

and the command is:
gpg --keyserver --search-keys

But while I can do it with bash scripting for the commndline that command doesn't seem to find any of the keys I'm loking for.

Perhaps I can do it with a webscraper like scrapy? Or how can I just query that webpage repeatedly with curl and differeing keyID's and save it so I can grep for @ email addresses?

Here's a sample of what I want to get the emails out of:



posted by jago25_98 to Technology (3 answers total)
Did you remember to prefix these keys with '0x'?

Without this, the queries will all fail.

posted by James Scott-Brown at 12:40 PM on January 13, 2013

If you save the keyIDs to a file called keys.txt (without manually adding '0x'), you can then extract the email addresses with this:

while read line; do curl -s "$line" | perl -nle 'print "$1" if (/<(.*?)>/)'; done < keys.txt
posted by James Scott-Brown at 1:00 PM on January 13, 2013

Thanks James, the curl loop was what I needed.
All the best greppers seem to use perl. I had to switch to grep:

while read line; do curl -s "$line" |grep -Eio '([[:alnum:]_.-]+@[[:alnum:]_.-]+?\.[[:alpha:].]{2,6})' ; done < keys1-processed1.txt.csv

This was strangley rewarding.

This could be abused. There should be some way of protecting PGP users from spam harvesting this way
posted by jago25_98 at 5:37 AM on January 16, 2013

« Older Why u no bury poop?   |   How much electricity does a gas boiler use? Newer »
This thread is closed to new comments.