コード例 #1
0
ファイル: iftest.py プロジェクト: xyzj/lump
def test_ipcsubmit():
    global user_id
    print('=== ipc submit ===')
    lstcmd = (
        'ipc.verf.get',
        'ipc.lscmd.get',
        'ipc.date.get',
        'ipc.time.get',
        'ipc.qudat.get',
    )  # 'ipc.datetime.set')
    url = baseurl + 'ipcctl'
    for cmd in lstcmd:
        rqmsg = msgif.rqIpcCtl()
        rqmsg.dev_id.extend(['901001000001'])
        rqmsg.ctl_cmd = cmd
        if cmd == 'ipc.datetime.set':
            rqmsg.dev_datetime = int(time.time())
        scode = mx.getMD5('{0}fendangao'.format(
            mx.stamp2time(time.time(), format_type='%Y%m%d%H')))
        data = {
            'scode': scode,
            'pb2': base64.b64encode(rqmsg.SerializeToString())
        }
        r = pm.request('POST', url, fields=data, timeout=10.0, retries=False)
        msg = msgif.CommAns()
        msg.ParseFromString(base64.b64decode(r.data))
        time.sleep(15)
    print('ipc submit finish')
    time.sleep(0)
コード例 #2
0
ファイル: iftest.py プロジェクト: xyzj/lump
def test_slutimerget():
    global user_id
    print('=== slu timer get ===')
    url = baseurl + 'slutimerctl'
    rqmsg = msgif.rqSluTimerCtl()
    rqmsg.head.ver = 160328
    rqmsg.data_mark = 0
    # rqmsg.dt_start = mx.time2stamp('2016-12-10 00:00:00')
    # rqmsg.dt_end = mx.time2stamp('2017-06-20 00:00:00')
    rqmsg.tml_id.extend([1500003])
    # rqmsg.data_mark=1
    scode = mx.getMD5('{0}7ya54Gv5Y'.format(
        mx.stamp2time(time.time(), format_type='%Y%m%d%H')))
    # print(rqmsg)
    data = {
        "uuid": user_id,
        'pb2': base64.b64encode(rqmsg.SerializeToString())
    }
    # data = {'scode': scode, 'pb2': 'KICY26 LKzCAqNasaDlSs='}
    r = pm.request('POST', url, fields=data, timeout=300.0, retries=False)
    msg = msgif.CommAns()
    # msg.ParseFromString(r.data)
    msg.ParseFromString(base64.b64decode(r.data))
    print(msg)
    print(msg.head)
    print('post finish')
    time.sleep(0)
コード例 #3
0
def load_lic_for_nt(lic_file='lic.dll'):
    lst_func = []
    if os.name == 'posix':
        lst_func = [r'/all']
    elif os.name == 'nt':
        if os.path.isfile(os.path.join(mx.SCRIPT_DIR, lic_file)):
            with open(os.path.join(mx.SCRIPT_DIR, lic_file), 'r') as f:
                x = f.readlines()
                f.close()
            y = x[1:len(x) - 1]
            z = ''.join(y).replace('\n', '').swapcase()
            a = zlib.decompress(base64.b64decode(z))
            l = int(a[8])
            ll = int(a[22:22 + int(l)])
            b = a[ll + l + 1:].split(',')

            import wmi
            c = wmi.WMI()
            d = c.Win32_Processor()[0]
            e = mx.getMD5(d)

            if b[0] == e:
                lst_func = [r'/{0}'.format(h) for h in b[1:]]
            else:
                lst_func = []
            del x, y, z, a, b, c, d, e, l, ll
        else:
            lst_func = []
    return set(lst_func)
コード例 #4
0
ファイル: iftest.py プロジェクト: xyzj/lump
def test_cleansms():
    global user_id
    print('=== clean sms ===')
    url = baseurl + 'cleansmsalarm'
    rqmsg = init_head(msgif.rqEluCtl())
    # rqmsg.tml_id.extend([1600001, 1600002])
    # rqmsg.loop_id.extend([1,2,5,8])
    scode = mx.getMD5('{0}7ya54Gv5Y'.format(
        mx.stamp2time(time.time(), format_type='%Y%m%d%H')))
    data = {'scode': scode, 'pb2': base64.b64encode(rqmsg.SerializeToString())}
    r = pm.request('POST', url, fields=data, timeout=10.0, retries=False)
    msg = msgif.CommAns()
    msg.ParseFromString(base64.b64decode(r.data))
    print(msg)
    time.sleep(0)
コード例 #5
0
ファイル: iftest.py プロジェクト: xyzj/lump
def test_ipcuplink():
    global user_id
    print('=== ipc uplink ===')
    url = baseurl + 'ipcuplink'
    scode = mx.getMD5('{0}fendangao'.format(
        mx.stamp2time(time.time(), format_type='%Y%m%d%H')))
    rqmsg = msgif.rqIpcUplink()
    rqmsg.dev_id = '902001000001'
    rqmsg.raw_string = '1,1'
    data = {'scode': scode, 'pb2': base64.b64encode(rqmsg.SerializeToString())}
    r = pm.request('POST', url, fields=data, timeout=10.0, retries=False)
    msg = msgif.CommAns()
    msg.ParseFromString(base64.b64decode(r.data))
    print(msg)
    print('ipc uplink finish')
    time.sleep(0)
コード例 #6
0
ファイル: iftest.py プロジェクト: xyzj/lump
def test_submitsms():
    global user_id
    print('=== sms submit ===')
    url = baseurl + 'submitsms'
    scode = mx.getMD5('{0}aUd2213F1'.format(
        mx.stamp2time(time.time(), format_type='%Y%m%d%H')))
    rqmsg = msgif.rqSubmitSms()
    rqmsg.tels.extend([18916788720])
    rqmsg.msg = u'tessdf第三方法ta'
    print(scode, base64.b64encode(rqmsg.SerializeToString()))
    data = {'scode': scode, 'pb2': base64.b64encode(rqmsg.SerializeToString())}
    # data = {'scode': scode, 'pb2': 'ChgIAhDI5AkaCXN1Ym1pdHNtc6AGwKfRwwUSCu62yro68vXwjkMaBTU1NTUK'}
    r = pm.request('POST', url, fields=data, timeout=10.0, retries=False)
    print(r.data)
    msg = msgif.CommAns()
    msg.ParseFromString(base64.b64decode(r.data))
    print(msg)
    print('ipc submit finish')
    time.sleep(0)
コード例 #7
0
ファイル: iftest.py プロジェクト: xyzj/lump
def test_userinfo():
    global user_id
    print('=== userinfo ===')
    url = baseurl + 'userlist'
    rqmsg = init_head(msgif.rqUserInfo())
    # rqmsg.user_name = 'wuning'

    data = {
        'scode':
        mx.getMD5('{0}53f5c320'.format(
            mx.stamp2time(time.time(), format_type='%Y%m%d%H'))),
        'pb2':
        base64.b64encode(rqmsg.SerializeToString())
    }
    r = pm.request('POST', url, fields=data, timeout=10.0, retries=False)
    msg = msgif.UserInfo()
    msg.ParseFromString(base64.b64decode(r.data))
    print(msg)
    time.sleep(0)
コード例 #8
0
ファイル: iftest.py プロジェクト: xyzj/lump
def test_ipcqueue():
    global user_id
    print('=== query em data ===')
    scode = mx.getMD5('{0}fendangao'.format(
        mx.stamp2time(time.time(), format_type='%Y%m%d%H')))
    url = baseurl + 'queryemdata'
    rqmsg = msgif.rqQueryEMData()
    # rqmsg.head.paging_num = 1
    # rqmsg.head.paging_buffer_tag = 1478230469047982
    # rqmsg.head.paging_idx = 30
    rqmsg.dev_id = '901001000999'
    # rqmsg.dt_start = 1489021647
    # rqmsg.dt_end = 1489108047
    rqmsg.dt_start = mx.time2stamp('2017-05-01 0:0:0')
    rqmsg.dt_end = mx.time2stamp('2017-07-28 23:59:59')
    data = {'scode': scode, 'pb2': base64.b64encode(rqmsg.SerializeToString())}
    r = pm.request('POST', url, fields=data, timeout=10.0, retries=False)
    msg = msgif.QueryEMData()
    msg.ParseFromString(base64.b64decode(r.data))
    print(msg)
    print('query em data finish')
    time.sleep(0)
コード例 #9
0
ファイル: iftest.py プロジェクト: xyzj/lump
def test_submittcs():
    global user_id
    print('=== sms submit ===')
    url = baseurl + 'submittcs'
    scode = mx.getMD5('{0}3a533ba0'.format(
        mx.stamp2time(time.time(), format_type='%Y%m%d%H')))
    rqmsg = msgif.rqSubmitSms()
    rqmsg.tels.extend([18916788720])
    rqmsg.msg = u'tessdf第三方法ta'
    print(scode, base64.b64encode(rqmsg.SerializeToString()))
    data = {'scode': scode, 'pb2': base64.b64encode(rqmsg.SerializeToString())}
    data = {
        'scode':
        scode,
        'pb2':
        'ChsIAhABGAEgASgBMAE6DXdsc3QucnR1LmEwMDASDwoFgYCA+AcQlU4aARQoAaIG5QGqAeEBCkDYXnvttdfoP9hee+211+g/11prrbXW6D/YXnvttdfoP9VUU0011eg/2WSTTTbZ6D/WVltttdXoP9VSSy211Og/EkC44YYbbrjRP7jhhhtuuNE/N9xwww03vD8ffPDBBx+8PwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGkCcccYZZ5zJP5RRRhlllMk/v/3222+/rT+fffbZZ5+tPwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAII/YAij/AToIAAAAAAEBAQFCCAAAAAAAAAAA'
    }
    r = pm.request('POST', url, fields=data, timeout=10.0, retries=False)
    print(r.data)
    msg = msgif.CommAns()
    msg.ParseFromString(base64.b64decode(r.data))
    print(msg)
    print('ipc submit finish')
    time.sleep(0)
コード例 #10
0
    def computing_security_code(self, scode):
        xsalt = zlib.decompress('x\x9c35N3M662\x00\x00\t;\x01\xfc')

        x = set([
            mx.getMD5('{0}{1}'.format(
                mx.stamp2time(time.time(), format_type='%Y%m%d%H'), xsalt))
        ])
        if self.salt != '':
            x = set([
                mx.getMD5('{0}{1}'.format(
                    mx.stamp2time(time.time(), format_type='%Y%m%d%H'),
                    self.salt))
            ])

        if time.localtime()[4] >= 55:
            x.add(
                mx.getMD5('{0}{1}'.format(
                    mx.stamp2time(time.time() + 360, format_type='%Y%m%d%H'),
                    xsalt)))
            if self.salt != '':
                x.add(
                    mx.getMD5('{0}{1}'.format(
                        mx.stamp2time(time.time() + 360,
                                      format_type='%Y%m%d%H'), self.salt)))
        elif time.localtime()[4] < 5:
            x.add(
                mx.getMD5('{0}{1}'.format(
                    mx.stamp2time(time.time() - 360, format_type='%Y%m%d%H'),
                    xsalt)))
            if self.salt != '':
                x.add(
                    mx.getMD5('{0}{1}'.format(
                        mx.stamp2time(time.time() - 360,
                                      format_type='%Y%m%d%H'), self.salt)))

        return 1 if scode.lower() in x else 0