File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change 8
8
__copyright__ = "Copyright 2018 d4rkd0s"
9
9
__credits__ = ["Logan Schmidt" ]
10
10
__license__ = "MIT"
11
- __version__ = "1.0.1 "
11
+ __version__ = "1.0.0 "
12
12
__maintainer__ = "Logan Schmidt"
13
13
__email__ = "d4rkd0s@gmail.com"
14
14
__status__ = "Production"
15
15
16
- # Your username
17
- username = ""
18
-
19
16
# Loads the database from connections.json file in ~/.ssh/
20
17
def loadDB ():
21
- database_file = open ("/home/" + username + "/.ssh/connections.json" , "r" )
18
+ database_file = open (os . environ [ 'HOME' ] + "/.ssh/connections.json" , "r" )
22
19
return json .loads (database_file .read ())
23
20
24
21
def createNewDB ():
25
- database_file = open ("/home/" + username + "/.ssh/connections.json" , "w" )
22
+ database_file = open (os . environ [ 'HOME' ] + "/.ssh/connections.json" , "w" )
26
23
data = {}
27
- config = open ("/home/" + username + "/.ssh/config" , "r" )
24
+ config = open (os . environ [ 'HOME' ] + "/.ssh/config" , "r" )
28
25
config_lines = config .readlines ()
29
26
num_of_lines = 0
30
27
for line in config_lines :
@@ -36,7 +33,7 @@ def createNewDB():
36
33
return loadDB ()
37
34
38
35
def prepareDB ():
39
- exists = os .path .isfile ("/home/" + username + "/.ssh/connections.json" )
36
+ exists = os .path .isfile (os . environ [ 'HOME' ] + "/.ssh/connections.json" )
40
37
if exists :
41
38
return loadDB ()
42
39
else :
You can’t perform that action at this time.
0 commit comments