Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
packages
tools
goofileN
Commits
aa542b5d
Commit
aa542b5d
authored
Oct 25, 2020
by
dmknght
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add user agent support
parent
36f8dc9e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
src/goofileN.nim
src/goofileN.nim
+13
-7
No files found.
src/goofileN.nim
View file @
aa542b5d
...
...
@@ -15,6 +15,7 @@ type
query
:
string
extension
:
string
path
:
string
agent
:
string
var
allDorkResults
:
seq
[
DorkFile
]
...
...
@@ -62,6 +63,7 @@ proc helpBanner() =
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
\"
,
\"
xlsx,pdf
\"
)"
)
showHelpCmd
(
keyword
=
"-q"
,
args
=
"Query string"
,
descr
=
"[Optional] Keywords to filter result (ex: members)"
)
showHelpCmd
(
keyword
=
"-a"
,
args
=
"User-Agent"
,
descr
=
"[Optional] Use custom User-Agent"
)
showHelpCmd
(
keyword
=
"-s"
,
args
=
"Download folder"
,
descr
=
"[Optional] Enable download files (ex: /tmp/)"
)
...
...
@@ -78,7 +80,7 @@ proc printResult() =
echo
"-"
.
repeat
(
70
)
proc
downloadFiles
(
folder
:
string
)
=
proc
downloadFiles
(
folder
:
string
,
agent
:
string
)
=
#[
Download
file
if
users
want
to
download
all
of
them
If
URL
can
't be used, try use webcache
...
...
@@ -88,7 +90,7 @@ proc downloadFiles(folder: string) =
client = newHttpClient()
downloaded = 0
client.headers = newHttpHeaders({"User-Agent": "Mozilla/5.0 (Windows NT 10.0;
…
) Gecko/20100101 Firefox/
6
8.0"})
client.headers =
if agent == "":
newHttpHeaders({"User-Agent": "Mozilla/5.0 (Windows NT 10.0;
rv:78.0
) Gecko/20100101 Firefox/
7
8.0"})
else: newHttpHeaders({"User-Agent": agent})
for eachResult in allDorkResults:
let
...
...
@@ -155,7 +157,7 @@ proc getResult(resp: Response, ext: string) =
allDorkResults.add(dorkResult)
proc basicSearch(domain, extension, query: string) =
proc basicSearch(domain, extension, query
, agent
: string) =
#[
Do the google dork by basic HTTP GET queries
Make the basic query like this:
...
...
@@ -172,7 +174,7 @@ proc basicSearch(domain, extension, query: string) =
payload = encodeUrl(payload)
client.headers = newHttpHeaders({"User-Agent": "Mozilla/5.0 (Windows NT 10.0;
…
) Gecko/20100101 Firefox/
6
8.0"})
client.headers =
if agent == "":
newHttpHeaders({"User-Agent": "Mozilla/5.0 (Windows NT 10.0;
rv:78.0
) Gecko/20100101 Firefox/
7
8.0"})
else: newHttpHeaders({"User-Agent": agent})
let resp = client.get("https://google.com/search?num=500&q=" & payload)
getResult(resp, extension)
...
...
@@ -189,7 +191,7 @@ proc handleOptions(options: Options) =
else
:
if
","
in
options
.
extension
:
options
.
extension
=
"("
&
options
.
extension
.
replace
(
","
,
" | "
)
&
")"
basicSearch
(
options
.
domain
,
options
.
extension
,
options
.
query
)
basicSearch
(
options
.
domain
,
options
.
extension
,
options
.
query
,
options
.
agent
)
let
szResults
=
len
(
allDorkResults
)
if
szResults
>
0
:
printResult
()
...
...
@@ -207,9 +209,9 @@ proc handleOptions(options: Options) =
except
:
stderr
.
write
(
"[x] Error while creating download folder
\n
"
)
return
downloadFiles
(
options
.
path
)
downloadFiles
(
options
.
path
,
options
.
agent
)
else
:
downloadFiles
(
options
.
path
)
downloadFiles
(
options
.
path
,
options
.
agent
)
echo
"Found "
&
intToStr
(
szResults
)
&
" results"
...
...
@@ -250,6 +252,7 @@ proc main =
query
:
""
,
extension
:
""
,
path
:
""
,
agent
:
""
,
)
while
index
<
paramCount
():
...
...
@@ -265,6 +268,9 @@ proc main =
elif
paramStr
(
index
)
==
"-s"
:
options
.
path
=
paramStr
(
index
+
1
)
index
+=
1
elif
paramStr
(
index
)
==
"-a"
:
options
.
agent
=
paramStr
(
index
+
1
)
index
+=
1
else
:
stderr
.
write
(
"[x] Unknow options "
&
paramStr
(
index
)
&
"
\n
"
)
helpBanner
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment