Skip to content

Commit 05b618c

Browse files
committed
Formatted Document
1 parent f8568dd commit 05b618c

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

searchsploit.py

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ def scrapeRC():
6464
for i in range(larray - 1, 0, -1):
6565
try:
6666
tempRead = open(os.path.abspath(os.path.join(path_array[i], files_array[i])),
67-
"r", encoding="utf8")
67+
"r", encoding="utf8")
6868
tempRead.read()
6969
tempRead.close()
7070
except:
7171
try:
72-
tempRead.close()
72+
tempRead.close()
7373
except:
7474
pass
7575
files_array.pop(i)
@@ -312,7 +312,8 @@ def findExploit(id):
312312
"""
313313
exploit = []
314314
for i in range(len(files_array)):
315-
exploit = cpFromDb(os.path.abspath(os.path.join(path_array[i], files_array[i])), id)
315+
exploit = cpFromDb(os.path.abspath(
316+
os.path.join(path_array[i], files_array[i])), id)
316317
if exploit == []:
317318
continue
318319
else:
@@ -410,19 +411,22 @@ def searchsploitout():
410411
temp = ""
411412
for i in terms:
412413
temp += i + " "
413-
jsonDict["SEARCH"] = temp[:-1] # Adding the search terms
414+
jsonDict["SEARCH"] = temp[:-1] # Adding the search terms
414415
searchs = []
415416
try:
416417
for i in range(len(files_array)):
417418
jsonDict["DB_PATH_" + name_array[i].upper()] = path_array[i]
418419
searchs.clear()
419-
query = searchdb(os.path.abspath(os.path.join(path_array[i], files_array[i])), terms, [2,0,3,4,5,6,1])
420+
query = searchdb(os.path.abspath(os.path.join(
421+
path_array[i], files_array[i])), terms, [2, 0, 3, 4, 5, 6, 1])
420422
for lines in query:
421-
searchs.append({"Title": lines[0].replace('"', ""), "EDB-ID":int(lines[1]), "Date": lines[2], "Author":lines[3].replace('"', ""), "Type":lines[4], "Platform": lines[5], "Path":path_array[i] + "/" + lines[6]})
423+
searchs.append({"Title": lines[0].replace('"', ""), "EDB-ID": int(lines[1]), "Date": lines[2], "Author": lines[3].replace(
424+
'"', ""), "Type": lines[4], "Platform": lines[5], "Path": path_array[i] + "/" + lines[6]})
422425
jsonDict["RESULTS_" + name_array[i].upper()] = searchs.copy()
423426
searchs.clear()
424427
import json.encoder
425-
jsonResult = json.dumps(jsonDict, indent=4, separators=(", ", ": "))
428+
jsonResult = json.dumps(
429+
jsonDict, indent=4, separators=(", ", ": "))
426430
print(jsonResult)
427431
except KeyboardInterrupt:
428432
pass
@@ -435,11 +439,14 @@ def searchsploitout():
435439
try:
436440
for i in range(len(files_array)):
437441
if parseArgs.id:
438-
query = searchdb(os.path.abspath(os.path.join(path_array[i], files_array[i])), terms, [2, 0])
442+
query = searchdb(os.path.abspath(os.path.join(
443+
path_array[i], files_array[i])), terms, [2, 0])
439444
elif parseArgs.www:
440-
query = searchdb(os.path.abspath(os.path.join(path_array[i], files_array[i])), terms, [2, 1, 0])
445+
query = searchdb(os.path.abspath(os.path.join(
446+
path_array[i], files_array[i])), terms, [2, 1, 0])
441447
else:
442-
query = searchdb(os.path.abspath(os.path.join(path_array[i], files_array[i])), terms, [2, 1])
448+
query = searchdb(os.path.abspath(os.path.join(
449+
path_array[i], files_array[i])), terms, [2, 1])
443450

444451
if len(query) == 0: # is the search results came up with nothing
445452
print(name_array[i] + ": No Results")
@@ -625,8 +632,8 @@ def mirror(id):
625632
absfile = path_array[ind]
626633

627634
currDir = os.getcwd()
628-
inp = open(os.path.normpath(os.path.join(absfile,exploit[1])), "rb")
629-
out = open(os.path.join(currDir,os.path.basename(exploit[1])), "wb")
635+
inp = open(os.path.normpath(os.path.join(absfile, exploit[1])), "rb")
636+
out = open(os.path.join(currDir, os.path.basename(exploit[1])), "wb")
630637
out.write(inp.read())
631638
inp.close()
632639
out.close()
@@ -643,11 +650,14 @@ def examine(id):
643650
return
644651
if exploit[1].endswith(".pdf"):
645652
import webbrowser
646-
webbrowser.open("file:///" + os.path.abspath(os.path.join(path_array[ind], exploit[1])), autoraise=True)
653+
webbrowser.open(
654+
"file:///" + os.path.abspath(os.path.join(path_array[ind], exploit[1])), autoraise=True)
647655
elif(os.sys.platform == "win32"):
648-
os.system("notepad " + os.path.relpath(os.path.join(path_array[ind], exploit[1])))
656+
os.system(
657+
"notepad " + os.path.relpath(os.path.join(path_array[ind], exploit[1])))
649658
else:
650-
os.system("pager " + os.path.relpath(os.path.join(path_array[ind],exploit[1])))
659+
os.system(
660+
"pager " + os.path.relpath(os.path.join(path_array[ind], exploit[1])))
651661
print("[EDBID]:" + exploit[0])
652662
print("[Exploit]:" + exploit[2])
653663
print("[Path]:" + os.path.abspath(os.path.join(path_array[ind], exploit[1])))

0 commit comments

Comments
 (0)