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
1baea8c4
Commit
1baea8c4
authored
Nov 17, 2020
by
dmknght
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add filter by response code
parent
2c6ee20c
Pipeline
#1445
canceled with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
src/goofileN.nim
src/goofileN.nim
+9
-5
No files found.
src/goofileN.nim
View file @
1baea8c4
...
...
@@ -2,7 +2,7 @@ import httpClient
import
htmlparser
import
xmltree
import
asyncdispatch
from
strutils
import
intToStr
,
repeat
,
split
,
startsWith
,
endsWith
,
replace
,
contain
s
import
strutil
s
from
uri
import
encodeURL
,
decodeURL
from
os
import
paramCount
,
paramStr
,
getCurrentDir
,
dirExists
,
createDir
,
getHomeDir
...
...
@@ -92,20 +92,24 @@ proc downloadFiles(folder: string, agent: string) =
for eachResult in allDorkResults:
let
fileName = decodeUrl(eachResult.realURL).split("/")[^1]
finalPath =
folder & fileName
finalPath =
if not contains(fileName, "&"): folder & fileName else: folder & fileName.split("&")[0]
try:
# Downloading -> yellow
# Saved at -> cyan
# Error: read
let resp = waitFor(client.get(eachResult.realURL))
if resp.status != "200 OK":
continue
echo "[+] Downloading
\e
[33m" & eachResult.realURL & "
\e
[0m"
waitFor(client.downloadFile(eachResult.realURL, finalPath))
echo "[*] Saved at
\e
[96m" & finalPath & "
\e
[0m"
downloaded += 1
except:
stderr.write("[x] Error " & getCurrentExceptionMsg() & "
\e
[31m" & eachResult.realURL & "
\e
[0m
\n
")
if eachResult.cacheURL != "No web cache URL found":
echo "[-] Download from cache is not supported. Please try it manually: " & eachResult.cacheURL
discard
# stderr.write("[x] Error " & getCurrentExceptionMsg() & "
\e
[31m" & eachResult.realURL & "
\e
[0m
\n
")
# if eachResult.cacheURL != "No web cache URL found":
# echo "[-] Download from cache is not supported. Please try it manually: " & eachResult.cacheURL
echo "[*] Downloaded " & intToStr(downloaded) & " files"
client.close()
...
...
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