Linux web-conference.aiou.edu.pk 5.4.0-205-generic #225-Ubuntu SMP Fri Jan 10 22:23:35 UTC 2025 x86_64
Apache/2.4.41 (Ubuntu)
: 172.16.50.247 | : 3.15.235.47
Cant Read [ /etc/named.conf ]
7.4.3-4ubuntu2.28
root
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
BLACK DEFEND!
README
+ Create Folder
+ Create File
/
usr /
lib /
python3 /
dist-packages /
twisted /
python /
[ HOME SHELL ]
Name
Size
Permission
Action
__pycache__
[ DIR ]
drwxr-xr-x
_pydoctortemplates
[ DIR ]
drwxr-xr-x
test
[ DIR ]
drwxr-xr-x
__init__.py
674
B
-rw-r--r--
_appdirs.py
788
B
-rw-r--r--
_inotify.py
3.37
KB
-rw-r--r--
_oldstyle.py
2.53
KB
-rw-r--r--
_release.py
18.11
KB
-rw-r--r--
_setup.py
12.65
KB
-rw-r--r--
_shellcomp.py
24.25
KB
-rw-r--r--
_textattributes.py
8.87
KB
-rw-r--r--
_tzhelper.py
3.12
KB
-rw-r--r--
_url.py
253
B
-rw-r--r--
compat.py
22.65
KB
-rw-r--r--
components.py
13.96
KB
-rw-r--r--
constants.py
544
B
-rw-r--r--
context.py
3.93
KB
-rw-r--r--
deprecate.py
26.15
KB
-rw-r--r--
failure.py
26.01
KB
-rw-r--r--
fakepwd.py
5.99
KB
-rw-r--r--
filepath.py
57.51
KB
-rw-r--r--
formmethod.py
11.19
KB
-rw-r--r--
htmlizer.py
3.46
KB
-rw-r--r--
lockfile.py
7.54
KB
-rw-r--r--
log.py
21.95
KB
-rw-r--r--
logfile.py
9.85
KB
-rw-r--r--
modules.py
26.5
KB
-rw-r--r--
monkey.py
2.17
KB
-rw-r--r--
procutils.py
1.39
KB
-rw-r--r--
randbytes.py
3.87
KB
-rw-r--r--
rebuild.py
9.05
KB
-rw-r--r--
reflect.py
19.02
KB
-rw-r--r--
release.py
1.16
KB
-rw-r--r--
roots.py
7.23
KB
-rw-r--r--
runtime.py
6.12
KB
-rw-r--r--
sendmsg.py
3.34
KB
-rw-r--r--
shortcut.py
2.2
KB
-rw-r--r--
syslog.py
3.64
KB
-rw-r--r--
systemd.py
2.77
KB
-rw-r--r--
text.py
5.35
KB
-rw-r--r--
threadable.py
3.22
KB
-rw-r--r--
threadpool.py
9.61
KB
-rw-r--r--
twisted-completion.zsh
1.34
KB
-rw-r--r--
url.py
244
B
-rw-r--r--
urlpath.py
8.87
KB
-rw-r--r--
usage.py
34.19
KB
-rw-r--r--
util.py
27.28
KB
-rw-r--r--
versions.py
322
B
-rw-r--r--
win32.py
4.22
KB
-rw-r--r--
zippath.py
9.02
KB
-rw-r--r--
zipstream.py
9.53
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : zipstream.py
# -*- test-case-name: twisted.python.test.test_zipstream -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ An incremental approach to unzipping files. This allows you to unzip a little bit of a file at a time, which means you can report progress as a file unzips. """ import zipfile import os.path import zlib import struct _fileHeaderSize = struct.calcsize(zipfile.structFileHeader) class ChunkingZipFile(zipfile.ZipFile): """ A L{zipfile.ZipFile} object which, with L{readfile}, also gives you access to a file-like object for each entry. """ def readfile(self, name): """ Return file-like object for name. """ if self.mode not in ("r", "a"): raise RuntimeError('read() requires mode "r" or "a"') if not self.fp: raise RuntimeError( "Attempt to read ZIP archive that was already closed") zinfo = self.getinfo(name) self.fp.seek(zinfo.header_offset, 0) fheader = self.fp.read(_fileHeaderSize) if fheader[0:4] != zipfile.stringFileHeader: raise zipfile.BadZipfile("Bad magic number for file header") fheader = struct.unpack(zipfile.structFileHeader, fheader) fname = self.fp.read(fheader[zipfile._FH_FILENAME_LENGTH]) if fheader[zipfile._FH_EXTRA_FIELD_LENGTH]: self.fp.read(fheader[zipfile._FH_EXTRA_FIELD_LENGTH]) if zinfo.flag_bits & 0x800: # UTF-8 filename fname_str = fname.decode("utf-8") else: fname_str = fname.decode("cp437") if fname_str != zinfo.orig_filename: raise zipfile.BadZipfile( 'File name in directory "%s" and header "%s" differ.' % ( zinfo.orig_filename, fname_str)) if zinfo.compress_type == zipfile.ZIP_STORED: return ZipFileEntry(self, zinfo.compress_size) elif zinfo.compress_type == zipfile.ZIP_DEFLATED: return DeflatedZipFileEntry(self, zinfo.compress_size) else: raise zipfile.BadZipfile( "Unsupported compression method %d for file %s" % (zinfo.compress_type, name)) class _FileEntry(object): """ Abstract superclass of both compressed and uncompressed variants of file-like objects within a zip archive. @ivar chunkingZipFile: a chunking zip file. @type chunkingZipFile: L{ChunkingZipFile} @ivar length: The number of bytes within the zip file that represent this file. (This is the size on disk, not the number of decompressed bytes which will result from reading it.) @ivar fp: the underlying file object (that contains pkzip data). Do not touch this, please. It will quite likely move or go away. @ivar closed: File-like 'closed' attribute; True before this file has been closed, False after. @type closed: L{bool} @ivar finished: An older, broken synonym for 'closed'. Do not touch this, please. @type finished: L{int} """ def __init__(self, chunkingZipFile, length): """ Create a L{_FileEntry} from a L{ChunkingZipFile}. """ self.chunkingZipFile = chunkingZipFile self.fp = self.chunkingZipFile.fp self.length = length self.finished = 0 self.closed = False def isatty(self): """ Returns false because zip files should not be ttys """ return False def close(self): """ Close self (file-like object) """ self.closed = True self.finished = 1 del self.fp def readline(self): """ Read a line. """ line = b"" for byte in iter(lambda : self.read(1), b""): line += byte if byte == b"\n": break return line def __next__(self): """ Implement next as file does (like readline, except raises StopIteration at EOF) """ nextline = self.readline() if nextline: return nextline raise StopIteration() # Iterators on Python 2 use next(), not __next__() next = __next__ def readlines(self): """ Returns a list of all the lines """ return list(self) def xreadlines(self): """ Returns an iterator (so self) """ return self def __iter__(self): """ Returns an iterator (so self) """ return self def __enter__(self): return self def __exit__(self, exc_type, exc_value, traceback): self.close() class ZipFileEntry(_FileEntry): """ File-like object used to read an uncompressed entry in a ZipFile """ def __init__(self, chunkingZipFile, length): _FileEntry.__init__(self, chunkingZipFile, length) self.readBytes = 0 def tell(self): return self.readBytes def read(self, n=None): if n is None: n = self.length - self.readBytes if n == 0 or self.finished: return b'' data = self.chunkingZipFile.fp.read( min(n, self.length - self.readBytes)) self.readBytes += len(data) if self.readBytes == self.length or len(data) < n: self.finished = 1 return data class DeflatedZipFileEntry(_FileEntry): """ File-like object used to read a deflated entry in a ZipFile """ def __init__(self, chunkingZipFile, length): _FileEntry.__init__(self, chunkingZipFile, length) self.returnedBytes = 0 self.readBytes = 0 self.decomp = zlib.decompressobj(-15) self.buffer = b"" def tell(self): return self.returnedBytes def read(self, n=None): if self.finished: return b"" if n is None: result = [self.buffer,] result.append( self.decomp.decompress( self.chunkingZipFile.fp.read( self.length - self.readBytes))) result.append(self.decomp.decompress(b"Z")) result.append(self.decomp.flush()) self.buffer = b"" self.finished = 1 result = b"".join(result) self.returnedBytes += len(result) return result else: while len(self.buffer) < n: data = self.chunkingZipFile.fp.read( min(n, 1024, self.length - self.readBytes)) self.readBytes += len(data) if not data: result = (self.buffer + self.decomp.decompress(b"Z") + self.decomp.flush()) self.finished = 1 self.buffer = b"" self.returnedBytes += len(result) return result else: self.buffer += self.decomp.decompress(data) result = self.buffer[:n] self.buffer = self.buffer[n:] self.returnedBytes += len(result) return result DIR_BIT = 16 def countZipFileChunks(filename, chunksize): """ Predict the number of chunks that will be extracted from the entire zipfile, given chunksize blocks. """ totalchunks = 0 zf = ChunkingZipFile(filename) for info in zf.infolist(): totalchunks += countFileChunks(info, chunksize) return totalchunks def countFileChunks(zipinfo, chunksize): """ Count the number of chunks that will result from the given C{ZipInfo}. @param zipinfo: a C{zipfile.ZipInfo} instance describing an entry in a zip archive to be counted. @return: the number of chunks present in the zip file. (Even an empty file counts as one chunk.) @rtype: L{int} """ count, extra = divmod(zipinfo.file_size, chunksize) if extra > 0: count += 1 return count or 1 def unzipIterChunky(filename, directory='.', overwrite=0, chunksize=4096): """ Return a generator for the zipfile. This implementation will yield after every chunksize uncompressed bytes, or at the end of a file, whichever comes first. The value it yields is the number of chunks left to unzip. """ czf = ChunkingZipFile(filename, 'r') if not os.path.exists(directory): os.makedirs(directory) remaining = countZipFileChunks(filename, chunksize) names = czf.namelist() infos = czf.infolist() for entry, info in zip(names, infos): isdir = info.external_attr & DIR_BIT f = os.path.join(directory, entry) if isdir: # overwrite flag only applies to files if not os.path.exists(f): os.makedirs(f) remaining -= 1 yield remaining else: # create the directory the file will be in first, # since we can't guarantee it exists fdir = os.path.split(f)[0] if not os.path.exists(fdir): os.makedirs(fdir) if overwrite or not os.path.exists(f): fp = czf.readfile(entry) if info.file_size == 0: remaining -= 1 yield remaining with open(f, 'wb') as outfile: while fp.tell() < info.file_size: hunk = fp.read(chunksize) outfile.write(hunk) remaining -= 1 yield remaining else: remaining -= countFileChunks(info, chunksize) yield remaining
Close