Skip to content

Commit d214ea5

Browse files
committed
Fixed how config file was read for leaks
1 parent 0756058 commit d214ea5

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

searchsploit.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,25 @@ def scrapeRC():
5050

5151
try:
5252
if(SETTINGS_LOC != ""): # Checks if the variable is empty
53-
settings = open(SETTINGS_LOC, "r").read().split("\n")
53+
settingsFile = open(SETTINGS_LOC, "r")
5454
else:
55-
settings = open(".searchsploit_rc", "r").read().split("\n")
55+
settingsFile = open(".searchsploit_rc", "r")
5656
except:
5757
try:
58-
settings = open("/etc/.searchsploit_rc", "r").read().split("\n")
58+
settingsFile = open("/etc/.searchsploit_rc", "r")
5959
except:
6060
try:
61-
settings = open(os.path.expanduser("~").replace(
62-
"\\", "/") + "/.searchsploit_rc", "r").read().split("\n")
61+
settingsFile = open(os.path.expanduser("~").replace(
62+
"\\", "/") + "/.searchsploit_rc", "r")
6363
# Checks for home directory in linux/mac
6464
except:
65-
settings = open(os.getenv("userprofile").replace(
66-
"\\", "/") + "/.searchsploit_rc", "r").read().split("\n")
65+
settingsFile = open(os.getenv("userprofile").replace(
66+
"\\", "/") + "/.searchsploit_rc", "r")
6767
# Checks for home directory in windows
68+
69+
settings = settingsFile.read().split("\n")
70+
settingsFile.close()
71+
6872
for i in settings:
6973
if(i == "" or i[0] == "#"):
7074
continue # Ignores lines that are empty or are just comments

0 commit comments

Comments
 (0)