Home Exploit Command Downloading Methods from Google Drive
Post
Cancel

Exploit Command Downloading Methods from Google Drive

In the blog, we want to exploit several methods to find the best and most convenient way to download files and folders from Google Drive.

A quick summary:

  • Gshell: Need google to vertify the app. Currently it is not working due to the logging problem.
  • Gdown: useful to download a single file.
  • The most convenient way: Gdrive(Go environment needed).
  • Wget and Curl are also feasible but kind of complicated.

Best Way

Best way for downloading all the files or folders is gdrive and drive.

Generally, we should install golang previously and install gdrive and drive from their github repositories.

Then we should pass the OAuth by using drive init ~/gdrive. Be noticed, when google send a link and require the verification code, the link should be open on the same computer even if the computer is a server.

Finally, drive pull -id <file or folder id> and gdrive [global] download [options] <fileId> Download file or directory are the straightforward commands to download the files or folders from google drive.

Other methods:

  1. Using Gsutil to download file on Google Cloud Platform

The tutorial is here.

  1. Using scripts or commands to download file on Google drive

A convenient way to download file is like that

  1. Gdown
  • syntax: gdown https://drive.google.com/uc?id=FILE-ID

3. A Quick Choice

More details

As to small file:

1
2
3
4
5
6
7
8
9
10
cd ~

export fileid=1yXsJq7TTMgUVXbOnCalyupESFN-tm2nc
export filename=matthuisman.jpg

## WGET ##
wget -O $filename 'https://docs.google.com/uc?export=download&id='$fileid

## CURL ##
curl -L -o $filename 'https://docs.google.com/uc?export=download&id='$fileid

As to large file(More than 100MB)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
cd ~

export fileid=1iAJbHqiNwc4nJlP67sp1xLkl5EtC4PU_
export filename=all.zip

## WGET ##
wget --save-cookies cookies.txt 'https://docs.google.com/uc?export=download&id='$fileid -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1/p' > confirm.txt

wget --load-cookies cookies.txt -O $filename 'https://docs.google.com/uc?export=download&id='$fileid'&confirm='$(<confirm.txt)

## CURL ##
curl -L -c cookies.txt 'https://docs.google.com/uc?export=download&id='$fileid \
     | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1/p' > confirm.txt

curl -L -b cookies.txt -o $filename \
     'https://docs.google.com/uc?export=download&id='$fileid'&confirm='$(<confirm.txt)

rm -f confirm.txt cookies.txt

Link

This post is licensed under CC BY 4.0 by the author.

Machine Learning Tutorial

Preliminary Exam Summary