|
7 | 7 |
|
8 | 8 | @app.post("/bomb")
|
9 | 9 | async def bomb(file_path):
|
10 |
| - zipfile.ZipFile(file_path, "r").extract("file1") |
11 |
| - zipfile.ZipFile(file_path, "r").extractall() |
| 10 | + zipfile.ZipFile(file_path, "r").extract("file1") # $ result=BAD |
| 11 | + zipfile.ZipFile(file_path, "r").extractall() # $ result=BAD |
12 | 12 |
|
13 | 13 | with zipfile.ZipFile(file_path) as myzip:
|
14 |
| - with myzip.open('ZZ') as myfile: |
| 14 | + with myzip.open('ZZ') as myfile: # $ result=BAD |
15 | 15 | a = myfile.readline()
|
16 | 16 |
|
17 | 17 | with zipfile.ZipFile(file_path) as myzip:
|
18 |
| - with myzip.open('ZZ', mode="w") as myfile: |
| 18 | + with myzip.open('ZZ', mode="w") as myfile: # $result=OK |
19 | 19 | myfile.write(b"tmpppp")
|
20 | 20 |
|
21 |
| - zipfile.ZipFile(file_path).read("aFileNameInTheZipFile") |
| 21 | + zipfile.ZipFile(file_path).read("aFileNameInTheZipFile") # $ result=BAD |
22 | 22 |
|
23 |
| - tarfile.open(file_path).extractfile("file1.txt") |
24 |
| - tarfile.TarFile.open(file_path).extract("somefile") |
25 |
| - tarfile.TarFile.xzopen(file_path).extract("somefile") |
26 |
| - tarfile.TarFile.gzopen(file_path).extractall() |
27 |
| - tarfile.TarFile.open(file_path).extractfile("file1.txt") |
| 23 | + tarfile.open(file_path).extractfile("file1.txt") # $ result=BAD |
| 24 | + tarfile.TarFile.open(file_path).extract("somefile") # $ result=BAD |
| 25 | + tarfile.TarFile.xzopen(file_path).extract("somefile") # $ result=BAD |
| 26 | + tarfile.TarFile.gzopen(file_path).extractall() # $ result=BAD |
| 27 | + tarfile.TarFile.open(file_path).extractfile("file1.txt") # $ result=BAD |
28 | 28 |
|
29 |
| - tarfile.open(file_path, mode="w") |
30 |
| - tarfile.TarFile.gzopen(file_path, mode="w") |
31 |
| - tarfile.TarFile.open(file_path, mode="r:") |
| 29 | + tarfile.open(file_path, mode="w") # $result=OK |
| 30 | + tarfile.TarFile.gzopen(file_path, mode="w") # $result=OK |
| 31 | + tarfile.TarFile.open(file_path, mode="r:") # $ result=BAD |
32 | 32 | import shutil
|
33 | 33 |
|
34 |
| - shutil.unpack_archive(file_path) |
| 34 | + shutil.unpack_archive(file_path) # $ result=BAD |
35 | 35 |
|
36 | 36 | import lzma
|
37 | 37 |
|
38 |
| - lzma.open(file_path) |
39 |
| - lzma.LZMAFile(file_path).read() |
| 38 | + lzma.open(file_path) # $ result=BAD |
| 39 | + lzma.LZMAFile(file_path).read() # $ result=BAD |
40 | 40 |
|
41 | 41 | import bz2
|
42 | 42 |
|
43 |
| - bz2.open(file_path) |
44 |
| - bz2.BZ2File(file_path).read() |
| 43 | + bz2.open(file_path) # $ result=BAD |
| 44 | + bz2.BZ2File(file_path).read() # $ result=BAD |
45 | 45 |
|
46 | 46 | import gzip
|
47 | 47 |
|
48 |
| - gzip.open(file_path) |
49 |
| - gzip.GzipFile(file_path) |
| 48 | + gzip.open(file_path) # $ result=BAD |
| 49 | + gzip.GzipFile(file_path) # $ result=BAD |
50 | 50 |
|
51 | 51 | import pandas
|
52 | 52 |
|
53 |
| - pandas.read_csv(filepath_or_buffer=file_path) |
| 53 | + pandas.read_csv(filepath_or_buffer=file_path) # $ result=BAD |
54 | 54 |
|
55 |
| - pandas.read_table(file_path, compression='gzip') |
56 |
| - pandas.read_xml(file_path, compression='gzip') |
| 55 | + pandas.read_table(file_path, compression='gzip') # $ result=BAD |
| 56 | + pandas.read_xml(file_path, compression='gzip') # $ result=BAD |
57 | 57 |
|
58 |
| - pandas.read_csv(filepath_or_buffer=file_path, compression='gzip') |
59 |
| - pandas.read_json(file_path, compression='gzip') |
60 |
| - pandas.read_sas(file_path, compression='gzip') |
61 |
| - pandas.read_stata(filepath_or_buffer=file_path, compression='gzip') |
62 |
| - pandas.read_table(file_path, compression='gzip') |
63 |
| - pandas.read_xml(path_or_buffer=file_path, compression='gzip') |
| 58 | + pandas.read_csv(filepath_or_buffer=file_path, |
| 59 | + compression='gzip') # $ result=BAD |
| 60 | + pandas.read_json(file_path, compression='gzip') # $ result=BAD |
| 61 | + pandas.read_sas(file_path, compression='gzip') # $ result=BAD |
| 62 | + pandas.read_stata(filepath_or_buffer=file_path, |
| 63 | + compression='gzip') # $ result=BAD |
| 64 | + pandas.read_table(file_path, compression='gzip') # $ result=BAD |
| 65 | + pandas.read_xml(path_or_buffer=file_path, |
| 66 | + compression='gzip') # $ result=BAD |
64 | 67 |
|
65 | 68 | # no compression no DOS
|
66 |
| - pandas.read_table(file_path, compression='tar') |
67 |
| - pandas.read_xml(file_path, compression='tar') |
68 |
| - |
69 |
| - pandas.read_csv(filepath_or_buffer=file_path, compression='tar') |
70 |
| - pandas.read_json(file_path, compression='tar') |
71 |
| - pandas.read_sas(file_path, compression='tar') |
72 |
| - pandas.read_stata(filepath_or_buffer=file_path, compression='tar') |
73 |
| - pandas.read_table(file_path, compression='tar') |
74 |
| - pandas.read_xml(path_or_buffer=file_path, compression='tar') |
| 69 | + pandas.read_table(file_path, compression='tar') # $result=OK |
| 70 | + pandas.read_xml(file_path, compression='tar') # $result=OK |
| 71 | + |
| 72 | + pandas.read_csv(filepath_or_buffer=file_path, |
| 73 | + compression='tar') # $result=OK |
| 74 | + pandas.read_json(file_path, compression='tar') # $result=OK |
| 75 | + pandas.read_sas(file_path, compression='tar') # $result=OK |
| 76 | + pandas.read_stata(filepath_or_buffer=file_path, |
| 77 | + compression='tar') # $result=OK |
| 78 | + pandas.read_table(file_path, compression='tar') # $result=OK |
| 79 | + pandas.read_xml(path_or_buffer=file_path, compression='tar') # $result=OK |
75 | 80 |
|
76 | 81 | return {"message": "bomb"}
|
0 commit comments