import zipfile 
import tarfile
import shutil

def unzip(filename, dir):
  zf = zipfile.ZipFile(filename)
  zf.extractall(dir)
    

def unzip1(filename, dir):
  zf = zipfile.ZipFile(filename)
  zf.extract(dir)
  
def unzip2(filename):
  with tarfile.open(filename) as tar:
    for entry in tar:
        #GOOD: Check that entry is safe
        if os.path.isabs(entry.name) or ".." in entry.name:
            raise ValueError("Illegal tar archive entry")
        shutil.copy(entry, "/tmp/unpack/")

@@ -57,32 +57,34 @@
 filename, dir):%0A
+  
   zf = zipfile.Z
@@ -92,32 +92,34 @@
 pFile(filename)%0A
+  
   zf.extractall(
@@ -158,16 +158,18 @@
 dir):%0A  
+ 
+ 
 zf = zip
@@ -191,16 +191,18 @@
 lename)%0A
+  
   zf.ext
@@ -218,287 +218,5 @@
 %0A  %0A
-def unzip2(filename):%0A  with tarfile.open(filename) as tar:%0A    for entry in tar:%0A        #GOOD: Check that entry is safe%0A        if os.path.isabs(entry.name) or %22..%22 in entry.name:%0A            raise ValueError(%22Illegal tar archive entry%22)%0A        shutil.copy(entry, %22/tmp/unpack/%22)
 %0A

Update zipslip_good.py