I have a problem with writing Python script which brute-force SSH private key passphrase for /.ssh/id_rsa file. I am using ssh-add command that ask passphrase until you enter it.
But script fail with error:
ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
I don't understand why.
Tried all variations of subprocess module with .Popen, .call and etc. But I think most suitable for my situation is:
import subprocess
p = subprocess.Popen('ssh-add id_rsa', stdin=subprocess.PIPE, text=True, shell=True)
p.stdin.write(str('password'))
Expected password request, like "Enter passphrase for id_rsa"