Exemplo n.º 1
0
    def send(self):
        """向客户手机发送短信密码"""

        url = 'https://service.cq.10086.cn/ics'

        headers = {
            'Host':
            'service.cq.10086.cn',
            'Referer':
            'https://service.cq.10086.cn/httpsFiles/pageLogin.html',
            'User-Agent': ('Mozilla/5.0 (Windows NT 6.1; Win64; x64) '
                           'AppleWebKit/537.36 (KHTML, like Gecko) '
                           'Chrome/57.0.2987.133 Safari/537.36')
        }
        params = {
            'service':
            'ajaxDirect/1/secondValidate/secondValidate/javascript/',
            'pagename': 'secondValidate',
            'eventname': 'getTwoVerification',
            'GOODSNAME': '用户详单',
            'DOWHAT': 'QUE',
            'ajaxSubmitType': 'post',
            'ajax_randomcode': '20170508150704780.7728731616524849'
        }
        url_requests.post(url=url,
                          params=params,
                          headers=headers,
                          cookies=self.cookies)
        print "send success, please check you message on your phone."
Exemplo n.º 2
0
        def get_record(month):
            """查询某月的通话记录

            :param month: like '201705'
            :return: list
            """

            url = ('http://service.cq.10086.cn/ics')
            headers = {
                'Host':
                'service.cq.10086.cn',
                'User-Agent': ('Mozilla/5.0 (Windows NT 6.1; Win64; x64) '
                               'AppleWebKit/537.36 (KHTML, like Gecko) '
                               'Chrome/57.0.2987.133 Safari/537.36'),
                'Referer': ('http://service.cq.10086.cn/myMobile/detailBill'
                            '.html')
            }
            params = {
                'service': 'ajaxDirect/1/myMobile/myMobile/javascript/',
                'pagename': 'myMobile',
                'eventname': 'getDetailBill',
                'cond_DETAIL_TYPE': '3',
                'cond_QUERY_TYPE': '0',
                'cond_QUERY_MONTH': month,
                'cond_GOODS_ENAME': 'XFMX',
                'cond_GOODS_NAME': '消费明细',
                'cond_TRANS_TYPE': 'Q',
                'cond_GOODS_ID': '2015060500000083',
                'ajaxSubmitType': 'post',
                'ajax_randomcode': '20170509150221440.6991503923974802'
            }
            response = url_requests.post(url=url,
                                         headers=headers,
                                         params=params,
                                         cookies=self.cookies)
            result = re.search('\[CDATA\[\[(.*?)\]\]\]>', response.content,
                               re.S).group(1)
            result = json.loads(result)
            record = result['resultData']  # list  一个月的记录
            month_list = []
            for each in record:
                table = {}
                table['cert_num'] = ''  # 身份证号码
                table['phone'] = self.phone  # 手机号
                table['call_area'] = each.get('c1', '')  # 通话地点
                table['call_date'] = each.get('c0', '')[:5]  # 通话日期
                table['call_time'] = each.get('c0', '')[6:]  # 通话时间
                table['call_cost'] = float(each.get('c8', 0.00)) + \
                                     float(each.get('c7', 0.00)) # 通话费用
                table['call_long'] = each.get('c4', '')  # 通话时长
                table['other_phone'] = each.get('c3', '')  # 对方号码
                table['call_type'] = each.get('c2', '')  # 呼叫类型
                table['land_type'] = each.get('c5', '')  # 通话类型:本地通话, 省内通话 etc
                month_list.append(table)

            return month_list
Exemplo n.º 3
0
        def forth_step(phone, password, validate_code, cookies):
            """用验证码+用户名+服务密码去获取一个url,同时更新cookie。"""

            url = 'https://service.cq.10086.cn/ics'
            headers = {
                'Host':
                'service.cq.10086.cn',
                'Referer':
                'https://service.cq.10086.cn/httpsFiles/pageLogin.html',
                'User-Agent': ('Mozilla/5.0 (Windows NT 6.1; Win64; x64) '
                               'AppleWebKit/537.36 (KHTML, like Gecko) '
                               'Chrome/57.0.2987.133 Safari/537.36')
            }
            params = {
                'service': 'ajaxDirect/1/login/login/javascript/',
                'pagename': 'login',
                'eventname': 'SSOlogin',
                'cond_REMEMBER_TAG': 'false',
                'cond_LOGIN_TYPE': '2',  # 如果是动态验证码,此处为0
                'cond_SERIAL_NUMBER': phone,
                'cond_USER_PASSWD': ChinaMobile_CQ.des_core(phone, password),
                # ChinaMobile_CQ.des_core(phone, password),
                'cond_USER_PASSSMS': '',  # 动态验证码
                'cond_VALIDATE_CODE': validate_code,
                'ajaxSubmitType': 'post',
                'ajax_randomcode': '20170508112126380.18652078435652464'
            }
            response = url_requests.post(url=url,
                                         params=params,
                                         headers=headers,
                                         cookies=cookies)
            url = ''
            if '验证码不正确' in response.content.decode('utf-8'):
                print '验证码不正确'
            elif '登陆成功' in response.content.decode('utf-8'):
                print '登陆成功'
                self.cookies.update(dict(response.cookies))
                url = re.search('"url":"(.*?)"', response.content,
                                re.S).group(1)
            else:
                print response.content

            return url
Exemplo n.º 4
0
    def second_validate(self, passSMS):
        """短信密码二次验证"""

        url = ('http://service.cq.10086.cn/ics')
        headers = {
            'Host':
            'service.cq.10086.cn',
            'User-Agent': ('Mozilla/5.0 (Windows NT 6.1; Win64; x64) '
                           'AppleWebKit/537.36 (KHTML, like Gecko) '
                           'Chrome/57.0.2987.133 Safari/537.36'),
            'Referer': ('http://service.cq.10086.cn/myMobile/detailBill'
                        '.html')
        }
        params = {
            'service': 'ajaxDirect/1/secondValidate/secondValidate'
            '/javascript/',
            'pagename': 'secondValidate',
            'eventname': 'checkSMSINFO',
            'cond_USER_PASSSMS': passSMS,
            'cond_CHECK_TYPE': 'DETAIL_BILL',
            'cond_loginType': '2',
            'ajaxSubmitType': 'post',
            'ajax_randomcode': '20170516102847590.8665265559471624'
        }
        response = url_requests.post(url=url,
                                     headers=headers,
                                     params=params,
                                     cookies=self.cookies)
        if '验证成功' in response.content.decode('utf-8'):
            print '验证成功'
        elif '服务密码输入错误' in response.content.decode('utf-8'):
            print '服务密码输入错误'
        elif '短信验证码已失效' in response.content.decode('utf-8'):
            print '短信验证码已失效'
        else:
            print '网络异常, 短信认证失败。'