mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Update zipslip_bad.py
This commit is contained in:
@@ -5,34 +5,33 @@ import gzip
|
||||
import zipfile
|
||||
|
||||
def unzip(filename):
|
||||
|
||||
with tarfile.open(filename) as zipf:
|
||||
with tarfile.open(filename) as zipf:
|
||||
#BAD : This could write any file on the filesystem.
|
||||
for entry in zipf:
|
||||
shutil.move(entry, "/tmp/unpack/")
|
||||
for entry in zipf:
|
||||
shutil.move(entry, "/tmp/unpack/")
|
||||
|
||||
def unzip1(filename):
|
||||
with gzip.open(filename) as zipf:
|
||||
with gzip.open(filename) as zipf:
|
||||
#BAD : This could write any file on the filesystem.
|
||||
for entry in zipf:
|
||||
shutil.copy2(entry, "/tmp/unpack/")
|
||||
for entry in zipf:
|
||||
shutil.copy2(entry, "/tmp/unpack/")
|
||||
|
||||
def unzip2(filename):
|
||||
with bz2.open(filename) as zipf:
|
||||
with bz2.open(filename) as zipf:
|
||||
#BAD : This could write any file on the filesystem.
|
||||
for entry in zipf:
|
||||
shutil.copyfile(entry, "/tmp/unpack/")
|
||||
for entry in zipf:
|
||||
shutil.copyfile(entry, "/tmp/unpack/")
|
||||
|
||||
def unzip3(filename):
|
||||
with zipfile.ZipFile(filename) as zipf:
|
||||
with zipfile.ZipFile(filename) as zipf:
|
||||
#BAD : This could write any file on the filesystem.
|
||||
for entry in zipf:
|
||||
shutil.copy(entry, "/tmp/unpack/")
|
||||
for entry in zipf:
|
||||
shutil.copy(entry, "/tmp/unpack/")
|
||||
|
||||
def unzip4(filename):
|
||||
with zipfile.ZipFile(filename) as zipf:
|
||||
for entry in zipf:
|
||||
with open(entry, 'wb') as dstfile:
|
||||
shutil.copyfileobj(zipf, dstfile)
|
||||
with zipfile.ZipFile(filename) as zipf:
|
||||
for entry in zipf:
|
||||
with open(entry, 'wb') as dstfile:
|
||||
shutil.copyfileobj(zipf, dstfile)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user