Add multiple file search suport

parent c1e654a8
import httpClient
import htmlparser
import xmltree
from strutils import intToStr, repeat, split, startsWith, replace
from strutils import intToStr, repeat, split, startsWith, replace, contains
from uri import encodeURL, decodeURL
from os import paramCount, paramStr, getCurrentDir, existsDir, createDir, getHomeDir
......@@ -60,7 +60,7 @@ proc helpBanner() =
echo "\nUsage:"
showHelpCmd(keyword = "-h | -help | --help | help", descr = "Show help banner")
showHelpCmd(keyword = "-d", args = "Domain name", descr = "[Required] Target's name (ex: parrotsec.org)")
showHelpCmd(keyword = "-f", args = "File extension", descr = "[Required] Extension without \".\" (ex: xlsx)")
showHelpCmd(keyword = "-f", args = "File extension", descr = "[Required] Extension without \".\" (ex: \"xlsx\", \"xlsx,pdf\")")
showHelpCmd(keyword = "-q", args = "Query string", descr = "[Optional] Keywords to filter result (ex: members)")
showHelpCmd(keyword = "-s", args = "Download folder", descr = "[Optional] Enable download files (ex: /tmp/)")
......@@ -152,7 +152,6 @@ proc basicSearch(domain, extension, query: string) =
site:<domain name> ext:<file type> <Keyword>
Num=500 how many results in first page
Q= Our queries
TODO: multiple file types
]#
var
client = newHttpClient()
......@@ -178,6 +177,8 @@ proc handleOptions(options: Options) =
if options.domain == "" or options.extension == "":
stderr.write("[x] Domain name and file extension is required\n")
else:
if "," in options.extension:
options.extension = "(" & options.extension.replace(",", " | ") & ")"
basicSearch(options.domain, options.extension, options.query)
let szResults = len(allDorkResults)
if szResults > 0:
......
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