Skip to content

Commit 429b2bb

Browse files
committed
Formatted Document
1 parent 22610a7 commit 429b2bb

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

searchsploit.py

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# RC info
2323

2424
progname = os.path.basename(argv[0])
25-
VERSION = "v1.5" # Program version
25+
VERSION = "v1.5" # Program version
2626
files_array = [] # Array options with file names
2727
name_array = [] # Array options with database names
2828
path_array = [] # Array options with paths to database files
@@ -53,7 +53,7 @@ def scrapeRC():
5353
for p in paths:
5454
print("\"{0}\"".format(p))
5555
exit(2)
56-
56+
5757
for i in settings:
5858
if(i == "" or i[0] == "#"):
5959
continue # Ignores lines that are empty or are just comments
@@ -149,7 +149,8 @@ def scrapeRC():
149149
help="Display the EDB-ID value rather than local path.")
150150
parser.add_argument("--nmap", metavar="file.xml", nargs="?", type=argparse.FileType("r"), default=None, const=os.sys.stdin,
151151
help="Checks all results in Nmap's XML output with service version (e.g.: nmap -sV -oX file.xml).\nUse \"-v\" (verbose) to try even more combinations")
152-
parser.add_argument("--version", action="version", version="%(prog)s {0}".format(VERSION))
152+
parser.add_argument("--version", action="version",
153+
version="%(prog)s {0}".format(VERSION))
153154
parser.add_argument("--exclude", nargs="*", type=str, default=list(), metavar="[terms]",
154155
help="Remove certain terms from the results. Option best added after all other terms have been gathered.")
155156

@@ -169,7 +170,7 @@ def update():
169170

170171
# update via git
171172
os.chdir(path_array[i]) # set path to repos directory
172-
os.system("git pull -v upstream master")
173+
os.system("git pull -v origin master")
173174
print("[i] Git Pull Complete")
174175
os.chdir(cwd)
175176
return
@@ -181,7 +182,7 @@ def update():
181182
def drawline():
182183
""" Draws a line in the terminal.
183184
"""
184-
line = "" * (int(COL) - 1)
185+
line = "" * (int(COL) - 1)
185186
print(line)
186187

187188

@@ -191,7 +192,7 @@ def drawline(lim):
191192
"""
192193
line = "-" * lim
193194
line += "+"
194-
line += "-" * (COL - lim - 2) # -2 for terminal padding
195+
line += "-" * (COL - lim - 2) # -2 for terminal padding
195196
print(line)
196197

197198

@@ -205,11 +206,11 @@ def highlightTerm(line, term):
205206
if not parseArgs.colour:
206207
return line
207208

208-
marker = 0 # marks where the term is first found
209+
marker = 0 # marks where the term is first found
209210
term = term.lower()
210211

211212
while (line.lower().find(term, marker) >= 0):
212-
marker = line.lower().find(term, marker) # update location of new found term
213+
marker = line.lower().find(term, marker) # update location of new found term
213214
part1 = line[:marker]
214215
part2 = line[marker: marker + len(term)]
215216
part3 = line[marker + len(term):]
@@ -218,7 +219,7 @@ def highlightTerm(line, term):
218219
return line
219220

220221

221-
def separater(lim, line1:str, line2:str):
222+
def separater(lim, line1: str, line2: str):
222223
""" Splits the two texts to fit perfectly within the terminal width
223224
"""
224225
lim = int(lim)
@@ -227,13 +228,15 @@ def separater(lim, line1:str, line2:str):
227228
print(line)
228229
return
229230

230-
line1_length = lim - 1 # subtract 1 for padding
231-
line2_length = int(COL) - lim - 2 - 1 # -2 for divider padding and -1 for terminal padding
232-
format_string = "{{title:{title_length}.{title_length}s}}\033[0m | {{path:{path_length}.{path_length}s}}\033[0m"
233-
231+
line1_length = lim - 1 # subtract 1 for padding
232+
# -2 for divider padding and -1 for terminal padding
233+
line2_length = int(COL) - lim - 2 - 1
234+
format_string = "{{title:{title_length}.{title_length}s}}\033[0m | {{path:{path_length}.{path_length}s}}\033[0m"
235+
234236
# Escape options for colour
235237
if not parseArgs.colour:
236-
print("{{0:{0}.{0}s}} | {{1:{1}.{1}s}}".format(line1_length, line2_length).format(line1, line2))
238+
print("{{0:{0}.{0}s}} | {{1:{1}.{1}s}}".format(
239+
line1_length, line2_length).format(line1, line2))
237240
return
238241

239242
# increase lim by markers to not include highlights in series
@@ -254,9 +257,9 @@ def separater(lim, line1:str, line2:str):
254257
line2_length += 4
255258
last_mark = line2.find("\033[0m", last_mark, line2_length + 4) + 4
256259

257-
258260
# Creating format string for print
259-
fstring = format_string.format(title_length=line1_length, path_length=line2_length)
261+
fstring = format_string.format(
262+
title_length=line1_length, path_length=line2_length)
260263
line = fstring.format(title=line1, path=line2)
261264
print(line)
262265

@@ -508,7 +511,6 @@ def nmapxml(file=""):
508511
# ## Read in XMP (IP, name, service, and version)
509512
root = ET.fromstring(content)
510513

511-
512514
hostsheet = root.findall("host")
513515
for host in hostsheet:
514516
# made these lines to separate searches by machine
@@ -531,7 +533,7 @@ def nmapxml(file=""):
531533
print("Searching terms:", terms) # displays terms found by xml
532534
searchsploitout() # tests search terms by machine
533535
terms = [] # emptys search terms for next search
534-
536+
535537
return True
536538

537539

@@ -698,7 +700,7 @@ def run():
698700
elif parseArgs.examine != None:
699701
examine(parseArgs.examine)
700702
return
701-
703+
702704
# formatting exclusions
703705
if not parseArgs.case:
704706
for i in range(len(parseArgs.exclude)):

0 commit comments

Comments
 (0)