Commit ca0816bf authored by dmknght's avatar dmknght

Fix the multiple extension error

parent 46490929
Pipeline #1440 canceled with stages
......@@ -95,9 +95,12 @@ proc downloadFiles(folder: string, agent: string) =
finalPath = folder & fileName
try:
echo "[+] Downloading " & eachResult.realURL
# TODO add color for downloading and saved at.
# Downloading -> yellow
# Saved at -> cyan
echo "[+] Downloading \e[33m" & eachResult.realURL & "\e[0m"
discard client.downloadFile(eachResult.realURL, finalPath)
echo "[*] Saved at " & finalPath
echo "[*] Saved at \e[96m" & finalPath & "\e[0m"
downloaded += 1
except:
stderr.write("[x] Error while downloading " & eachResult.realURL & "\n")
......@@ -122,7 +125,7 @@ proc getResult(resp: AsyncResponse, ext: string) =
else:
let allResults = parseHTML(waitfor(resp.body))
for eachResult in allResults.findAll("div"):
# # Filter all result thing
# Filter all result thing
let
urlResults = eachResult.findAll("a")
titleResults = eachResult.findAll("h3")
......@@ -143,19 +146,12 @@ proc getResult(resp: AsyncResponse, ext: string) =
cacheURL: tmpCacheURL,
)
# Filter: Only use URL with file
if "|" in ext:
let allExt = ext.replace("(", "").replace(")", "")
for eachExt in allExt.split(" | "):
if dorkResult.realURL.endsWith("." & eachExt):
allDorkResults.add(dorkResult)
break
else:
# if dorkResult.realURL.endsWith("." & ext):
allDorkResults.add(dorkResult)
allDorkResults.add(dorkResult)
except:
# Google Dork has some false URL like /search?q=site:gov.vn ext:(xlsx | pdf) in resp
# We ignore it
discard
proc basicSearch(domain, extension, query, agent: string) =
#[
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment