Skip to content

Commit 5b120e7

Browse files
authored
Update ssh_helper.py
1 parent 20b5637 commit 5b120e7

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

ssh_helper.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,20 @@
88
__copyright__ = "Copyright 2018 d4rkd0s"
99
__credits__ = ["Logan Schmidt"]
1010
__license__ = "MIT"
11-
__version__ = "1.0.1"
11+
__version__ = "1.0.0"
1212
__maintainer__ = "Logan Schmidt"
1313
__email__ = "d4rkd0s@gmail.com"
1414
__status__ = "Production"
1515

16-
# Your username
17-
username = ""
18-
1916
# Loads the database from connections.json file in ~/.ssh/
2017
def loadDB():
21-
database_file = open("/home/" + username + "/.ssh/connections.json", "r")
18+
database_file = open(os.environ['HOME'] + "/.ssh/connections.json", "r")
2219
return json.loads(database_file.read())
2320

2421
def createNewDB():
25-
database_file = open("/home/" + username + "/.ssh/connections.json", "w")
22+
database_file = open(os.environ['HOME'] + "/.ssh/connections.json", "w")
2623
data = {}
27-
config = open("/home/" + username + "/.ssh/config", "r")
24+
config = open(os.environ['HOME'] + "/.ssh/config", "r")
2825
config_lines = config.readlines()
2926
num_of_lines = 0
3027
for line in config_lines:
@@ -36,7 +33,7 @@ def createNewDB():
3633
return loadDB()
3734

3835
def prepareDB():
39-
exists = os.path.isfile("/home/" + username + "/.ssh/connections.json")
36+
exists = os.path.isfile(os.environ['HOME'] + "/.ssh/connections.json")
4037
if exists:
4138
return loadDB()
4239
else:

0 commit comments

Comments
 (0)