示例#1
0
def process():
    code = request.args['code']
    access_token = request_tokens(code=code,
                                  redirect_uri=REDIRECT_URI,
                                  client_id=client_id,
                                  client_secret=client_secret)
    client = SpotifyClientAPI(client_id=client_id,
                              client_secret=client_secret,
                              access_token=access_token)
    script.script(client=client, playlist_uri=authorization.playlist_uri)
    return redirect('/success')
def packResIntoApk(SDKWorkDir, SDK, decompileDir, packageName, usrSDKConfig):
    SDKDir = SDKWorkDir + SDK['SDKName']
    for child in SDK['operateLs']:
        if child['name'] == 'modifyManifest':
            modifyFrom = child['from']
            modifyTo = child['to']
            if modifyFrom == None and modifyTo == None:
                file_operate.printf(
                    'Operate error, Please check your config in funcellconfig.xml'
                )
                error_operate.error(100)
                return 1
            modifyFrom = None.path.join(SDKDir, modifyFrom)
            modifyTo = os.path.join(decompileDir, modifyTo)
            modifyFrom = file_operate.getFullPath(modifyFrom)
            modifyTo = file_operate.getFullPath(modifyTo)
            modifyManifest.modify(modifyTo, modifyFrom, SDK['SDKName'],
                                  usrSDKConfig)
            continue
        if child['name'] == 'copy':
            copyFrom = child['from']
            copyTo = child['to']
            if copyFrom == None and copyTo == None:
                file_operate.printf(
                    'Operate error, Please check your config in funcellconfig.xml'
                )
                error_operate.error(101)
                return 1
            copyFrom = None.path.join(SDKDir, copyFrom)
            copyFrom = file_operate.getFullPath(copyFrom)
            copyTo = os.path.join(decompileDir, copyTo)
            copyTo = file_operate.getFullPath(copyTo)
            copyResToApk(copyFrom, copyTo)
            if child['to'] == 'lib':
                armPath = os.path.join(copyFrom, 'armeabi')
                armv7To = os.path.join(copyTo, 'armeabi-v7a')
                if os.path.exists(armPath) and os.path.exists(armv7To):
                    copyResToApk(armPath, armv7To)

        if child['name'] == 'script':
            scriptPath = SDKDir + '/script.pyc'
            if os.path.exists(scriptPath):
                sys.path.append(SDKDir)
                import script
                script.script(SDK, decompileDir, packageName, usrSDKConfig)
                del sys.modules['script']
                sys.path.remove(SDKDir)

    return 0
示例#3
0
    def __init__(self, proxies={'http': 'http://127.0.0.1:8080',
        'https': 'http://127.0.0.1:8080'}):
        """
        Creates an instance of the ZAP api client.

        :Parameters:
           - `proxies`: dictionary of ZAP proxies to use.
           
        Note that all of the other classes in this directory are generated
        new ones will need to be manually added to this file
        """
        self.__proxies = proxies
        
        self.acsrf = acsrf(self)
        self.ajaxSpider = ajaxSpider(self)
        self.ascan = ascan(self)
        self.authentication = authentication(self)
        self.autoupdate = autoupdate(self)
        self.brk = brk(self)
        self.context = context(self)
        self.core = core(self)
        self.forcedUser = forcedUser(self)
        self.httpsessions = httpSessions(self)
        self.importLogFiles = importLogFiles(self)
        self.params = params(self)
        self.pnh = pnh(self)
        self.pscan = pscan(self)
        self.script = script(self)
        self.search = search(self)
        self.selenium = selenium(self)
        self.sessionManagement = sessionManagement(self)
        self.spider = spider(self)
        self.users = users(self)
示例#4
0
    def __init__(self, byte_array):
        self.common_util = common_util
        # self.original_byte_array = byte_array

        offset = 0
        self.previous_output_hash, offset = self.common_util.slicing_and_get_offset(
            byte_array, offset, 32)

        # coin base 체크
        self.previous_output_hash_index, offset = self.common_util.slicing_and_get_offset(
            byte_array, offset, 4)
        self.script_size, script_byte_size = self.common_util.get_compact_size(
            self.common_util.slicing(byte_array, offset, 9))

        offset = offset + script_byte_size

        self.script, offset = self.common_util.slicing_and_get_offset(
            byte_array, offset, self.script_size)
        self.sequence, offset = self.common_util.slicing_and_get_offset(
            byte_array, offset, 4)

        self.offset = offset
        self.isCoinbase = self.check_coinbase(self.previous_output_hash)

        self.parsed_script = script(self.script)

        self.segwit = []
示例#5
0
    def register(self, name, version, desc, script_class):
        if (name.lower(), version) in self._scripts:
            print("Script already present!")
            return False

        self._scripts[(name.lower(), version)] = script(name, version, desc, script_class)
        return True
示例#6
0
def compile(filename):
    """
    Compile a .bt file into a script.

    """
    f = open(filename,'r')
    raw_string = f.read().replace('\n',' ')
    raw_list = [x for x in raw_string.split(' ') if x != '']
    parsed_list = []
    for item in raw_list:
        if len(item) > 1 and item[:2] == 'OP':
            try:
                parsed_list.append(ops.word[item])
            except KeyError:
                print "Unrecognized op %s" % (item,)
                return
        else:
            parsed_list.append(bytestream.bytestream(item))
    stream = bytestream.bytestream('')
    for parsed_item in parsed_list:
        if(isinstance(parsed_item, ops.op)):
            stream += parsed_item.stream()
        else:
            stream += parsed_item
    return script.script(stream)
示例#7
0
    def __init__(self, proxies={'http': 'http://127.0.0.1:8080',
        'https': 'http://127.0.0.1:8080'}):
        """
        Creates an instance of the ZAP api client.

        :Parameters:
           - `proxies`: dictionary of ZAP proxies to use.
           
        Note that all of the other classes in this directory are generated
        new ones will need to be manually added to this file
        """
        self.__proxies = proxies
        
        self.acsrf = acsrf(self)
        self.ajaxSpider = ajaxSpider(self)
        self.ascan = ascan(self)
        self.authentication = authentication(self)
        self.autoupdate = autoupdate(self)
        self.brk = brk(self)
        self.context = context(self)
        self.core = core(self)
        self.forcedUser = forcedUser(self)
        self.httpsessions = httpSessions(self)
        self.importLogFiles = importLogFiles(self)
        self.params = params(self)
        self.pnh = pnh(self)
        self.pscan = pscan(self)
        self.script = script(self)
        self.search = search(self)
        self.selenium = selenium(self)
        self.sessionManagement = sessionManagement(self)
        self.spider = spider(self)
        self.users = users(self)
示例#8
0
文件: opfns.py 项目: marchon/bitrans
def checksig(stream, machine, transaction, index, subscript):
    """
    For details, please see https://en.bitcoin.it/wiki/OP_CHECKSIG.
    """
    
    # How it works
    # Firstly always this (the default) procedure is
    # applied: Signature verification process of the default procedure
    # the public key and the signature are popped from the stack, in
    # that order. If the hash-type value is 0, then it is replaced by
    # the last_byte of the signature. Then the last byte of the
    # signature is always deleted.
    pubkey = machine.pop()
    sig = machine.pop()
    #sig.stream = sig.stream[:-2]  # this is actually done later
    
    # A new subscript is created from the instruction from the most
    # recently parsed OP_CODESEPARATOR (last one in script) to the end
    # of the script. If there is no OP_CODESEPARATOR the entire script
    # becomes the subscript (hereby referred to as subScript)
    #  not implemented yet (james)

    # The sig is deleted from subScript.
    #  note: this is nonstandard so I am ignoring it (james)
    
    # All OP_CODESEPARATORS are removed from subScript
    #  not implemented yet (james)

    # The hashtype is removed from the last byte of the sig and stored (as 4 bytes)
    hashtype = bytestream.fromunsigned(bytestream.bytestream(sig.stream[-2:]).unsigned(),4)
    sig.stream = sig.string()[:-2]
    
    # A copy is made of the current transaction (hereby referred to txCopy)
    txCopy = copy.deepcopy(transaction)
    
    # The scripts for all transaction inputs in txCopy are set to empty scripts (exactly 1 byte 0x00)
    for i in xrange(txCopy.tx_in_count):
        txCopy.tx_in[i].script_length = 0
        txCopy.tx_in[i].script = script.script(bytestream.fromunsigned(0,1))
    
    # The script for the current transaction input in txCopy is set to subScript (lead in by its length as a var-integer encoded!)
    txCopy.tx_in[index-1].script_length = len(subscript)
    txCopy.tx_in[index-1].script = subscript
    
    # Serialize txCopy and append hashtype
    serial = txCopy.encode() + hashtype

    # hash twice with sha256
    msg = ((hashlib.sha256(hashlib.sha256(serial.decode()).digest()).digest()))# [::-1]).encode('hex_codec')

    # verify via ecdsa
    key = btct.decompress(pubkey.stream)
    vk = ecdsa.VerifyingKey.from_string(key[2:].decode('hex'), curve=ecdsa.SECP256k1)
    try:
        vk.verify_digest(sig.decode(), msg, sigdecode=ecdsa.util.sigdecode_der)
        machine.push(bytestream.fromunsigned(1,1))
    except ecdsa.BadSignatureError:
        machine.push(bytestream.fromunsigned(0,1))
示例#9
0
    def __str__(self):
        """Build and return a string representing tx output data."""
        script_pk = script(self.script_pk)

        return (
            '\nValue:\t' + str(self.value) +
            '\nPK Script Bytes:\t' + str(self.script_pk_bytes) +
            # '\nPKScript:\t' + self.script_pk.encode('hex')
            '\nScriptPubKey:\t' + str(script_pk)
        )
示例#10
0
    def __init__(self, stream):
        self.prev_hash = str(stream.read(32).reverse().stream)
        self.index = stream.read(4).unsigned()
        self.script_length = stream.readvarlensize()
        self.script = script.script(stream.read(self.script_length))
        self.sequence = stream.read(4).unsigned()

        if int(self.prev_hash, 16) == 0:
            self.is_coinbase = True
        else:
            self.is_coinbase = False
示例#11
0
 def __init__(self, *args):
     if len(args) == 0:
         self.value = 0
         self.script_length = 0
         self.script = None
     elif len(args) == 1:
         stream = args[0]
         self.value         = stream.read(8).unsigned()
         self.script_length = stream.readvarlensize()
         self.script        = script.script(stream.read(self.script_length))
     else:
         raise ValueError("Zero or one args")
示例#12
0
 def __init__(self,
              prev_tx,
              prev_index,
              script_sig=None,
              sequence=0xffffffff):
     self.prev_tx = prev_tx
     self.prev_index = prev_index
     if script_sig is None:
         self.script_sig = script()
     else:
         self.script_sig = script_sig
     self.sequence = sequence
示例#13
0
 def run_script(self):
     model = self.ui.listView.model()
     for file in self.fileDialog.selectedFiles():
         self.set_filesize(file)
         self.set_file_open_action(file)
         model.appendRow(QStandardItem('Файл {} был обработан {}:'
                                       .format(shorten(25, 25, file),
                                               get_time_now())))
         model.appendRow(QStandardItem(''))
         for s in script(file):
             model.appendRow(QStandardItem(s))
         model.appendRow(QStandardItem(''))
示例#14
0
 def __init__(self, *args):
     if len(args) == 0:
         self.value = 0
         self.script_length = 0
         self.script = None
     elif len(args) == 1:
         stream = args[0]
         self.value = stream.read(8).unsigned()
         self.script_length = stream.readvarlensize()
         self.script = script.script(stream.read(self.script_length))
     else:
         raise ValueError("Zero or one args")
示例#15
0
    def __init__(self, byte_array):
        # self.original_byte = byte_array
        self.common_util = common_util
        offset = 0
        self.value, offset = self.common_util.slicing_and_get_offset(
            byte_array, offset, 8)
        self.byte_size, byte_offset = self.common_util.get_compact_size(
            self.common_util.slicing(byte_array, offset, 9))
        offset = offset + byte_offset
        self.script, offset = self.common_util.slicing_and_get_offset(
            byte_array, offset, self.byte_size)
        self.offset = offset
        self.parsed_script = script(self.script)

        # type의 종류
        """
示例#16
0
    def __init__(self, proxies=None, apikey=None):
        """
        Creates an instance of the ZAP api client.

        :Parameters:
           - `proxies`: dictionary of ZAP proxies to use.

        Note that all of the other classes in this directory are generated
        new ones will need to be manually added to this file
        """
        self.__proxies = proxies or {
            'http': 'http://127.0.0.1:8080',
            'https': 'http://127.0.0.1:8080'
        }
        self.__apikey = apikey

        self.acsrf = acsrf(self)
        self.ajaxSpider = ajaxSpider(self)
        self.ascan = ascan(self)
        self.authentication = authentication(self)
        self.authorization = authorization(self)
        self.autoupdate = autoupdate(self)
        self.brk = brk(self)
        self.context = context(self)
        self.core = core(self)
        self.forcedUser = forcedUser(self)
        self.httpsessions = httpSessions(self)
        self.importLogFiles = importLogFiles(self)
        self.params = params(self)
        self.pnh = pnh(self)
        self.pscan = pscan(self)
        self.reveal = reveal(self)
        self.script = script(self)
        self.search = search(self)
        self.selenium = selenium(self)
        self.sessionManagement = sessionManagement(self)
        self.spider = spider(self)
        self.stats = stats(self)
        self.users = users(self)

        # not very nice, but prevents warnings when accessing the ZAP API via https
        requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
示例#17
0
    def __init__(self, proxies=None, apikey=None):
        """
        Creates an instance of the ZAP api client.

        :Parameters:
           - `proxies`: dictionary of ZAP proxies to use.

        Note that all of the other classes in this directory are generated
        new ones will need to be manually added to this file
        """
        self.__proxies = proxies or {
            'http': 'http://127.0.0.1:8080',
            'https': 'http://127.0.0.1:8080'
        }
        self.__apikey = apikey

        self.acsrf = acsrf(self)
        self.ajaxSpider = ajaxSpider(self)
        self.ascan = ascan(self)
        self.authentication = authentication(self)
        self.authorization = authorization(self)
        self.autoupdate = autoupdate(self)
        self.brk = brk(self)
        self.context = context(self)
        self.core = core(self)
        self.forcedUser = forcedUser(self)
        self.httpsessions = httpSessions(self)
        self.importLogFiles = importLogFiles(self)
        self.params = params(self)
        self.pnh = pnh(self)
        self.pscan = pscan(self)
        self.reveal = reveal(self)
        self.script = script(self)
        self.search = search(self)
        self.selenium = selenium(self)
        self.sessionManagement = sessionManagement(self)
        self.spider = spider(self)
        self.stats = stats(self)
        self.users = users(self)

        # not very nice, but prevents warnings when accessing the ZAP API via https
        requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
示例#18
0
    def __init__(self, script_name, setting_name, n):
        DATA.logfilepath = 'controllerlog'
        with open(DATA.logfilepath, 'w') as fw:
            fw.write('start\n')
        self.script_name = script_name
        self.setting_name = setting_name
        self.script = script(script_name)
        self.workers_number = 0

        self.createSharedict()
        self.createLocks()
        self.createBarriers(n)
        self.createMonopoly()

        self.results = multiprocessing.Queue()

        self.s2c_io = multiprocessing.Queue()
        self.c2s_io = multiprocessing.Queue()

        self.stop = False
        self.workers = []
示例#19
0
def doSpecialOperate(channel, decompileDir, packageName, SDKWorkDir):
    """There are special operate in some SDK"""
    for Channel_SDK in channel['sdkLs']:
        idSDK = Channel_SDK['idSDK']
        SDK = ConfigParse.shareInstance().findSDK(idSDK)
        if SDK is None:
            continue
        usrSDKConfig = ConfigParse.shareInstance().findUserSDKConfigBySDK(
            idSDK, channel['idChannel'])
        SDKDir = SDKWorkDir + SDK['SDKName']
        scriptPath = SDKDir + '/' + 'script.pyc'
        if os.path.exists(scriptPath):
            sys.path.append(SDKDir)
            import script
            ret = script.script(SDK, decompileDir, packageName, usrSDKConfig)
            del sys.modules['script']
            sys.path.remove(SDKDir)
            if ret != None and ret == 1:
                return 1

    return 0
示例#20
0
 def __init__(self, *args):
     if len(args) == 0:
         self.prev_hash     = str(bytestream.fromunsigned(0,32))
         self.index         = 1
         self.script_length = 0
         self.script        = None
         self.sequence      = 0
         self.is_coinbase   = True
     elif len(args) == 1:
         stream = args[0]
         self.prev_hash     = str(stream.read(32).reverse().stream)
         self.index         = stream.read(4).unsigned()
         self.script_length = stream.readvarlensize()
         self.script        = script.script(stream.read(self.script_length))
         self.sequence      = stream.read(4).unsigned()
         
         if int(self.prev_hash,16) == 0:
             self.is_coinbase = True
         else:
             self.is_coinbase = False
     else:
         raise ValueError("Zero or one args")
示例#21
0
    def __init__(self, *args):
        if len(args) == 0:
            self.prev_hash = str(bytestream.fromunsigned(0, 32))
            self.index = 1
            self.script_length = 0
            self.script = None
            self.sequence = 0
            self.is_coinbase = True
        elif len(args) == 1:
            stream = args[0]
            self.prev_hash = str(stream.read(32).reverse().stream)
            self.index = stream.read(4).unsigned()
            self.script_length = stream.readvarlensize()
            self.script = script.script(stream.read(self.script_length))
            self.sequence = stream.read(4).unsigned()

            if int(self.prev_hash, 16) == 0:
                self.is_coinbase = True
            else:
                self.is_coinbase = False
        else:
            raise ValueError("Zero or one args")
示例#22
0
def script(obj):
    """
    Compile a .bs file into a script.

    """
    if instanceof(obj, str):
        f = open(filename, 'r')
        raw_string = f.read().replace('\n', ' ')
        f.close()
        raw_list = [x for x in raw_string.split(' ') if x != '']
    else:
        raw_list = obj
    parsed_list = []
    #for i in xrange(1,len(raw_list)):
    for item in raw_list:
        #item = raw_list[i]
        if len(item) > 1 and item[:2] == 'OP':
            try:
                parsed_list.append(ops.word[item])
            except KeyError:
                print "Unrecognized op %s" % (item, )
                return
        else:
            bstream = bytestream.bytestream(item)
            # add a pushing op if needed
            if (len(parsed_list) == 0 or
                ((isinstance(parsed_list[-1], ops.op) and
                  (parsed_list[-1].opcode < 1 or parsed_list[-1].opcode > 75))
                 or not isinstance(parsed_list[-1], ops.op))):
                parsed_list.append(ops.code[len(bstream)])
            parsed_list.append(bstream)

    stream = bytestream.bytestream('')
    for parsed_item in parsed_list:
        if (isinstance(parsed_item, ops.op)):
            stream += parsed_item.stream()
        else:
            stream += parsed_item
    return scr.script(stream)
示例#23
0
文件: compile.py 项目: jcatw/bitrans
def script(obj):
    """
    Compile a .bs file into a script.

    """
    if instanceof(obj,str):
        f = open(filename,'r')
        raw_string = f.read().replace('\n',' ')
        f.close()
        raw_list = [x for x in raw_string.split(' ') if x != '']
    else:
        raw_list = obj
    parsed_list = []
    #for i in xrange(1,len(raw_list)):
    for item in raw_list:
        #item = raw_list[i]
        if len(item) > 1 and item[:2] == 'OP':
            try:
                parsed_list.append(ops.word[item])
            except KeyError:
                print "Unrecognized op %s" % (item,)
                return
        else:
            bstream = bytestream.bytestream(item)
            # add a pushing op if needed
            if (len(parsed_list) == 0 or
                ((isinstance(parsed_list[-1], ops.op) and (parsed_list[-1].opcode < 1 or parsed_list[-1].opcode > 75)) or
                not isinstance(parsed_list[-1], ops.op))):
                parsed_list.append(ops.code[len(bstream)])
            parsed_list.append(bstream)

    stream = bytestream.bytestream('')
    for parsed_item in parsed_list:
        if(isinstance(parsed_item, ops.op)):
            stream += parsed_item.stream()
        else:
            stream += parsed_item
    return scr.script(stream)
示例#24
0
    def __init__(self, parser, controller):
	self.parser = parser
	parser.groupCreation()
	sc = script.script(controller)
	self.keypress_timeout = 40
示例#25
0
            if core.buffer.isEmpty():
                core.idle = True
                core.buffer.addJob(core.runningThread)
                core.checkBuffer(thread_list, event_list, sim_time)
            else:
                event_list.addEvent(
                    event_type=EventType.switch_context,
                    start_time=sim_time + CONTEXT_SWITCH_OVERHEAD,
                    event_attr={"core_id": event.attr["core_id"]})

        elif event.event_type == EventType.switch_context:
            # Invariant is that buffer is not empty
            core = core_handler.cores[event.attr["core_id"]]
            info_list.append(str("CONTEXT" + "\t" + str(core.id)))
            core.buffer.addJob(core.runningThread)
            core.runningThread = None
            core.idle = True
            core.checkBuffer(thread_list, event_list, sim_time)

result_file = sys.argv[2]

if len(sys.argv) == 4:
    if sys.argv[3] == "1":  # log file is needed
        f = open("output.log", 'w+')
        for item in info_list:
            f.write(item + "\n")

print("Main time", time.time() - t)
t = time.time()
script(info_list, STOPPING_CRITERION / 2, result_file)
print("Script time", time.time() - t)
import script
from tkinter import *
home = Tk()

up_frame = Frame(home, bg="black")
up_frame.grid()

req_data = script.script()

bottom_frame = Frame(home)
bottom_frame.grid(row=1)

click_me = Button(up_frame, text="Click to reveal", bg="black", fg="green")

my_canvas = Canvas(bottom_frame)
my_canvas.pack()

text_scroll = Scrollbar(my_canvas)
text_scroll.pack(side=RIGHT, fill=Y)

my_text = Text(my_canvas, yscrollcommand=text_scroll.set)
my_text.pack(side=LEFT, fill=X)

text_scroll.configure(command=my_text.yview, background="black")


def write(a):
    my_text.delete(1.0, END)
    my_text.insert(END, req_data)

示例#27
0
文件: worker.py 项目: Tayxyz/ACDC
    def run(self):
        try:
            DATA.start_time = t0 = time.time()

            DATA.id = self.id
            DATA.isn = self.isn
            if len(DATA.isn) == 0:
                DATA.isn = '1234567890123456'
            DATA.logfilepath = 'logforid' + str(self.id)
            with open(DATA.logfilepath, 'w') as fw:
                fw.write('START TEST:\n')
                fw.write(DATA.isn + '\n')

            DATA.csvfilepath = 'csvforid' + str(self.id)
            with open(DATA.csvfilepath, 'w') as fw:
                fw.write('')
            DATA.result_queue = self.result_queue
            DATA.s2c_io = self.s2c_io
            DATA.c2s_io = self.c2s_io
            DATA.locks = self.locks
            DATA.barriers = self.barriers

            DATA.script_name = self.share_dic['script_name']
            self.script = script(DATA.script_name)
            DATA.setting_name = self.setting_name = self.share_dic[
                'setting_name']
            DATA.read_setting()
            logV('load cost:', time.time() - t0)
            t0 = time.time()
            DATA.version = VERSION
            objs = {}
            for obj in self.script.get_initial():
                objs[obj["obj"]] = getObject(obj["class"], obj)
            logV('initial cost:', time.time() - t0)
            DATA.objs = objs
            process = self.script.get_process()
            steps = len(process)
            logV('process len=', steps)
            self.result_queue.put(str(self.id) + '&' + str(steps) + '&t&\1*')
            skip_flag = False
            for step in process:
                logV('\n#####', step['name'], '#####')
                if skip_flag:
                    canskip = True
                    try:
                        if step['noskip'] == 'YES':
                            canskip = False
                    except:
                        pass
                    if canskip:
                        print('skip')
                        self.result_queue.put(str(self.id) + '&p&\2*')
                        continue
                t00 = time.time()
                DATA.settime()
                obj = objs[step['obj']]
                rst = applyFuc(obj, step['action'], step)
                logV('\n-----', time.time() - t00, 's -----\n\n-')
                try:
                    if step['failstop'] == 'YES' and not DATA.currentpass:
                        skip_flag = True
                except:
                    pass
                try:
                    if step['anyfailstop'] == 'YES' and DATA.totalfails > 0:
                        skip_flag = True
                except:
                    pass

                self.result_queue.put(str(self.id) + '&p&\2*')

            # while True:
            #     time.sleep(1)
            #     self.result_queue.put(self.id)
            #     logV(time.time())

            return

        except Exception as e:
            logE(Exception, e)
            import traceback
            logE(traceback.print_exc())
            DATA.op('TEST_FAILURES,1,Exception,N/A,N/A')
        finally:
            DATA.end_content()
            logV('\nTotal cost:', time.time() - t0)
            DATA.end_process()
            self.result_queue.put(str(self.id) + '&h&\3*')
示例#28
0
 def run(self):
     #start_timer = time.time()
     script.script()
示例#29
0
from block import block
from script import script
from blockutil import pkhash2addr
from blockutil import pubkey2addr

blockfile = '/home/marzig76/.bitcoin/blocks/blk00004.dat'
blockstream = open(blockfile, 'rb')
b = block(blockstream)

for t in b.txs:

    for ti in t.tx_inputs:
        print 'in addr: ' + pubkey2addr(ti.sigscript)

    for to in t.tx_outputs:
        spk = to.script_pk.encode('hex')

        if spk[:6] == '76a914':
            print 'out addr: ' + pkhash2addr(spk[6:46])

        ss = str(script(to.script_pk))
        print 'script string: ' + ss
示例#30
0
def runscript():
    zipcode = request.args.get('zipcode')
    timeframe = request.args.get('timeframe')
    budget = request.args.get('budget')

    return jsonify(script(zipcode, timeframe, budget))
示例#31
0
        insert_txinput = (
            "INSERT INTO block_txinput " +
            "(prev_hash, `index`, script_bytes, sigscript, sequence, addr, tx_id)" +
            "VALUES " +
            "(?,?,?,?,?,?,?)"
        )
        c.execute(insert_txinput, (ti.prev_hash, ti.index, ti.script_bytes,
                                   ti.sigscript.encode('hex'), ti.sequence,
                                   addr, tx_id))
        conn.commit()

    # insert each tx_output
    for to in t.tx_outputs:
        spk = to.script_pk.encode('hex')

        if spk[:6] == '76a914':
            addr = pkhash2addr(spk[6:46])
        else:
            addr = ''

        insert_txoutput = (
            "INSERT INTO block_txoutput " +
            "(value, script_pk_bytes, script_pk, addr, script_pk_string, tx_id)" +
            "VALUES " +
            "(?,?,?,?,?,?)"
        )
        c.execute(insert_txoutput, (to.value, to.script_pk_bytes,
                                    spk, addr, str(script(to.script_pk)), tx_id))
        conn.commit()
示例#32
0
from block import block
from script import script

blockfile = '/home/marzig76/.bitcoin/blocks/blk00000.dat'

blockstream = open(blockfile, 'rb')

parsed_block = block(blockstream)
print parsed_block

# script examples
# orig              76a914fb96940932cc00274cf6ce423623e0cb0aa32ccf88ac
# 0x4c OP_PUSHDATA1 76a94c14fb96940932cc00274cf6ce423623e0cb0aa32ccf88ac
# 0x4d OP_PUSHDATA2 76a94d0100deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef88ac
# 0x4d OP_PUSHDATA2 76a94d0001ff88ac
# 0x4e OP_PUSHDATA4 76a94e00000001ff88ac
# 0x6a OP_RETURN    6a13636861726c6579206c6f766573206865696469
pk_script = script('6a13636861726c6579206c6f766573206865696469'.decode('hex'))
print pk_script
示例#33
0
from script import script

script()
示例#34
0
        red(saturation(gdata[0] >> shift))
        green(saturation(gdata[1] >> shift))
        blue(saturation(gdata[2] >> shift))
        frequency = new_frequency
        play(base_frequency + frequency, 2000)


if __name__ == "__main__":
    signal.signal(signal.SIGINT, sigint_hndlr)

    app = QtGui.QApplication(sys.argv)
    brick = trikControl.trikControl.BrickFactory.create(
        "/home/root/trik", "/home/root/trik/media/")
    gyroscope = brick.gyroscope()
    # gamepad = trikControl.trikNetwork.GamepadFactory.create(666)
    script = script()
    play = brick.playTone

    subprocess.call("echo 0 > /sys/class/misc/l3g42xxd/odr_selection",
                    shell=True)
    subprocess.call("echo 0 > /sys/class/misc/l3g42xxd/fs_selection",
                    shell=True)
    subprocess.call("rmmod mma845x", shell=True)

    play(100, 3000)

    QtCore.QObject.connect(
        gyroscope, QtCore.SIGNAL("newData(QVector<int>,trikKernel::TimeVal)"),
        update_gyro_data)

    main_timer = script.timer(20)
示例#35
0
 def __init__(self, janela, container):
     tk.Frame.__init__(self, container)
     self.nome = 'frame_principal'
     self.janela = janela
     self.script = script()
     self.macro_ativo = False
示例#36
0
# modify cfbundlename, cfbundleidentifier

# add framework, lib
addSystemFrameworks(project, 'MobileCoreServices.framework', True)
addUsrLib(project, 'libz.dylib', True)

# add files: aonesdk.json, uuSdkConfig.json

 if os.path.exists(SDKSrcDir + '/Codes'):
                        file_operate.copyFiles(SDKSrcDir + '/Codes', SDKDestDir + '/Codes')
                        addFolder(project, SDKDestDir + '/Codes')
                    scriptPath = SDKSrcDir + '/script.pyc'
                    if os.path.exists(scriptPath):
                        sys.path.append(SDKSrcDir)
                        import script
                        script.script(SDK, workDir, target_name, usrSDKConfig, SDKDestDir, project)
                        del sys.modules['script']
                        sys.path.remove(SDKSrcDir)
                    if os.path.exists(SDKSrcDir + '/Frameworks'):
                        addFolder(project, SDKSrcDir + '/Frameworks')
                    if os.path.exists(SDKSrcDir + '/Resources'):
                        addFolder(project, SDKSrcDir + '/Resources')
                    if os.path.exists(SDKSrcDir + '/References'):
                        for dir in os.listdir(SDKSrcDir + '/References'):
                            if os.path.isdir(SDKSrcDir + '/References/' + dir):
                                addFile(project, SDKSrcDir + '/References/' + dir)

                    xmlFile = SDKSrcDir + '/config.xml'
                    doc = minidom.parse(xmlFile)
                    rootNode = doc.documentElement
                    sysFrameworksList = rootNode.getElementsByTagName('sysFrameworks')
示例#37
0
 def __init__(self, stream):
     self.value = stream.read(8).unsigned()
     self.script_length = stream.readvarlensize()
     self.script = script.script(stream.read(self.script_length))
示例#38
0
    # insert each tx_input
    for ti in t.tx_inputs:
        scriptsig = scriptSig(ti.sigscript)
        addr = pubkey2addr(scriptsig.pubkey)

        insert_txinput = (
            "INSERT INTO block_txinput " +
            "(prev_hash, `index`, script_bytes, sigscript, sequence, addr, tx_id)"
            + "VALUES " + "(?,?,?,?,?,?,?)")
        c.execute(insert_txinput,
                  (ti.prev_hash, ti.index, ti.script_bytes,
                   ti.sigscript.encode('hex'), ti.sequence, addr, tx_id))
        conn.commit()

    # insert each tx_output
    for to in t.tx_outputs:
        spk = to.script_pk.encode('hex')

        if spk[:6] == '76a914':
            addr = pkhash2addr(spk[6:46])
        else:
            addr = ''

        insert_txoutput = (
            "INSERT INTO block_txoutput " +
            "(value, script_pk_bytes, script_pk, addr, script_pk_string, tx_id)"
            + "VALUES " + "(?,?,?,?,?,?)")
        c.execute(insert_txoutput, (to.value, to.script_pk_bytes, spk, addr,
                                    str(script(to.script_pk)), tx_id))
        conn.commit()
示例#39
0
import subprocess
from subprocess import Popen, PIPE
from script import script
from menu_incluir import menu_incluir
import os
import time

scripts_name=subprocess.run(['ls', 'scripts/'],shell=False, stdout=subprocess.PIPE)

scripts_name = scripts_name.stdout.decode('utf-8')

scripts = scripts_name.split()

# crea los objetos scrip
for sc in scripts:
    script(sc)

# da permisos de ejecucion

for sc in scripts:
    scripts_name=subprocess.run('cd scripts && sudo chmod +x '+sc ,shell=True, stdout=subprocess.PIPE)
    


# crea los objetos menu

inclu_menu = menu_incluir("incluir",script.scripts)

inclu_menu.print_sub_menu()

示例#40
0
def main(channel):
    idChannel = channel.get('idChannel')
    channelName = channel.get('name')
    channelNum = channel.get('channelNum')
    threading.currentThread().setName(idChannel)
    taskManager.shareInstance().notify(idChannel, 20)
    source = ConfigParse.shareInstance().getSource()
    basename = os.path.basename(source)
    exttuple = os.path.splitext(basename)
    basename = exttuple[0]
    extname = exttuple[1]
    originDir = ConfigParse.shareInstance().getProjFolder()
    useSDK = ConfigParse.shareInstance().getProjSDKVersion()
    systemSDKPath = ConfigParse.shareInstance().getProjSDKPath()
    ipaPackage = ConfigParse.shareInstance().getProjIpaPackage()
    game = ConfigParse.shareInstance().getCurrentGame()
    if channelName is None:
        error_operate.error(5)
        return
    versionName = ConfigParse.shareInstance().getVersionName()
    outputDir = ConfigParse.shareInstance().getOutputDir()
    if outputDir == '':
        outputDir = '../'
    #cocos2dx need cocos2dx framework,so we must put release pdroject to cocos2dx dictionary
    #outputDir += '/' + game['gameName'] + '/' + versionName + '/' + channel['name']
    outputDir += '/' + channel['name'] + '_' + versionName

    outputDir = file_operate.getFullPath(outputDir)
    outputDir = os.path.realpath(outputDir)
    file_operate.delete_file_folder(outputDir)
    #workDir = outputDir + '/Project_iOS'
    workDir = outputDir
    workDir = file_operate.getFullPath(workDir)
    workDir = os.path.realpath(workDir)
    file_operate.delete_file_folder(workDir)
    iconDir = '../workspace/icon/' + channelNum
    iconDir = file_operate.getFullPath(iconDir)
    iconDir = os.path.realpath(iconDir)
    if not os.path.exists(outputDir):
        os.makedirs(outputDir)
    if not os.path.exists(workDir):
        os.makedirs(workDir)
    file_operate.copyFiles(originDir, workDir)
    pbxFile = workDir + '/' + ConfigParse.shareInstance().getProjXcode(
    ) + '/project.pbxproj'
    target_name = None
    project = XcodeProject.Load(pbxFile)
    #从congfig.py里的getTargetName取到要编译打包的target,没有的话用默认的最后一个target
    if ConfigParse.shareInstance().getTargetName():
        target_name = project_name = ConfigParse.shareInstance().getTargetName(
        )
        print '----config ---- target name ----' + target_name
#        print 'ERROR_>'+target_name+'<_ERROR'
#        print 'WARNING_>'+target_name+'<_WARNING'
    else:
        target_name = project_name = project.get_target_name()

    project_config = project.get_configurations()
    #use release archieve ipa
    project_config = 'Release'
    project.add_other_ldflags('-ObjC')
    project.showSearchPathInfo()
    """add other flag param"""
    #project.add_other_ldflags('-lz')

    if project.modified:
        project.save()
    taskManager.shareInstance().notify(idChannel, 40)
    parentDir = ''
    for parent, dirnames, filenames in os.walk(workDir):
        for filename in filenames:
            if filename == 'Contents.json':
                if parent.find('Images.xcassets/AppIcon.appiconset') != -1:
                    parentDir = parent

    if parentDir != '':
        for parent, dirnames, filenames in os.walk(parentDir):
            for filename in filenames:
                if filename != 'Contents.json':
                    os.remove(parentDir + '/' + filename)

        jsonFile = open(parentDir + '/Contents.json')
        jsonContent = json.load(jsonFile)
        for child in jsonContent['images']:
            imgSize = int(child['size'][0:child['size'].find('x')]) * int(
                child['scale'][0:child['scale'].find('x')])
            imgName = 'Icon-' + str(imgSize) + '.png'
            if os.path.exists(iconDir + '/' +
                              imgName) and not os.path.exists(parentDir + '/' +
                                                              imgName):
                file_operate.copyFile(iconDir + '/' + imgName,
                                      parentDir + '/' + imgName)
            child['filename'] = imgName

        jsonContent = json.dumps(jsonContent)
        jsonFile.close()
        jsonFile = open(parentDir + '/Contents.json', 'w')
        try:
            jsonFile.write(jsonContent)
        finally:
            jsonFile.close()

    project_infoplist = workDir + '/' + ConfigParse.shareInstance(
    ).getProjXcode() + '/../' + project.get_infoplistfile()
    newAppName = ''
    if game.get(
            'isModifyiOSName') is not None and game['isModifyiOSName'] == True:
        newAppName = ConfigParse.shareInstance().getIosName()
        if newAppName is None or newAppName == '':
            newAppName = game.get('gameName')
    #set display name by channel
    if channel['display_name'] != '':
        newAppName = channel['display_name']

    customBundleId = channel['r_bundle_id']
    if os.path.exists(project_infoplist) and (
            newAppName != '' or channel['packNameSuffix'] != ''
            or channel['r_gameversion'] != ''
            or channel['r_gameversion_build'] != '' or customBundleId != ''):
        plistModify = False
        try:
            plist = readPlist(project_infoplist)
            for key in plist:
                if key == 'CFBundleName' and newAppName != '':
                    plist['CFBundleName'] = newAppName
                    plistModify = True
                elif key == 'CFBundleIdentifier':
                    if customBundleId == '':
                        plist['CFBundleIdentifier'] = plist[
                            'CFBundleIdentifier'] + channel['packNameSuffix']
                    else:
                        plist['CFBundleIdentifier'] = customBundleId
                    plistModify = True
                elif key == 'CFBundleShortVersionString' and channel[
                        'r_gameversion'] != '':
                    plist['CFBundleShortVersionString'] = channel[
                        'r_gameversion']
                    plistModify = True
                elif key == 'CFBundleVersion' and channel[
                        'r_gameversion_build'] != '':
                    plist['CFBundleVersion'] = channel['r_gameversion_build']
                    plistModify = True

            if plistModify == True:
                try:
                    writePlist(plist, project_infoplist)
                    project.modify_bundle_identifier(
                        plist['CFBundleIdentifier'])
                    project.save()
                except Exception as e:
                    print 'modify bundle Id/bundle Name Error:' + e

        except:
            print 'No Plist found'

    writeChannelInfoIntoDevelopInfo(workDir, channel, game)
    writeSupportInfo(workDir)
    SDKWorkDir = workDir + '/sdk/'
    list = [0, 2, 1, 3, 4, 5, 6]
    for count in range(len(list)):
        for Channel_SDK in channel['sdkLs']:
            idSDK = Channel_SDK['idSDK']
            usrSDKConfig = ConfigParse.shareInstance().findUserSDKConfigBySDK(
                idSDK, channel['idChannel'])
            SDK = ConfigParse.shareInstance().findSDK(idSDK)
            if SDK == None:
                continue
            for plugin in SDK['pluginLs']:
                type = plugin['typePlugin']
                if type == list[count]:
                    SDKSrcDir = '../config/sdk/' + SDK['SDKName']
                    SDKSrcDir = file_operate.getFullPath(SDKSrcDir)
                    SDKDestDir = SDKWorkDir + SDK['SDKName']
                    SDKDestDir = os.path.realpath(SDKDestDir)
                    if os.path.exists(SDKDestDir):
                        continue
                    file_operate.copyFiles(SDKSrcDir, SDKDestDir)
                    lib_path = 'sdk/' + SDK['SDKName'] + '/'
                    project = XcodeProject.Load(pbxFile)
                    scriptPath = SDKDestDir + '/script.pyc'
                    if os.path.exists(scriptPath):
                        sys.path.append(SDKDestDir)
                        import script
                        script.script(SDK, workDir, target_name, usrSDKConfig,
                                      SDKDestDir, project)
                        del sys.modules['script']
                        sys.path.remove(SDKDestDir)
                    if os.path.exists(SDKDestDir + '/Frameworks'):
                        addFrameworkGroupPath(SDKDestDir + '/Frameworks',
                                              target_name, project)

                    if os.path.exists(SDKDestDir + '/Resources'):
                        for res in os.listdir(SDKDestDir + '/Resources'):
                            project.add_file(SDKDestDir + '/Resources/' + res,
                                             None, 'SOURCE_ROOT', True, False,
                                             False, target_name)

                    if os.path.exists(SDKDestDir + '/Codes'):
                        for codes in os.listdir(SDKDestDir + '/Codes'):
                            project.add_file(SDKDestDir + '/Codes/' + codes,
                                             None, 'SOURCE_ROOT', True, False,
                                             False, target_name)

                    if project.modified:
                        project.save()
                    xmlFile = SDKDestDir + '/config.xml'
                    doc = minidom.parse(xmlFile)
                    rootNode = doc.documentElement
                    sysFrameworksList = rootNode.getElementsByTagName(
                        'sysFrameworks')
                    for sysFrameworksNode in sysFrameworksList:
                        path = ''
                        required = False
                        if sysFrameworksNode.getAttribute('required') == '0':
                            required = True
                        if sysFrameworksNode.getAttribute(
                                'path') == 'xcodeFrameworks':
                            path = systemSDKPath + '/System/Library/Frameworks/' + sysFrameworksNode.getAttribute(
                                'name')
                        elif sysFrameworksNode.getAttribute(
                                'path') == 'xcodeUsrlib':
                            path = systemSDKPath + '/usr/lib/'
                            frameworkName = sysFrameworksNode.getAttribute(
                                'name')
                            #if ios 9 and above,replace .dylib to .tbd
                            if isIOS9(systemSDKPath):
                                print 'use ios 9 sdk for' + sysFrameworksNode.getAttribute(
                                    'name')
                                path = path + frameworkName.replace(
                                    '.dylib', '.tbd')
                            else:
                                path = path + frameworkName
                                print 'donot use ios 9 sdk'
                        else:
                            path = sysFrameworksNode.getAttribute(
                                'path') + sysFrameworksNode.getAttribute(
                                    'name')
                        ret = project.add_file_if_doesnt_exist(
                            path, None, 'SOURCE_ROOT', True, required, False,
                            target_name)

                        if project.modified:
                            project.save()

                    for child in SDK['operateLs']:
                        if child['name'] == 'RemoveValidArchs_arm64':
                            project.modify_validarchs()
                            if project.modified:
                                project.save()

                    generateDeveloperInfo(channel, SDK, usrSDKConfig, workDir,
                                          game)
                    generatePluginInfo(SDK, usrSDKConfig, workDir)

    if os.path.exists(workDir + '/supportPlugin.xml'):
        encode_operate.xmlEncode(workDir + '/supportPlugin.xml')
        project.add_file(workDir + '/supportPlugin.xml', None, 'SOURCE_ROOT',
                         True, False, False, target_name)
        if project.modified:
            project.save()
    if os.path.exists(workDir + '/developerInfo.xml'):
        encode_operate.xmlEncode(workDir + '/developerInfo.xml')
        project.add_file(workDir + '/developerInfo.xml', None, 'SOURCE_ROOT',
                         True, False, False, target_name)
        if project.modified:
            project.save()
        taskManager.shareInstance().notify(idChannel, 70)
    if ipaPackage != 'True':
        taskManager.shareInstance().notify(idChannel, 100)
        return
    xcodeDir = workDir + '/' + ConfigParse.shareInstance().getProjXcode(
    ) + '/../'
    xcodeDir = os.path.realpath(xcodeDir)
    print 'XcodeDir ' + xcodeDir
    #change dictionary first,then run build command
    os.chdir(xcodeDir)
    mode = 0
    if useSDK.find('simulator') == -1:
        mode = 1
    cmd = None
    projectFileName = ConfigParse.shareInstance().getProjXcode().replace(
        '/', '')
    if mode == 0:
        cmd = 'xcodebuild ' + useSDK + ' -target ' + target_name + ' -arch i386 >xcodebuild.txt'
    else:
        #clean project and target
        cmd = 'xcodebuild clean ' + useSDK + ' -project ' + projectFileName + ' -target ' + target_name
        ret = file_operate.execFormatCmd(cmd)
        #don't build. use archieve
        cmd = 'xcodebuild ' + useSDK + ' -target ' + target_name + '>xcodebuild.txt'
        #cmd = 'xcodebuild archive -scheme ' + target_name + '  -target ' + target_name + ' -archivePath ' + target_name + '.xcarchive >xcodearchive.txt'

    ret = file_operate.execFormatCmd(cmd)
    buildFile = workDir + '/xcodebuild.txt'
    if not os.path.exists(buildFile):
        print 'file not exists'
    else:
        file_object = open(buildFile)
        try:
            buildText = file_object.read()
            print buildText.find('BUILD SUCCEEDED')
            if buildText.find('BUILD SUCCEEDED') < 0:
                print 'BUILD FAILED!'
                error_operate.error(200)
                return
        finally:
            file_object.close()

    # ret = file_operate.execFormatCmd(cmd)
    # buildFile = workDir + '/xcodearchive.txt'
    # if not os.path.exists(buildFile):
    #     print 'file not exists'
    # else:
    #     file_object = open(buildFile)
    #     try:
    #         buildText = file_object.read()
    #         print buildText.find('** ARCHIVE SUCCEEDED **')
    #         if buildText.find('** ARCHIVE SUCCEEDED **') < 0:
    #             print 'ARCHIVE FAILED!'
    #             error_operate.error(200)
    #             return
    #     finally:
    #         file_object.close()

    appDir = None
    if mode == 0:
        appDir = project_config + '-iphonesimulator/'
    else:
        appDir = project_config + '-iphoneos/'
    ipaName = target_name + '_' + channelName + '_' + versionName + '.ipa'
    #use xcodebuild exportArchieve export ipa.this code don't contain Symbols.
    cmd = 'xcrun -sdk iphoneos PackageApplication -v ' + '"' + xcodeDir + '/build/' + appDir + project_name + '.app" -o "' + outputDir + '/' + ipaName + '"'
    #cmd = 'xcodebuild -exportArchive -archivePath ' + target_name + '.xcarchive -exportPath "' + xcodeDir + '" -exportFormat ipa >exportarchieve.txt'
    ret = file_operate.execFormatCmd(cmd)
    taskManager.shareInstance().notify(idChannel, 100)
示例#41
0
def main(channel, dict):
    threading.currentThread().setName(channel)
    
    writeConfigToSdkConfigFile(channel, dict)
    
    dictTemp = ConfigParse.shareInstance().ConfigRead(channel)
    platformId = dictTemp.get('platformId')
    appVersion = dictTemp.get('appVersion')
    resVersion = dictTemp.get('resVersion')
    platformType = dictTemp.get('platformType')
    packageName = dictTemp.get('packageName')
    checkBox_isChecked = dict.get('checkBox_isChecked')
    checkBox_2_isChecked = dict.get('checkBox_2_isChecked')
    checkBox_4_isChecked = dict.get('checkBox_4_isChecked')
    checkBox_5_isChecked = dict.get('checkBox_5_isChecked')
    checkBox_voice_isChecked=dict.get('checkBox_voice_isChecked')
    
    comboBox_currentText = dict.get('comboBox_currentText')
    comboBox_3_currentText = dict.get('comboBox_3_currentText')
    comboBox_4_currentText = dict.get('comboBox_4_currentText')
    comboBox_6_currentText = dict.get('comboBox_6_currentText')
    comboBox_voice_currentText= dict.get('comboBox_voice_currentText')
    taskManager.shareInstance().notify(channel, 5)
    
    taskLock = taskManager.shareInstance().getLock()
    
    ret = execGameCommonInitializeScript(channel, platformId, appVersion, resVersion, platformType)
    if ret:
        return
    CreateTmpFolder(channel)
    source = ConfigParse.shareInstance().getApkPath()
#     source = dict.get('ApkPath')
    backupApk(source, channel)
    sourceDir = file_operate.getFullPath(constant.sdkRelatePath + channel)
    targetDir = file_operate.getFullPath(constant.tmpPath + '/' + channel)
    file_operate.copyFiles(sourceDir, targetDir)

    apkFile = targetDir + "/common.apk"
    deDir = targetDir + "/oldApkDir"
    operate.decompileApk_android(apkFile, deDir, taskLock)
    
    processStatistics(channel, checkBox_isChecked, comboBox_4_currentText)
    
    processAdvertising(channel, checkBox_2_isChecked, comboBox_6_currentText)
    
    processCrash(channel, checkBox_4_isChecked, comboBox_currentText) 

    processPush(channel, checkBox_5_isChecked, comboBox_3_currentText) 
    
    processMedia(channel,checkBox_voice_isChecked,comboBox_voice_currentText)

    oldApkDir = targetDir + "/oldApkDir"
    SmaliDir = oldApkDir + "/smali"
    dexFile1 = targetDir + "/classes.dex"
    ret = operate.dexTrans2Smali(dexFile1, SmaliDir, 3)
    
    dexFile2 = targetDir + "/classes2.dex"
    if os.path.exists(dexFile2):
        global splitDexFlag
        splitDexFlag = True
        ret = operate.dexTrans2Smali(dexFile2, SmaliDir, 3)
    if ret:
        return
#     dexFileApk = oldApkDir + "/classes.dex"
#     ret = operate.dexTrans2Smali(dexFileApk, SmaliDir, 3)
#     if ret:
#         return
    # copy res
    if os.path.exists(targetDir + "/ForRes"):
        operate.copyResToApk(targetDir + "/ForRes", oldApkDir + "/res")
    # copy funcellconfig.xml
    file_operate.copyFile(file_operate.getchannelFuncellConfigXmlPath(channel), oldApkDir + "/assets/funcellconfig.xml")
    # copy Assets
    armPath = targetDir + "/ForAssets/so/armeabi"
    armv7Path = targetDir + "/ForAssets/so/armeabi-v7a"
    if os.path.exists(armPath) and os.path.exists(armv7Path):
        operate.copyResToApk(armPath, armv7Path)
        
    if os.path.exists(targetDir + "/ForAssets"):
        operate.copyResToApk(targetDir + "/ForAssets", oldApkDir + "/assets")
    # copy extra
    
    if os.path.exists(targetDir + "/extra"):
        #-----------------六扇门配置-----------------------
        if os.path.exists(targetDir + "/extra/Assets/GameAssets/Resources/Config"):
            execOtherScript(targetDir)
        #----------------------------------------
#         operate.copyResToApk(targetDir+"/extra", oldApkDir+"/assets")
        file_operate.copyFiles(targetDir + "/extra", oldApkDir + "/assets")
    
    # copy libs
    if os.path.exists(targetDir + "/ForLibs"):
        if os.path.exists(oldApkDir + "/lib/armeabi") and os.path.exists(targetDir + "/ForLibs/armeabi"):
            operate.copyResToApk(targetDir + "/ForLibs/armeabi", oldApkDir + "/lib/armeabi")
        if os.path.exists(oldApkDir + "/lib/armeabi-v7a") and os.path.exists(targetDir + "/ForLibs/armeabi-v7a"):
            operate.copyResToApk(targetDir + "/ForLibs/armeabi-v7a", oldApkDir + "/lib/armeabi-v7a")
        if os.path.exists(oldApkDir + "/lib/x86") and os.path.exists(targetDir + "/ForLibs/x86"):
            operate.copyResToApk(targetDir + "/ForLibs/x86", oldApkDir + "/lib/x86")
        if os.path.exists(oldApkDir + "/lib/mips") and os.path.exists(targetDir + "/ForLibs/mips"):
            operate.copyResToApk(targetDir + "/ForLibs/mips", oldApkDir + "/lib/mips")
    
    # �ϲ�AndroidManifest.xml
    manifestFile = oldApkDir + "/AndroidManifest.xml"
    ET.register_namespace('android', constant.androidNS)
    targetTree = ET.parse(manifestFile)
    targetRoot = targetTree.getroot()
    
    haveChanged = modifyManifest.doModify(manifestFile, targetDir + "/ForManifest.xml", targetRoot)
    if haveChanged:
        targetTree.write(manifestFile, 'UTF-8')
    
    
    newPackagename = operate.renameApkPackage(SmaliDir, manifestFile, packageName)
    
    print channel , oldApkDir
    operate.addSplashScreen(channel, targetDir);
    
    ret = execGameCommongameSdkScript(channel, oldApkDir)
    if ret:
        return
    
    # statisticsScript
    statisticsScriptPath = targetDir + "/statisticsScript.pyc"
    if os.path.exists(statisticsScriptPath):
        sys.path.append(targetDir)
        import statisticsScript
        statisticsScript.Script(oldApkDir, newPackagename)
        del sys.modules['statisticsScript']
        sys.path.remove(targetDir)
    
    # advertisingScript
    advertisingScriptPath = targetDir + "/advertisingScript.pyc"
    if os.path.exists(advertisingScriptPath):
        sys.path.append(targetDir)
        import advertisingScript
        advertisingScript.Script(oldApkDir, newPackagename)
        del sys.modules['advertisingScript']
        sys.path.remove(targetDir)
    
    # pushScript
    pushScriptPath = targetDir + "/pushScript.pyc"
    if os.path.exists(pushScriptPath):
        sys.path.append(targetDir)
        import pushScript
        ret = pushScript.script(oldApkDir, newPackagename)
        del sys.modules['pushScript']
        lsPath = []
        for item in sys.path:
            if str(item) == str(targetDir):
                continue
            lsPath.append(item)
        sys.path = lsPath
    
    # sdk����ű�
    scriptPath = targetDir + "/script.pyc"
    if os.path.exists(scriptPath):
        sys.path.append(targetDir)
        import script
        ret = script.script(oldApkDir, newPackagename)
        del sys.modules['script']
        lsPath = []
        for item in sys.path:
            if str(item) == str(targetDir):
                continue
            lsPath.append(item)
        sys.path = lsPath
    
    ret = operate.pushIconIntoApk('', oldApkDir, channel)
    
    operate.modifyGameName(channel, oldApkDir)
    
    ret = operate.produceNewRFile(channel, newPackagename, oldApkDir)
    if ret:
        return
    
    # smali to dex
#     classesDexFile = oldApkDir + "/classes.dex"
#     ret = operate.smaliTrans2dex(SmaliDir, classesDexFile)
#     if ret:
#         return 
    #         if os.path.exists(SmaliDir):
    #             file_operate.delete_file_folder(SmaliDir)
    
    if splitDexFlag == True:
        print '+++++++++++++++++++++++++++++++++++++'
#         operate.splitDex(targetDir, oldApkDir)
        operate.splitDex_old(targetDir, oldApkDir)
        print '+++++++++++++++++++++++++++++++++++++'
        

    operate.rewriteYml(oldApkDir)    
    tempApkName = file_operate.getFullPath(constant.outDir) + "/apk_"+channel+"_unsigned.apk"
    ret = operate.recompileApk(oldApkDir, tempApkName)
    if ret:
        return
    keystoreFile = ConfigParse.shareInstance().getKeystoreFile()
    storepassword = ConfigParse.shareInstance().getKeystorePassword()
    alias = ConfigParse.shareInstance().getKeystoreAlias()
    aliasPasswd = ConfigParse.shareInstance().getKeystoreAliasPassword()
    # def signApk(apkFile, keyStore, storepassword, keyalias, aliaspassword):
    ret = operate.signApk(tempApkName, keystoreFile, storepassword, alias, aliasPasswd)
    print "sign"
    print ret
    if ret:
        return
    
    apkName = file_operate.getFullPath(constant.outDir) + "/apk_" + channel + ".apk" 
    ret = operate.alignAPK(tempApkName, apkName, file_operate.getFullPath(constant.outDir))
    
    ret = execGameCommonFinalizeScript(channel, platformId, appVersion, resVersion, checkBox_isChecked, checkBox_4_isChecked, checkBox_5_isChecked)
    if ret:
        print 'execGameCommonFinalizeScript error:'
        return
    taskManager.shareInstance().notify(channel, 100)
    print "----------------------------%s pack complete!------------------------" % channel