Page 1 of 1
you can download files with certutil
Posted: 09 Apr 2018 10:14
by npocmaka_
https://groups.google.com/forum/#!topic ... %5B1-25%5D
Code: Select all
certutil.exe -urlcache -split -f "https://download.sysinternals.com/files/PSTools.zip" pstools.zip
Re: you can download files with certutil
Posted: 09 Apr 2018 10:20
by dbenham
Wow, that is cool

and scary

Re: you can download files with certutil
Posted: 09 Apr 2018 12:43
by ShadowThief
I imagine -f is "force", but what does "-split" do?
Re: you can download files with certutil
Posted: 09 Apr 2018 12:58
by Squashman
ShadowThief wrote: ↑09 Apr 2018 12:43
I imagine -f is "force", but what does "-split" do?
Code: Select all
C:\Users\Squashman\Desktop>certutil -urlcache -?
Usage:
CertUtil [Options] -URLCache [URL | CRL | * [delete]]
Display or delete URL cache entries
URL -- cached URL
CRL -- operate on all cached CRL URLs only
* -- operate on all cached URLs
delete -- delete relevant URLs from the current user's local cache
Use -f to force fetching a specific URL and updating the cache.
Options:
-f -- Force overwrite
-gmt -- Display times as GMT
-seconds -- Display times with seconds and milliseconds
-split -- Split embedded ASN.1 elements, and save to files
-v -- Verbose operation
-privatekey -- Display password and private key data
CertUtil -? -- Display a verb list (command list)
CertUtil -URLCache -? -- Display help text for the "URLCache" verb
CertUtil -v -? -- Display all help text for all verbs
Re: you can download files with certutil
Posted: 09 Apr 2018 14:49
by penpen
This should work since windows vista (i have no windows vista to test):
https://blogs.technet.microsoft.com/pki ... -certutil/
penpen
Re: you can download files with certutil
Posted: 12 Apr 2018 02:38
by miskox
Very good!
At work I cannot use wget.exe - it does not work. BITS transfer works but it is veeeery slow.
certutil.exe solution can be compared with wget.exe - downloads at full speed. Though input and output files must (probably) be set (no wildcard downloading for example, or complete web sites). Or your list can be generated with wget.exe on another computer...
Also I did some tests with parameters:
- if I remove -f - split download is very slow
Thanks again - very useful.
Saso
Re: you can download files with certutil
Posted: 13 Apr 2018 00:19
by miskox
Update:
target folders must exist (the same goes for BITS).
Saso
Re: you can download files with certutil
Posted: 13 Apr 2018 01:37
by npocmaka_
miskox wrote: ↑13 Apr 2018 00:19
Update:
target folders must exist (the same goes for BITS).
Saso
But unlike bitsadmin works with relative paths.
Re: you can download files with certutil
Posted: 13 Apr 2018 11:09
by carlos
Very interesting. The only disadvantage is that the file is cached in two additional locations like this:
%UserProfile%\AppData\LocalLow\Microsoft\CryptnetUrlCache\Content
%UserProfile%\AppData\Local\Microsoft\Windows\INetCache\IE\43LG2WYW\
I found this using the -v parameter that show more info.
Code: Select all
certutil.exe -v -urlcache -split "https://download.sysinternals.com/files/PSTools.zip"
Thus, if you download a file, it would be save on the disk on 3 folders.
Re: you can download files with certutil
Posted: 13 Apr 2018 16:11
by penpen
carlos wrote: ↑13 Apr 2018 11:09
Very interesting. The only disadvantage is that the file is cached in two additional locations
Just delete the urlcache after downloading (shouldn't cause any issues if and only if the same process that created the cache, deletes that cache, which here is the case):
Code: Select all
@echo off
setlocal enableExtensions disableDelayedExpansion
set "url=https://download.sysinternals.com/files/PSTools.zip"
call :download "url"
goto :eof
:download
:: %~1 name of the environment variable that holds the url
setlocal enableDelayedExpansion
:: downloading file
certutil.exe -urlcache -split -f "!%~1!" pstools.zip
::deleting cache
certutil -urlcache "!%~1!" delete
:: check referenced urlcache is deleted
certutil.exe -v -urlcache -split "!%~1!"
endlocal
goto :eof
penpen