当前位置: 首页>>代码示例>>Python>>正文


Python pylzma.decompress方法代码示例

本文整理汇总了Python中pylzma.decompress方法的典型用法代码示例。如果您正苦于以下问题:Python pylzma.decompress方法的具体用法?Python pylzma.decompress怎么用?Python pylzma.decompress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pylzma的用法示例。


在下文中一共展示了pylzma.decompress方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: scan

# 需要导入模块: import pylzma [as 别名]
# 或者: from pylzma import decompress [as 别名]
def scan(self, payload: Payload, request: Request) -> WorkerResponse:
        """
        Carve and decompress SWF files from payloads

        """

        extracted: List[ExtractedPayload] = []
        errors: List[Error] = []
        content = BytesIO(payload.content)
        content.seek(0)
        for start, end in self._carve(content):
            ex, errs = self.decompress(content, start)
            if ex:
                extracted.append(ex)
            for err in errs:
                errors.append(
                    Error(
                        error=err,
                        plugin_name=self.plugin_name,
                        payload_id=payload.results.payload_id,
                    )
                )
        return WorkerResponse(extracted=extracted, errors=errors) 
开发者ID:PUNCH-Cyber,项目名称:stoq-plugins-public,代码行数:25,代码来源:swfcarve.py

示例2: decompressSWFData

# 需要导入模块: import pylzma [as 别名]
# 或者: from pylzma import decompress [as 别名]
def decompressSWFData(in_data):
    try:
        ver = in_data[3]

        if in_data[0] == 'C':
            # zlib SWF
            decompressData = zlib.decompress(in_data[8:])
        elif in_data[0] == 'Z':
            # lzma SWF
            decompressData = pylzma.decompress(in_data[12:])
        elif in_data[0] == 'F':
            # uncompressed SWF
            decompressData = in_data[8:]

        header = list(struct.unpack("<8B", in_data[0:8]))
        header[0] = ord('F')
        return True, struct.pack("<8B", *header) + decompressData

    except Exception as e:
        traceback.print_exc()
        return False, "Decompression error" 
开发者ID:Neo23x0,项目名称:Loki,代码行数:23,代码来源:helpers.py

示例3: decrypt_rules

# 需要导入模块: import pylzma [as 别名]
# 或者: from pylzma import decompress [as 别名]
def decrypt_rules(file_package):
    privkey = import_RSA_key("%s.key" % file_package)
    rsa_cipher = get_cipher_RSA_PKCS1_OAEP(privkey)
    with open(file_package, "rb") as f:
        encrypted_data = f.read()

    aeskey = decrypt(encrypted_data[:RSA_MOD_SIZE], rsa_cipher)
    aes_iv = encrypted_data[RSA_MOD_SIZE:RSA_MOD_SIZE + AES.block_size]

    aes_cipher = get_cipher_AES(aeskey, aes_iv)
    decrypted_rules_compressed = decrypt(encrypted_data[RSA_MOD_SIZE + AES.block_size:], aes_cipher)
    decrypted_rules = decompress(decrypted_rules_compressed)

    buffer = io.BytesIO(decrypted_rules)
    rules = yara.load(file=buffer)
    return rules 
开发者ID:Neo23x0,项目名称:Loki,代码行数:18,代码来源:privrules.py

示例4: _read_from_decompressor

# 需要导入模块: import pylzma [as 别名]
# 或者: from pylzma import decompress [as 别名]
def _read_from_decompressor(self, coder, decompressor, input, checkremaining=False):
        data = ''
        idx = 0
        cnt = 0
        self._file.seek(self._src_start)
        properties = coder.get('properties', None)
        if properties:
            decompressor.decompress(properties)
        total = self.compressed
        if not input and total is None:
            remaining = self._start+self.size
            out = StringIO()
            while remaining > 0:
                data = self._file.read(READ_BLOCKSIZE)
                if checkremaining:
                    tmp = decompressor.decompress(data, remaining)
                else:
                    tmp = decompressor.decompress(data)
                out.write(tmp)
                remaining -= len(tmp)
            
            data = out.getvalue()
        else:
            if not input:
                input = self._file.read(total)
            if checkremaining:
                data = decompressor.decompress(input, self._start+self.size)
            else:
                data = decompressor.decompress(input)
        return data[self._start:self._start+self.size] 
开发者ID:maloep,项目名称:romcollectionbrowser,代码行数:32,代码来源:py7zlib.py

示例5: _read_from_decompressor

# 需要导入模块: import pylzma [as 别名]
# 或者: from pylzma import decompress [as 别名]
def _read_from_decompressor(self, coder, decompressor, checkremaining=False):
        data = ''
        idx = 0
        cnt = 0
        self._file.seek(self._src_start)
        properties = coder.get('properties', None)
        if properties:
            decompressor.decompress(properties)
        total = self.compressed
        if total is None:
            remaining = self._start+self.size
            out = StringIO()
            while remaining > 0:
                data = self._file.read(1024)
                if checkremaining:
                    tmp = decompressor.decompress(data, remaining)
                else:
                    tmp = decompressor.decompress(data)
                out.write(tmp)
                remaining -= len(tmp)
            
            data = out.getvalue()
        else:
            if checkremaining:
                data = decompressor.decompress(self._file.read(total), self._start+self.size)
            else:
                data = decompressor.decompress(self._file.read(total))
        return data[self._start:self._start+self.size] 
开发者ID:maloep,项目名称:romcollectionbrowser,代码行数:30,代码来源:py7zlib.py

示例6: run

# 需要导入模块: import pylzma [as 别名]
# 或者: from pylzma import decompress [as 别名]
def run(self):

        super(SWF, self).run()
        if self.args is None:
            return

        if not __sessions__.is_set():
            self.log('error', "No session opened")
            return

        arg_dump = self.args.dump
        if arg_dump is None:
            arg_dump = tempfile.gettempdir()
        self.decompress(arg_dump) 
开发者ID:opensourcesec,项目名称:CIRTKit,代码行数:16,代码来源:swf.py

示例7: decompress

# 需要导入模块: import pylzma [as 别名]
# 或者: from pylzma import decompress [as 别名]
def decompress(data):
    return lzma.decompress(data) 
开发者ID:Neo23x0,项目名称:Loki,代码行数:4,代码来源:privrules.py

示例8: EXTRACT_SWF

# 需要导入模块: import pylzma [as 别名]
# 或者: from pylzma import decompress [as 别名]
def EXTRACT_SWF(s, buff):

   SWF = {}

   magic = buff[:3]
   data = ''

   if magic == 'CWS':
      SWF['Buffer'] = 'FWS' + buff[3:8] + zlib.decompress(buff[8:])
   elif magic == 'ZWS':
      SWF['Buffer'] = 'FWS' + buff[3:8] + pylzma.decompress(buff[12:])
   elif magic == 'FWS':
      SWF['Version'] = ord(buff[3])

   return SWF 
开发者ID:EmersonElectricCo,项目名称:fsf,代码行数:17,代码来源:EXTRACT_SWF.py

示例9: _decompressSWF

# 需要导入模块: import pylzma [as 别名]
# 或者: from pylzma import decompress [as 别名]
def _decompressSWF(f, swf_size):
        magic = f.read(3)
        if magic == "CWS":
            try:
                header = "FWS" + f.read(5)
                data = zlib.decompress(f.read())[:swf_size-8]
                return header + data 
            except (QuitScanException, GlobalScanTimeoutError, GlobalModuleTimeoutError):
                raise
            except Exception:
                return "ERROR"
            finally:
                logging.debug("extract_swf - closing stringio handle in decompress")
                f.close()
        elif magic == "ZWS":
            try:
                header = "FWS" + f.read(5)
                f.seek(12)
                data = pylzma.decompress(f.read())[:swf_size-8]
                return header + data
            except (QuitScanException, GlobalScanTimeoutError, GlobalModuleTimeoutError):
                raise
            except Exception:
                return "ERROR"
            finally:
                logging.debug("extract_swf - closing stringio handle in decompress")
                f.close()
        else:
            return None 
开发者ID:lmco,项目名称:laikaboss,代码行数:31,代码来源:explode_swf.py


注:本文中的pylzma.decompress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。