click.py 12.3 KB
from numpy import long

from android_event.android_script import allEvent
import random
import requests
import socket
import struct
import time
import datetime
# 导入hashlib模块进行md5操作
import hashlib

# 生成数字组合
n = 10
def code_nums2(n=6):
    ret = ''
    for i in range(n):
        num = random.randint(0, 9)
        s = str(random.choice([num]))
        ret += s
    return ret



# from jiami.md5 import get_str_sha1_secret_str

proiect_id = code_nums2(6)
# proiect_id = '222'

advert_id = code_nums2(6)
# advert_id = '222'

# proiect_id = '__PROJECT_ID__'
# advert_id = '__PROMOTION_ID__'
advert_name = '广告'
proiect_name = '项目'
# 向短链发送点击数据
# 广告创意ID
ry_adcreative_id = code_nums2(6)
# ry_adcreative_id = '222'
# 广告组ID
ry_adgroup_id = code_nums2(6)
# ry_adgroup_id = '222'
# 广告计划ID
ry_adplan_id = code_nums2(6)
# ry_adplan_id = '222'
# 广告组名称
ry_adgroup_name = 'c测试1'
# 广告计划名称
ry_adplan_name = 'c测试1'
# 广告创意名称
ry_adcreative_name = 'c测试1'
# bytedance_int 今日头条,kuaishou_int 快手,tencentams_int	(新)广点通,rryingxiao_int 人人营销
pid = 'rryingxiao_int'
URL = 'http://uri6.com/tkio/VZZ7Ffa?noredirect=true'
# URL = 'http://52.80.137.106:8083/tkio/3Qz2Ufa?noredirect=true'

# 测试头条衍生事件回调时加上
# callback= http%3A%2F%2Fad.toutiao.com%2Ftrack%2Factivate%2F%3Fcallback%3DCKP4rs-Zn4QDEKiQ6teZn4QDGN6L8Y-h9Wcg3ovxj6H1ZyiE0PjgroSEAzAOOM_X-8IDQik0YWY1NzdlOC1lZmViLTRmZDEtYmZkZC00MzE1Zjc1MmJhMGF1NTQ5M0iA0pOtA1AAiAEAkAECmAEA%26os%3D0%26muid%3D
# URL = 'http://uri6.com/adapt/encryp/love.match.set-bytedance?noredirect=true&pid=rryingxiao_int&callback=D8311DBF28D751F327B83F7CEE5B8850B88CC74C8C3FF628EB3A48CAE2212EE260EE347E1771382C5F1B2C0FC9E8921CB5245576D7E5C1EF680315AAA98DCFB189F66FBA49CC7BCB8E4B4726D6D363B816BB2133CADC80B1C12D9FE464A05ED974A70A646BAB1D4D78E2A75361676D5A0D3D4E52B7E7C6B72E9388C17FE9384BE1A47503AABEFB9423727DBAC7B7275AAD237E0E2774D2A8C3D0FDC895CE10C0CCE38F8FEDBC24AF2E23B2B5E742B50C07744361334E148979087917DFFFC445A74B9F939412DEF8D060474E1D353ED7E2EB636B32CADF29842BB90E2131BD3ED05D1A0438EA0EA8577613780B3D64377D85E758A2B20507A034A2C8A96077C7E200C410188C78F76B9B5E7F3E5E4AC3'
# URL = 'http://10.2.20.42:8083/tkio/encryp/uENNrya?noredirect=true&callback=D8311DBF28D751F327B83F7CEE5B885033E9390C927C9AD11DC560E284B8264F60EE347E1771382C5F1B2C0FC9E8921C232AEE9605803A05F03F2A37DB5C2A0434FE8EE58085C8DDC10A4729E93BB9141C43D64DC2E32BEC4D1B48617B15534E53B56C07040DD7816303D25B54BD99B71B7AC9BB6E733CC072F5E0D45835629E8EFE86BB75F2BE5F492CFC06DA04724949E0A13E33C6D8C40DEE1DC9555FA7477E02BB73108BFA234880D3CD8D7697FA7E1B63FE21DE5A9ACA0FB3D40AC484521879464AE0DC1C68B8D7FFE3092368685569A64D495EF6BB5C5A3388F0717412AE787A124F4643FD29A3789413FB6A09010841EA49F0C7D7606A56DF28BE20C6FA34BAEC6B57024C66B5322DF24281FA'
# ?impression=true
# ?noredirect=true
# ?preorder=true
# 234565656
# 16dc0cb882d3dbec4f7f66251a84d6dd
# 7e3aa681f68435b3f74de790d6424690
# 4eab4be709defbfc2cc85826b09caea0
# 6ba2b016f280004d10a1a354e426eceb
# md5加密
def computeMD5upper(message):
    m = hashlib.md5()
    m.update(message.encode(encoding='utf-8'))
    return m.hexdigest().upper()


appkey = '16dc0cb882d3dbec4f7f66251a84d6dd'
lst = []
nowTime = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
s = 0
w = 0
for index in range(1):
    # print("开始时间"+datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
    # 随机生成12为数组
    i = ''.join(str(random.choice(range(10))) for _ in range(12))
    # i = '726866819566'
    o = ''.join(str(random.choice(range(10))) for _ in range(12))
    m = ''.join(str(random.choice(range(10))) for _ in range(12))
    se = ''.join(str(random.choice(range(10))) for _ in range(12))
    adid = ''.join(str(random.choice(range(10))) for _ in range(12))
    # adid = '5011813780042235'
    p1 = ''.join(str(random.choice(range(10))) for _ in range(12))
    accountid = ''.join(str(random.choice(range(10))) for _ in range(12))
    # accountid = '222'
    # p1 = '测试一下'
    # "idfa": 'B5588C9C-4534-43FB-935D-F17C91622C83',
    # "idfa": '00000000-0000-0000-0000-000000000000',
    # sh1 = "track_click:"+appkey+":"+get_str_sha1_secret_str(i)
    # print(sh1)
    # i = '091508889907'
    # md5加密
    # 创建md5对象
    # m = hashlib.md5()
    # b = i.encode(encoding='utf-8')
    # m.update(b)
    # str_md5 = m.hexdigest().upper()
    # print("md5加密:"+str_md5)
    ###########
    # md16加密(截取md5加密的字符串)
    # imei_16 = str_md5[8:24]
    # print("md16加密:"+imei_16)

    # 随机生成ip
    ip = socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff)))
    # ip = '156.119.456.190'
    try:
        parms = {
            # 'clickid':'223123211312',
            'click_time': str(round(time.time() * 1000)),
            # 'click_time': '1666271211',

            # 'androidid': '86ab7f6642bdde717709216e68d0b',
            'imei': i,
            # 'callback_param': 'EPHk9cX3pv4CGJax4ZENKI7w4MDev_4C',
            # 'imei_MD5': computeMD5upper(i),
            # 'campuuid': '@#¥%……&……%¥#@#¥%&……&*****',
            # 'clickid': '测试测试',
            # "idfa": '583D2BB0-B19C-4A9A-A600-2A1EB2FB7E30',
            # 'gxid': '78B5382F687FAD16E75F5DDDC7745013',
            # 'caid': '00_A0FF634AEDF1403205A4A6A1118CDA61_A66338F33BEBB40F5CD65F198AF2F40C',
            # 'oaid': i,
            # 'oaid_MD5': computeMD5upper(i),
            'ip': ip,
            # 'pid': pid,
            # 'vid': '7653236654354534rffdvdv!@#¥%@测试测试'
            # 'cached_caid': '00_A2FF034AEDF1403205A4A6A1118CDA67_A66338F33BEBB40F5CD65F198AF2F44C',
            # "idfv": 'CB389725-0029-4A35-8E38-D142F836B626',
            "ua": "Mozilla%2F5.0+%28iPhone%3B+CPU+iPhone+OS+13_4_1+like+Mac+OS+X%29+AppleWebKit%2F605.1.15+%28KHTML%2C+like+Gecko%29+Mobile%2F15E148+aweme_20.3.0+Region%2FCN+AppTheme%2Fdark+NetType%2F4G+JsSdk%2F2.0+Channel%2FApp+ByteLocale%2F",
            # 'creativeId':'21321321312123',
            # 'requestId':'312321321312',
            # 'adId': long('21231'),
            # 'ry_adgroup_name': ry_adgroup_name,
            # 'ry_adplan_name': ry_adplan_name,
            # 'ry_adcreative_name': ry_adcreative_name,
            # 投放广告详情相关指标,以下四个指标相关联
            "ry_adgroup_id": ry_adgroup_id,
            "ry_adplan_id": ry_adplan_id,
            "ry_adcreative_id": ry_adcreative_id,

            # 巨量2.0
            # "project_id":proiect_id,
            # "advert_id":advert_id,


            # # "project_name": proiect_name,
            # # "advert_name": advert_name,
            # # # # # # 账户id
            "accountid": accountid,
            # 'imei2': 'null',
            # 'meid': i
            # 'bd_vid': i
            # 'oaid': "9f80c84a559f573636a47ff8daed0d32",
            # 'muid': "4C63905D9694B9BF8D3EE38E64809A73",
            # 'mac': "5432453241421",
            #  子渠道
            # 'subchannel': '2000',
            # # 计划
            # 'aid': '888',
            # # 广告位
            # 'siteid': '777',
            # # 流量来源
            # 'csite': '666',
            # "timestamp": "1569141628027",
            # "creative": "31096865315",
            # "deviceid": 'null',
            # "tz": "+8",
            # "wx_campaign_id":ry_adgroup_id,
            # 'wx_adgroup_id':ry_adplan_id,
            # 'ry_adcreative_id':ry_adcreative_id
            # "ry_channel_fake": "false",
            # "ry_ts": "1569141628025",
            # "type": '1222',
            # "ctype": '4232323',
            # "campaign_id": '123',
            # "adgroup_id": '123',
            # "creative_id": '123'
            # 'sysfsize': '111',
            # '_model': '1',
            # 'sysram': '1',
            # '_ryosversion': '1',
            # 'sysutime': '1',
            # 'sysuname': '1',
            # '_carrier': '1',
            # 'syscountryc': '1',
            # 'sysrtime': '1',
        }
        # timeout可以超时四秒
        # verify = False
        p = requests.get(url=URL, params=parms, timeout=10, verify=False)
        print('imei:', i)
        print('imeimd5:', computeMD5upper(i))

        print("ip:", ip)
        # print("accountid:", accountid)
        print(p.text)
        print(p.url)
        # print("oaid:",o)
        print('success:', s)
        print(p.status_code)
        print(p.content)
        print("accountid:"+accountid)
        # print('androidid:',a)
        # print(nowTime)
        s = s + 1
    except Exception as err:
        print(err)
        print('wrong:', w)
        print('imei:', i)
        print("ip:", ip)
        # print(p.status_code)
        # print('androidid', a)
        w = w + 1

    time.sleep(6)
    try:
        allEvent().installUpload(i, ip, appkey)
        # allEvent().formevent(i, ip, appkey)

    except Exception:
        print('install_wrong:', w)
        w = w + 1
    # # # # #
    # # # # #

    # time.sleep(6)
    # try:
    #     allEvent().invoke_test(i, ip, appkey)
    # except Exception:
    #     print('install_wrong:', w)
    #     w = w + 1



    # time.sleep(5)
    # try:
    #     allEvent().registerEvent(i, ip, appkey)
    # except Exception as e:
    #     print('注册_wrong:', w)
    #     print(e)
    # time.sleep(4)
    # try:
    #     allEvent().loginEvent(i, ip, appkey)
    # except Exception:
    #     print('登录_wrong:', w)
    time.sleep(3)
    try:
        allEvent().payEvent(i, ip, appkey)
    except Exception as err:
        print(err)
    #     print('付费_wrong:', w)
    # time.sleep(3)
    # try:
    #     allEvent().payorder(i, ip, appkey)
    # except Exception:
    #     print('订单_wrong:', w)


    # time.sleep(3)
    # try:
    #     allEvent().retentionEvent(i,ip,appkey)
    # except Exception:
    #     print('retention',w)
    #     w = w + 1
    # time.sleep(3)
    # try:
    #     allEvent().adshow(i, ip, appkey,adid)
    #     # allEvent().formevent(i, ip, appkey)
    # except Exception:
    #     print('adshow_wrong:', w)
    #     w = w + 1
    # time.sleep(3)
    # try:
    #     allEvent().adclick(i, ip, appkey, adid)
    #     # allEvent().formevent(i, ip, appkey)
    # except Exception:
    #     print('adshow_wrong:', w)
    #     w = w + 1
    # time.sleep(5)
    # try:
    #     allEvent().appduration(i, ip, appkey,se)
    #     # allEvent().formevent(i, ip, appkey)
    #     # print("session:"+se)
    # except Exception:
    #     print('install_wrong:', w)
    #     w = w + 1
    # time.sleep(5)
    # try:
    #     allEvent().pageduration(i, ip, appkey, se, p1)
    #     # allEvent().formevent(i, ip, appkey)
    # except Exception:
    #     print('pageduration_wrong:', w)
    #     w = w + 1
    # time.sleep(3)
    # try:
    #     allEvent().startupEvent(i, ip, appkey)
    #
    # except Exception:
    #     print('install_wrong:', w)
    #     w = w + 1
    #
    # num = index + 1
    # event = 'event_' + str(num)
    # event = 'event_26'
    # time.sleep(2)
    # try:
    #     allEvent().ziding_event(i, ip, appkey, event)
    #     print(event)
    # except Exception as err:
    #     print(err)
    #     print('自定义_wrong:', w)

    # time.sleep(6)
    # try:
    #     allEvent().H5pv(i, ip, appkey)
    # except Exception:
    #     print('install_wrong:', w)
    #     w = w + 1
    # time.sleep(2)
    # try:
    #     allEvent().H5reged(i, ip, appkey)
    # except Exception:
    #     print('install_wrong:', w)
    #     w = w + 1

    # time.sleep(5)
    # try:
    #     allEvent().H5download(i, ip, appkey)
    # except Exception:
    #     print('install_wrong:', w)
    #     w = w + 1
    #
    # time.sleep(5)
    # try:
    #     allEvent().h5registerEvent(i, ip, appkey)
    # except Exception:
    #     print('install_wrong:', w)
    #     w = w + 1
    #
    # time.sleep(5)
    # try:
    #     allEvent().h5loginEvent(i, ip, appkey)
    # except Exception:
    #     print('install_wrong:', w)
    #     w = w + 1
    #
    # time.sleep(5)
    # try:
    #     allEvent().h5payEvent(i, ip, appkey)
    # except Exception:
    #     print('install_wrong:', w)
    #     w = w + 1
    # time.sleep(5)
    # try:
    #     allEvent().h5payorder(i, ip, appkey)
    #
    # except Exception:
    #     print('install_wrong:', w)
    #     w = w + 1

    # print("结束时间" + datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
    #
    #
    #
    # lst.append(i)
    # print(lst)