Mini Shell

Direktori : /usr/share/i360-php/python-proto/
Upload File :
Current File : //usr/share/i360-php/python-proto/message_reader.py

import io
import struct
import sendmessage_pb2
import subprocess

def readDataFromStream(stream_data):
  proto_size_rd = stream_data.read(2)
  if len(proto_size_rd)==0:
    return ""
  proto_size, = struct.unpack('>H', proto_size_rd)
  data = stream_data.read(proto_size)
  item = sendmessage_pb2.SendInfo()
  item.ParseFromString(data)
  return item

def fillDictionary():
  php_dict = {}
  counter = 0
  proc = subprocess.Popen(['dict_util_string'],stdout=subprocess.PIPE)
  while True:
    line = proc.stdout.readline()
    if line != '':
      if counter>1:
        res = line.rstrip().split()
        if len(res)>1:
          php_dict[res[0]]=res[1].rstrip()
    else:
      break
    counter=counter+1
  return php_dict


Zerion Mini Shell 1.0