Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
github.com/tuzi3040/goodls
This is a CLI tool to download shared files and folders from Google Drive. For large file, the resumable download can be also run.
We have already known that the shared files on Google Drive can be downloaded without the authorization. But when the size of file becomes large (about 40MB), it requires a little ingenuity to download the file. It requires to access 2 times to Google Drive. At 1st access, it retrieves a cookie and a code for downloading. At 2nd access, the file is downloaded using the cookie and code. I created this process as a CLI tool.
This method uses API key.
There are sometimes the situation for downloading files in a shared folder. But I couldn't find the CLI applications for downloading files in the shared folder. So I implemented this. But when in order to retrieve the file list from the shared file, Drive API is required to be used. In order to use Drive API, it is required to use OAuth2, Service account and API key. So I selected to use API key which is the simplest way. This CLI tool can retrieve the file list in the shared folder using API key and download all files in the shared folder. From version 1.2.2, you can retrieve only files with the specific mimeType from the folder.
This method uses API key.
At a recent proposal, I knew the requirement of the resumable download of shared file. So I implemented this.
Download an executable file of goodls from the release page and import to a directory with path.
or
Use go get.
$ go get -u github.com/tanaikech/goodls
The image used for this demonstration was created by k3-studio
You can use this just after you download or install goodls. You are not required to do like OAuth2 process.
$ goodls -u [URL of shared file on Google Drive]
$ goodls --help
-e
pdf
. When ms
is used, the shared Google Docs can be downloaded as Microsoft Docs.$ goodls -u https://docs.google.com/document/d/#####/edit?usp=sharing -e txt
-f
$ goodls -u https://docs.google.com/document/d/#####/edit?usp=sharing -e txt -f sample.txt
https://docs.google.com/spreadsheets/d/#####/edit?usp=sharing
https://docs.google.com/document/d/#####/edit?usp=sharing
https://docs.google.com/presentation/d/#####/edit?usp=sharing
https://drive.google.com/file/d/#####/view?usp=sharing
https://drive.google.com/uc?export=download&id=###
If you have a file including URLs, you can input the URL data using standard input and pipe as follows. If wrong URL is included, the URL is skipped.
$ cat sample.txt | goodls
or
$ goodls < sample.txt
sample.txt
https://docs.google.com/spreadsheets/d/#####/edit?usp=sharing
https://docs.google.com/document/d/#####/edit?usp=sharing
https://docs.google.com/presentation/d/#####/edit?usp=sharing
When you download shared files from Google Drive, please confirm whether the files are shared.
When above structure is downloaded, the command is like below. At that time, the folder ID is the folder ID of "sampleFolder1".
Files are downloaded from the shared folder. In this demonstration, the fake folder ID and API key are used.
In order to use this, please retrieve API key as the following flow.
Login to Google.
Access to https://console.cloud.google.com/?hl=en.
Click select project at the right side of "Google Cloud Platform" of upper left of window.
Click "Library" at left side.
.Click "NEW PROJECT"
GOODLS_APIKEY
as the environment variable is set API key, goodls uses API key from the environment variable.For example, in the case of bash, please add a following code to .bashrc.
export GOODLS_APIKEY=### your API key ###
When the URL of shared folder is https://drive.google.com/drive/folders/#####?usp=sharing
, you can download all files in the folder by the following command.
$ goodls -u https://drive.google.com/drive/folders/#####?usp=sharing -key [APIkey]
--NoProgres
, -np
is used, the progress information is not seen. This is a silent mode.--overwrite
and --skip
, the files are overwritten and skipped, respectively.-m
, you can retrieve only files with the specific mimeType from the folder. For example, when you want to download PDF and PNG files, please run like below.
$ goodls -u [URL] -key [APIkey] -m "application/pdf,image/png"
When you want to retrieve the information of file and folder, you can do it as follows.
$ goodls -u https://docs.google.com/spreadsheets/d/#####/edit?usp=sharing -key [APIkey] -i
$ goodls -u https://drive.google.com/drive/folders/#####?usp=sharing -key [APIkey] -i
When you use this option, at first, please retrieve API key. About how to retrieve API key, you can see at here.
When you want to download 100 MBytes of the shared file, you can use the following command.
$ goodls -u [URL of shared file on Google Drive] -key [APIkey] -r 100m
-r
. In this sample, 100m
means to download 100 MBytes of the shared file.
-r 1g
.-r 1000000
, 1 MByte of the file will be able to be downloaded.You can see the actual running of this option at the following demonstration movie.
In this demonstration, the following command is run 3 times.
$ goodls -u https://drive.google.com/drive/folders/abcdefg?usp=sharing -key htjklmn -r 80m
New download
at "Current status".Resumable download
at "Current status".Download has already done.
at "Current status".If you have any questions and commissions for me, feel free to tell me.
v1.0.0 (January 10, 2018)
v1.0.1 (January 11, 2018)
v1.0.2 (May 10, 2018)
v1.0.3 (September 4, 2018)
--np
is used, the progress is not displayed.v1.1.0 (November 4, 2018)
--extension
and -e
, when -e ms
is used, Google Docs (Document, Spreadsheet, Slides) are converted to Microsoft Docs (Word, Excel, Powerpoint), respectively.v1.1.1 (November 13, 2018)
1. Version of [go-getfilelist](https://github.com/tanaikech/go-getfilelist) was updated. Because the structure of ``drive.File`` got to be able to be used, I also updated this application.
v1.2.0 (November 24, 2018)
v1.2.1 (November 25, 2018)
GOODLS_APIKEY
as the environment variable is set API key, goodls uses API key from the environment variable.v1.2.2 (December 12, 2018)
$ goodls -u [URL] -key [APIkey] -m "application/pdf,image/png"
v1.2.3 (October 31, 2019)
$ goodls -u [URL] -d [directory]
v1.2.4 (January 3, 2020)
github.com/urfave/cli
was changed by the update of https://github.com/urfave/cli. By this, when go get -u github.com/tanaikech/goodls
is run, an error occurred. So this error was removed.v1.2.5 (January 29, 2020)
$ goodls -u [URL] --notcreatetopdirectory
or $ goodls -u [URL] -ntd
v1.2.6 (February 23, 2020)
--skiperror
like below.
$ goodls -u https://drive.google.com/drive/folders/###?usp=sharing --skiperror
v1.2.7 (August 21, 2020)
webContentLink
was added. So from this version, the URL of https://drive.google.com/uc?export=download&id=###
got to be able to be used. This is the request from this thread.FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.