0

I'm trying to run an openssl command in python. The problem is that everytime i run the command it asks for the password. Is there any function to put i,j,k,l variables in when asked for the password? The password should be between 0000-9999. This is my code:

from pynput.keyboard import Key, Controller
import os
import subprocess

keyboard=Controller()

for i in range(10):
for j in range(10):
    for k in range(10):
        for l in range(10):
            os.system('openssl rsa -in bob.prv -pubout -out bob.pub')
            print(i)
            print(j)
            print(k)
            print(l)
            keyboard.press('enter')
            keyboard.release('enter')
  • Python is not part of Windows. Therefore your code cannot run on normal people's machines. **What do you want from a Windows person**? – Noodles May 04 '19 at 23:27

1 Answers1

0

One way to avoid a password being prompted is to use the passphrase arguments as a part of OpenSSL command. There are various sources from which the password can be passed like a file, env variable etc.

For the openssl rsa command, there are two passphrase arguments: -passin arg & -passout arg.

For More details refer: https://www.openssl.org/docs/manmaster/man1/rsa.html

For Details on how to pass passphrase arguments refer to the Pass Phrase Options section in : https://www.openssl.org/docs/manmaster/man1/openssl.html

Jay
  • 24,173
  • 25
  • 93
  • 141