This commit is contained in:
2024-07-08 13:40:49 +02:00
parent 490fc9cb8a
commit 429958600e
4 changed files with 128 additions and 16 deletions

24
SSH_Agent/main.py Normal file
View File

@@ -0,0 +1,24 @@
#! /usr/bin/env python3.12
import subprocess
def import_ssh_keys_to_agent(privat_key = str):
try:
run_add_key = subprocess.run(
["/usr/bin/ssh-add", privat_key, '>>', "/dev/null"],
shell=False,
text=False,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
timeout=1,)
except subprocess.TimeoutExpired:
return False
print(run_add_key)
if run_add_key.returncode == 0:
return True
else:
return False
print(import_ssh_keys_to_agent(privat_key="/home/jonnybravo/.ssh/ansible-test"))