Python zipfile.getinfo() Examples
The following are 8
code examples of zipfile.getinfo().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
zipfile
, or try the search function
.
Example #1
Source File: utils.py From StalkPhish with GNU Affero General Public License v3.0 | 6 votes |
def PKzipSearch(self, InvTABLEname, SQL, LOG, DLDir, savefile): try: # print(zipfile.getinfo(savefile)) if zipfile.is_zipfile(savefile): file = zipfile.ZipFile(savefile, "r") extracted_emails = [] for name in file.namelist(): if re.findall("php$", name): scam_email2 = re.findall(r'[\w\.-]+@[\w\.-]+\.\w+', str(file.read(name))) for mailadd in scam_email2: if mailadd not in extracted_emails: extracted_emails.append(mailadd) # Extracted scammers email if any(map(len, extracted_emails)): return [extracted_emails] else: LOG.info("No emails in this kit? Uglyyyyy รด0") pass else: LOG.info("{} is not a zip file...".format(savefile)) except Exception as e: print("[!!!] Problem with PKzipSearch Class: " + str(e))
Example #2
Source File: data.py From razzy-spinner with GNU General Public License v3.0 | 5 votes |
def __init__(self, zipfile, entry=''): """ Create a new path pointer pointing at the specified entry in the given zipfile. :raise IOError: If the given zipfile does not exist, or if it does not contain the specified entry. """ if isinstance(zipfile, string_types): zipfile = OpenOnDemandZipFile(os.path.abspath(zipfile)) # Normalize the entry string, it should be relative: entry = normalize_resource_name(entry, True, '/').lstrip('/') # Check that the entry exists: if entry: try: zipfile.getinfo(entry) except Exception: # Sometimes directories aren't explicitly listed in # the zip file. So if `entry` is a directory name, # then check if the zipfile contains any files that # are under the given directory. if (entry.endswith('/') and [n for n in zipfile.namelist() if n.startswith(entry)]): pass # zipfile contains a file in that directory. else: # Otherwise, complain. raise IOError('Zipfile %r does not contain %r' % (zipfile.filename, entry)) self._zipfile = zipfile self._entry = entry
Example #3
Source File: data.py From razzy-spinner with GNU General Public License v3.0 | 5 votes |
def file_size(self): return self._zipfile.getinfo(self._entry).file_size
Example #4
Source File: stdownloader.py From syncthing-gtk with GNU General Public License v2.0 | 5 votes |
def __init__(self, zipfile, name): info = zipfile.getinfo(name) for x in dir(info): if not (x.startswith("_") or x.endswith("_")): setattr(self, x, getattr(info, x)) self.size = self.file_size
Example #5
Source File: data.py From luscan-devel with GNU General Public License v2.0 | 5 votes |
def __init__(self, zipfile, entry=''): """ Create a new path pointer pointing at the specified entry in the given zipfile. :raise IOError: If the given zipfile does not exist, or if it does not contain the specified entry. """ if isinstance(zipfile, basestring): zipfile = OpenOnDemandZipFile(os.path.abspath(zipfile)) # Normalize the entry string: entry = re.sub('(^|/)/+', r'\1', entry) # Check that the entry exists: if entry: try: zipfile.getinfo(entry) except: # Sometimes directories aren't explicitly listed in # the zip file. So if `entry` is a directory name, # then check if the zipfile contains any files that # are under the given directory. if (entry.endswith('/') and [n for n in zipfile.namelist() if n.startswith(entry)]): pass # zipfile contains a file in that directory. else: # Otherwise, complain. raise IOError('Zipfile %r does not contain %r' % (zipfile.filename, entry)) self._zipfile = zipfile self._entry = entry
Example #6
Source File: data.py From luscan-devel with GNU General Public License v2.0 | 5 votes |
def file_size(self): return self._zipfile.getinfo(self._entry).file_size
Example #7
Source File: data.py From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International | 5 votes |
def __init__(self, zipfile, entry=''): """ Create a new path pointer pointing at the specified entry in the given zipfile. :raise IOError: If the given zipfile does not exist, or if it does not contain the specified entry. """ if isinstance(zipfile, string_types): zipfile = OpenOnDemandZipFile(os.path.abspath(zipfile)) # Check that the entry exists: if entry: # Normalize the entry string, it should be relative: entry = normalize_resource_name(entry, True, '/').lstrip('/') try: zipfile.getinfo(entry) except Exception: # Sometimes directories aren't explicitly listed in # the zip file. So if `entry` is a directory name, # then check if the zipfile contains any files that # are under the given directory. if entry.endswith('/') and [ n for n in zipfile.namelist() if n.startswith(entry) ]: pass # zipfile contains a file in that directory. else: # Otherwise, complain. raise IOError( 'Zipfile %r does not contain %r' % (zipfile.filename, entry) ) self._zipfile = zipfile self._entry = entry
Example #8
Source File: data.py From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International | 5 votes |
def file_size(self): return self._zipfile.getinfo(self._entry).file_size