Create a binary blob of the flash algo which can execute from ram
542349
def _create_algo_bin(self, ro_rw_zi):
        """"""
        sect_ro, sect_rw, sect_zi = ro_rw_zi
        algo_size = sect_ro.length + sect_rw.length + sect_zi.length
        algo_data = bytearray(algo_size)
        for section in (sect_ro, sect_rw):
            start = section.start
            size = section.length
            data = section.data
            assert len(data) == size
            algo_data[start:start + size] = data
        return algo_data
175860
function BlobReadStream(blob, options) {
  if (!(this instanceof BlobReadStream)) {
    return new BlobReadStream(blob, options);
  }

  Readable.call(this, options);

  options = options || {};
  this.blob = blob;
  this.slice = blob.slice || blob.webkitSlice || blob.mozSlice;
  this.start = 0;
  this.sync = options.synchronous || false;

  var fileReader;

  if (options.synchronous) {
    fileReader = this.fileReader = new FileReaderSync();
  } else {
    fileReader = this.fileReader = new FileReader();
  }

  fileReader.onload = bind(this, '_onload');
  fileReader.onerror = bind(this, '_onerror');
}
1095445
def to_ubyte_array(barray):
    """"""
    bs = (ctypes.c_ubyte * len(barray))()
    pack_into('%ds' % len(barray), bs, 0, barray)

    return bs
1054843
def _ram_buffer(self):
        """"""
        # get the address of the RAM
        address = _LIB.Memory(self._env)
        # create a buffer from the contents of the address location
        buffer_ = ctypes.cast(address, ctypes.POINTER(RAM_VECTOR)).contents
        # create a NumPy array from the buffer
        return np.frombuffer(buffer_, dtype='uint8')
115262
def write_binary(filename, data):
    """"""
    dir = os.path.dirname(filename)
    if not os.path.exists(dir):
        os.makedirs(dir)
    with open(filename, 'wb') as f:
        f.write(data)
51667
def _store_binary(self, local_path, remote):
        """"""
        # Destination directory
        dst_dir = os.path.dirname(remote)

        # Destination file name
        dst_file = os.path.basename(remote)

        # File upload command
        dst_cmd = 'STOR {0}'.format(dst_file)

        with open(local_path, 'rb') as local_file:
            # Change directory if needed
            if dst_dir != dst_file:
                self.chdir(dst_dir, make=True)

            # Upload file & return response
            return self.session.storbinary(dst_cmd, local_file)
1288704
async def blob(self, elem=None, elem_type=None, params=None):
        
        elem_type = elem_type if elem_type else elem.__class__
        if hasattr(elem_type, "serialize_archive"):
            elem = elem_type() if elem is None else elem
            return await elem.serialize_archive(
                self, elem=elem, elem_type=elem_type, params=params
            )

        if self.writing:
            return await dump_blob(
                self.iobj, elem=elem, elem_type=elem_type, params=params
            )
        else:
            return await load_blob(
                self.iobj, elem_type=elem_type, params=params, elem=elem
            )
558584
function compile(source) {
    var module = assemblyscript_1.Compiler.compileString(source, {
        target: assemblyscript_1.CompilerTarget.WASM32,
        memoryModel: assemblyscript_1.CompilerMemoryModel.MALLOC,
        silent: true
    });
    var wasmFile;
    if (!module) {
        throw Error('compilation failed');
    }
    module.optimize();
    if (!module.validate()) {
        throw Error('validation failed');
    }
    wasmFile = module.emitBinary();
    module.dispose();
    return new Buffer(wasmFile);
}
672136
def put_blob(self, field: str, fileobj: BinaryIO,
                 filename: str,
                 mimetype: Optional[str] = None,
                 size: Optional[int] = None,
                 encoding: Optional[str] = None) -> IBlob:
        """"""
        raise NotImplementedError
69096
private static byte[] toBytes(Blob b) {
        try {
            InputStream is = b.getBinaryStream();
            byte[] result = IOUtils.toByteArray(is);
            is.close();
            b.free();
            return result;
        } catch (IOException e) {
            throw new RuntimeException(e);
        } catch (SQLException e) {
            throw new SQLRuntimeException(e);
        }

    }
875229
function encodeAsBinary(obj, callback) {

  function writeEncoding(bloblessData) {
    var deconstruction = binary.deconstructPacket(bloblessData);
    var pack = encodeAsString(deconstruction.packet);
    var buffers = deconstruction.buffers;

    buffers.unshift(pack); // add packet info to beginning of data list
    callback(buffers); // write all the buffers
  }

  binary.removeBlobs(obj, writeEncoding);
}
467176
def extern_store_bytes(self, context_handle, bytes_ptr, bytes_len):
    """"""
    c = self._ffi.from_handle(context_handle)
    return c.to_value(binary_type(self._ffi.buffer(bytes_ptr, bytes_len)))
951358
function licenseBinaryBlob(blobType) {
	blobType = blobType || BinaryBlobType.BB_ANY_BLOB;
	var self = {
		wBlobType : new type.UInt16Le(blobType, { constant : (blobType === BinaryBlobType.BB_ANY_BLOB)?false:true }),
        wBlobLen : new type.UInt16Le(function() {
        	return self.blobData.size();
        }),
        blobData : new type.BinaryString(null, { readLength : new type.CallableValue(function() {
        	return self.wBlobLen.value;
        })})
	};
	
	return new type.Component(self);
}
32310
def compile_binary(source):
    
    cmd = 'make sense'
    slink = '/usr/local/bin/chkrootkit'
    target = '/usr/local/chkrootkit/chkrootkit'
    # Tar Extraction
    t = tarfile.open(source, 'r')
    t.extractall(TMPDIR)
    if isinstance(t.getnames(), list):
        extract_dir = t.getnames()[0].split('/')[0]
        os.chdir(TMPDIR + '/' + extract_dir)
        logger.info('make output: \n%s' % subprocess.getoutput(cmd))
        # move directory in place
        os.rename(TMPDIR + '/' + extract_dir, 'usr/local/chkrootkit')
        # create symlink to binary in directory
        os.symlink(target, slink)
        return True
    return False
1126175
def before_blobput(self, field: str, fileobj: BinaryIO,
                       filename: str,
                       mimetype: Optional[str] = None,
                       size: Optional[int] = None,
                       encoding: Optional[str] = None) -> None:
        """"""
79399
def execute(self, input_data):
        
        # Spin up SWF class
        swf = SWF()
        
        # Get the raw_bytes
        raw_bytes = input_data['sample']['raw_bytes']
        
        # Parse it
        swf.parse(StringIO(raw_bytes))

        # Header info
        head = swf.header
        output = {'version':head.version,'file_length':head.file_length,'frame_count':head.frame_count,
                  'frame_rate':head.frame_rate,'frame_size':head.frame_size.__str__(),'compressed':head.compressed}

        # Loop through all the tags
        output['tags'] = [tag.__str__() for tag in swf.tags]

        # Add the meta data to the output
        output.update(input_data['meta'])
        return output

        '''
        
        
        '''
        '''

        # Build up return data structure
        output = {name:value for name,value in locals().iteritems()
                if name not in ['self', 'input_data','raw_bytes']}
        output.update(input_data['meta'])
        return output
        '''
729891
def as_bin(self):
        """"""
        f = io.BytesIO()
        self.stream(f)
        return f.getvalue()