Create auto-image.py
This commit is contained in:
parent
30f00c2114
commit
6d3b2d1c0d
27
auto-image.py
Normal file
27
auto-image.py
Normal file
@ -0,0 +1,27 @@
|
||||
# gpg test program
|
||||
#
|
||||
# This is just some nasty test code to add images automatically to a gpg pub key.
|
||||
# Uses pexpect to interact with the shell.
|
||||
# This does nothing alone its just an example, to use you need to write more code or
|
||||
# add it to one of the existing programs in this repo.
|
||||
|
||||
import pexpect
|
||||
import sys
|
||||
import time
|
||||
|
||||
email = "fake@mail"
|
||||
imagefile = '/usr/path/to/image/file.jpg'
|
||||
child = pexpect.spawn('gpg --edit-key ' + email)
|
||||
child.logfile = sys.stdout
|
||||
|
||||
child.expect('gpg>')
|
||||
child.sendline('addphoto')
|
||||
child.expect('Enter JPEG filename for photo ID: ')
|
||||
child.sendline(imagefile)
|
||||
child.expect('y+')
|
||||
child.send('y\n')
|
||||
child.expect('Is this photo correct (y/N/q)?')
|
||||
child.send('y\n')
|
||||
child.expect('gpg> ')
|
||||
child.sendline('save')
|
||||
child.expect (pexpect.EOF)
|
||||
Loading…
Reference in New Issue
Block a user