TiledViz
Loading...
Searching...
No Matches
build_pem.py
1#!/usr/bin/python3
2import pexpect, re, sys
3
4cmdgen="openssl req -new -x509 -days 1 -nodes -out self.pem -keyout self.pem"
5
6childgen=pexpect.spawnu(cmdgen) #, logfile=sys.stdout.buffer)
7childgen.logfile=sys.stdout
8#childgen.setecho(True)
9#expindex=childgen.expect('Generating a RSA private key')
10
11#expindex=childgen.expect(r".*Country Name \‍(2 letter code\‍) \‍[.*\‍]:")
12#if (expindex == 0):
13
14outpass = childgen.sendline(r'FR')
15
16#expindex=childgen.expect('State or Province Name (full name) [Some-State]:')
17#if (expindex == 0):
18
19outpass = childgen.sendline(r'France')
20
21#expindex=childgen.expect('Locality Name (eg, city) []:')
22#if (expindex == 0):
23
24outpass = childgen.sendline(r'Paris')
25
26#expindex=childgen.expect('Organization Name (eg, company) [Internet Widgits Pty Ltd]:')
27#if (expindex == 0):
28
29outpass = childgen.sendline(r'CNRS')
30
31#expindex=childgen.expect('Organizational Unit Name (eg, section) []:')
32#if (expindex == 0):
33
34outpass = childgen.sendline(r'MDLS')
35#child.send ('\x20')
36#expindex=childgen.expect('Common Name (e.g. server FQDN or YOUR name) []:')
37#if (expindex == 0):
38
39outpass = childgen.sendline(r'Mancip')
40
41#expindex=childgen.expect('Email Address []:')
42#if (expindex == 0):
43
44outpass = childgen.sendline(r'Martial.Mancip@MaisondelaSimulation.fr')
45
46try:
47 childgen.expect(pexpect.EOF)
48except:
49 pass
50childgen.close(force=True)
51