├── .gitignore ├── README.md ├── py36 ├── exchange_59_20.py ├── exchange_9.9.py ├── exchange_alg.py ├── exchange_check_coupons.py ├── exchange_check_redpacket.py ├── exchange_evaluation.py ├── exchange_general_long_key.py ├── exchange_general_short_key.py ├── exchange_lib.py ├── exchange_plus.py ├── exchange_test_delay.py ├── exchange_tools.py ├── exchange_xiaomi.py └── pytransform │ ├── __init__.py │ └── platforms │ ├── darwin │ └── x86_64 │ │ └── _pytransform.dylib │ ├── linux │ ├── aarch64 │ │ └── _pytransform.so │ └── x86_64 │ │ └── _pytransform.so │ └── windows │ └── x86_64 │ └── _pytransform.dll ├── py37 ├── exchange_59_20.py ├── exchange_9.9.py ├── exchange_alg.py ├── exchange_check_coupons.py ├── exchange_check_redpacket.py ├── exchange_evaluation.py ├── exchange_general_long_key.py ├── exchange_general_short_key.py ├── exchange_lib.py ├── exchange_plus.py ├── exchange_test_delay.py ├── exchange_tools.py ├── exchange_xiaomi.py └── pytransform │ ├── __init__.py │ └── platforms │ ├── darwin │ └── x86_64 │ │ └── _pytransform.dylib │ ├── linux │ ├── aarch64 │ │ └── _pytransform.so │ └── x86_64 │ │ └── _pytransform.so │ └── windows │ └── x86_64 │ └── _pytransform.dll ├── py38 ├── exchange_59_20.py ├── exchange_9.9.py ├── exchange_alg.py ├── exchange_check_coupons.py ├── exchange_check_redpacket.py ├── exchange_evaluation.py ├── exchange_general_long_key.py ├── exchange_general_short_key.py ├── exchange_lib.py ├── exchange_plus.py ├── exchange_test_delay.py ├── exchange_tools.py ├── exchange_xiaomi.py └── pytransform │ ├── __init__.py │ └── platforms │ ├── darwin │ └── x86_64 │ │ └── _pytransform.dylib │ ├── linux │ ├── aarch64 │ │ └── _pytransform.so │ └── x86_64 │ │ └── _pytransform.so │ └── windows │ └── x86_64 │ └── _pytransform.dll └── py39 ├── exchange_59_20.py ├── exchange_9.9.py ├── exchange_alg.py ├── exchange_check_coupons.py ├── exchange_check_redpacket.py ├── exchange_evaluation.py ├── exchange_general_long_key.py ├── exchange_general_short_key.py ├── exchange_lib.py ├── exchange_plus.py ├── exchange_test_delay.py ├── exchange_tools.py ├── exchange_xiaomi.py └── pytransform ├── __init__.py └── platforms ├── darwin └── x86_64 │ └── _pytransform.dylib ├── linux ├── aarch64 │ └── _pytransform.so └── x86_64 │ └── _pytransform.so └── windows └── x86_64 └── _pytransform.dll /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | *.json 3 | *.db 4 | __pycache__ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BeHalcyon/fisher_script/dcf6f09fde8a442d90c39ac96fdbb1360fe0879a/README.md -------------------------------------------------------------------------------- /py36/exchange_59_20.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python3 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称: exchange_59_20_1.py 5 | Author: Fisher 6 | 功能: 7 | Date: 2022-5-12 8 | cron: 0 59 9,13,17,21,23 * * * 9 | ''' 10 | 11 | from exchange_lib import * 12 | 13 | if __name__ == "__main__": 14 | 15 | args = parseArgs() 16 | 17 | ExchangeManagement( 18 | url="", 19 | headers={}, 20 | headers_user_agent_random_flag=False, 21 | user_agent="okhttp/3.12.1;jdmall;android;version/11.0.2;build/97565;", 22 | body_dict={}, 23 | batch_size=args.batch_size if args.batch_size > 0 else 7, 24 | activitiId_random_flag=False, 25 | other_batch_size=0, 26 | # second_ahead=0.31, 27 | second_ahead=0, 28 | sleep_time=0, 29 | thread_number=args.thread_number if args.thread_number > 0 else 40, 30 | append_flag=False, 31 | log_flag=False, 32 | sign_flag=True, 33 | day_or_week='week', 34 | post_flag=True, 35 | proxy_flag=args.proxy_flag if args.proxy_flag else False, 36 | coupon_type="59-20_1", 37 | cookie_type=args.cookie_type if args.cookie_type != 'None' else 'ws_cookies') \ 38 | .executeInDesktop( 39 | clock_list=[0, 10, 14, 18, 22], 40 | debug_flag=args.debug_flag if args.debug_flag else False 41 | ) -------------------------------------------------------------------------------- /py36/exchange_9.9.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python3 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称:exchange_9.9.py 5 | Author: yangyang 6 | 功能: 7 | Date: 2022-5-7 8 | cron: 10 59 9,15 * * * 9 | new Env("券后9.9"); 10 | ''' 11 | from exchange_lib import * 12 | 13 | if __name__ == "__main__": 14 | url = "https://api.m.jd.com/client.action?functionId=centerReceiveCoupon&appid=XPMSGC2019&monitorSource=&client=m&eu=5616666313239356&fv=4683736316461646" 15 | headers = { 16 | "accept": "application/json, text/plain, */*", 17 | "accept-language": "en-US,en;q=0.9", 18 | "accept-encoding": "gzip, deflate, br", 19 | "content-type": "application/x-www-form-urlencoded", 20 | "origin": "https://h5.m.jd.com", 21 | "x-request-with": "com.jingdong.app.mall", 22 | "referer": "https://h5.m.jd.com/", 23 | "sec-fetch-dest": "empty", 24 | "sec-fetch-mode": "cors", 25 | "sec-fetch-site": "same-site" 26 | } 27 | # extend = "A0F322DB0C038E1603CAC2127B1D86BC0F09FFD58755FE96E1687E0350887FBA79997E8E037402B0F6EF97C2D50C376F1B80FD03148C5F7D1054DBAE7D8F6D995F271D3665A05F94AB2F5C83B6D04B1B80251EF1D2F4633121F074F21AB9B37948B88A080E5C2891179D54F7ABB3756673D538D9372A24D540DDFB6C7C4541793A8C1E67C32FD58559501873FAD35D3FAF0788F5881EF1D96C826EA822F393642E93EF2864D4897D9C3FD1FD190BDBDAB8B1A95438847E5310BAC4F859166A9DBAE68C094DD31B5C5003C4C44373373F" 28 | 29 | extend = "A0F322DB0C038E1603CAC2127B1D86BC0F09FFD58755FE96E1687E0350887FBA79997E8E037402B0F6EF97C2D50C376F1B80FD03148C5F7D1054DBAE7D8F6D995F271D3665A05F94AB2F5C83B6D04B1B80251EF1D2F4633121F074F21AB9B3795DEACE40B717C2B866502C1577E6DC65E9B3BA97EBD16C414EB97B9758C203763A8C1E67C32FD58559501873FAD35D3FAF0788F5881EF1D96C826EA822F393642E93EF2864D4897D9C3FD1FD190BDBDA0D3E790119A83BE78D78AB958319ABAABAE68C094DD31B5C5003C4C44373373F" 30 | body_dict = { 31 | "extend": extend, 32 | "rcType": "1", "source": "couponCenter_app", "random": "7172621", "couponSource": "1", 33 | "extraData": "{\"log\":\"1664262320487~1zcCSCr3sAvMDFHQ1hvTjAxMQ==.dnVuW3xxcWpWf3NzaxEUAHVgDAUOdzM/MHZvbkN7a3ImXTB2PSY=.e8166796~5,1~52A8C75FE07D55CA0A9C1BCBC761465F9927C7A4~1jjtok1~C~SBNBXhEDaWQVFEZbXhELbhFXCB8OARoEeh9mHUAfRxseG10DHwIEHwd4HwIKHggXBgIFH0cTGRFXDh8ODhoEeB8BCRkCHQkCCRVCEGgfEVZHXREDAwgVFEFGEQkTBAUFDQAPCwUDDAQDCQELAwwQFRtBV1ERCRNBR0dNRhsVFEVQUhELF1VVTUZNTUNTFx8RQVFdEQNpDRUDAAUfBR0EAh8IHgxkGhBfWRELBh8RWkEbAxRUUwUABQYGCl9XXQgCVldRVlACVQILBg8BAAFQVgIDUREfG1xJGwwQeVpdRE0TUlhAWlEABhcfEUUXCQIPBA0LAAAGAQMFDQQfG1hSGwwQGARQAQYGVl9QCgBVARhWUlcDAgEAV10BAQRUV1JVGFYBDwMNCQVXDQoBVFBVBwAHWg1TA1QDCgBXCgsMUA5cAFRRAQcTGRFVSVAbAxQQGRFdRxcJEX5dVl5aVxV6XVIbER8bXFhPFAgXCgsCBgMRFRBKWkQQD2gLAA0fAAABZBUUQFoRCWoXfnoZChsVFFNbV0FeXFcRFRAAGxoQBAIdAxsFERUQAAEFAQURHxMABQIPBA8PBQMGAQAIBgYFFAYPAQUFBgUAAAMHBQgEDQ8UHhcCEWwZEVpWUxsDFFRTVVVXU0dHGx4bWFwQDxFGExkRUFAQAxtBARsCHQEXHxFaVGZPFAgXAwITGRFRXRADG0RTW1dcXAgEAg4ADwsHEBkRXlsXCWgIHgkVBm8ZEVFdWlQRAxAIDwAGBwUBAw0EBQEERwh7UFlrZmNQW0VDf31zXWhtdUplYXJKdFUEBBhkY317Y1sKYG9na3xQA3dmYmBCY2ttUV54XGBkcXZocn5Eb3h6CANcZnViYWd3fW91QQFvfkJ6XH9mVEZ1cG9+ZkhWGHdLBQpyXmdxfnRzRGNgeAV7SUp1fWxjW1NlRGNzYFxwdmpoUHNnRHp9d2ZHcWBsYXFnbwR3dFJ0dmFZanxiZwd/SgRgfWBwfn9qf0d7WmZ4Y3BYCHNRbGBzcFBRemd6BHIBCX51Smd0f3MBV2BsZ2NwTmNdeHtGd39LdAZwb3NjeHELdntycl9weE5/Z3Bif3BnZkBwWUpPegNkVHxIWWJ9fGdfX0wCfHZaXg16d3wHdHtRZHBifnpyRH1sdENeUGpncmpwW1h7fWd3fWZzd2t/WWBJHQsLCwAABwVSTUkZAk1HTHtHYgJzdWJwDWZmaAd+emN8ZGsCBVd2X153flJ4VmJhZX5zAnpuZWtvd3VnYWRjQkt7b0psWHNebHBSWXRkcFFrentjc292ZnN3d2Z4cXh4B2ZzdlhkbVhianYJYHBhUmZgdndxUnxaWnNwXnh0ZlZkZnRsVm99dGN7dXV8cmBUXXt7UXx4SwJBAUFXRksQFRtbQVIRCRMXTg==~19cnnnp\",\"sceneid\":\"couponNinePointNineHome\"}"} 34 | 35 | # 感冒灵 36 | extend = "43637CD87226EA2E335863F219ABC3D7F6C12FFEF67B4A334C3FD21871640F7283AB3B66E44F81A17C1A6A624A9DA4801B80FD03148C5F7D1054DBAE7D8F6D995F271D3665A05F94AB2F5C83B6D04B1BE54C50985C41FD2D58DBA76F2CD6DB02AC56646B328B4C44646B973087A7213FF3A98E7DBB08CFBC1DFCF12089B6A3533A8C1E67C32FD58559501873FAD35D3FED6926BB1743834D4361F61A275BD74B2E93EF2864D4897D9C3FD1FD190BDBDA8FE0F737B1945FC4B1D71C3FE08EF38392E65B68F750B18F516AF30F55398C7150AC93F8FAD90D456227C60734534054" 37 | body_dict = { 38 | "extend": extend, 39 | "rcType":"1","source":"couponCenter_app","random":"2908621","couponSource":"1","extraData":"{\"log\":\"1664298182254~1KDw59zPMGzMDF3bE5FRTAxMQ==.Rlp4cXdOVH9zc0VVejsQGDV3HCk9VB8HO0ZAeGlwW10wdztGEjA=.59d6dec8~5,1~9F31050F51E8246CEDE624F5182C8C173B9BEB47~0rr2xke~C~SRZNWhACbG4fGkVbVBAOYhVWDRoFZRQHZBV2fgkbAxYHAwMURRcVEFAOGgRuGwViFHV+dh4FFwcCCBtHEWUdF15AWhsNAxQVQEAaCxcIBAINBQsABgUHDQYCDwoMDBUeGkBWVxoLF01GQE1DEBQVRFZZEw8bVFJNQ0ZMQlIRFBNFXVwWA2wGFAIBAxQHGQgDGAgbB2UbEVlSEw8IHhZaRBACFVVVDgIBCgcNX1JWCQNXUVpUVA5UBQsDBAABAFZdAAddEBgbWUIaDRF/UV9AQRJVWEVRUAEHERQTQRsIBQ8BBgoOCwIAAwcMBhgbXVkaDREeD1IFCgdRX1UBAVQAHl1QUw8DBgBSVgAABVJcUFEUVwYPBgYIBFYLAQNQXFQAAAJRDFICUggIBFsLDAxVBV0BVVcKBRcVEFJJVRACFREfGl9DGwgWflhdX1tWE3FfVhcQGBtZU04VCREBCQYKAhYVFUFbRREJYwkEAR4HAARvFBVBXBoLbht/fRkPEBQVUl1cQ1pQVhYVFQsaGxECCR8HFwQWFRULAAQAAxodFwwEBQ8BBA4EAgAKAgwKBwIUAwQABAQADgIEDwYCCAEGDhUfEQkTaBUQXVZWEAIVVVVeV1NfRkAbGxBZXREJGkQXFRBXUBUIGkAAHQkfBRseFlpRbU4VCREIABcVEFZdFQgaRVJdXF5YBAANCQ8ECgYRHxpcXxsIbwgbAhQHbh8aU1lWVRYDFQMOAQcBAQkEDAEHDAVMCX5nAEsFf25LBmN6dnIDVl1ye2NDc010UA8FGWBmQHRTbmR2bWJGAG0DdXVgT1plYFIPRXFfRAN1WlZxeWZVYHF/YQplfUJ4X0tYc3VwT119YQwCe1F/BHR2Qn51cANRdHENdXN7XGt/TkBEcWUFCnh3fFZ3U25paQhwen9acWpyZktUfFRhZHhBa2N7QFlxcF0CUHRzWnR/VHp9fF1qfXZlf3V8XFJlcWwHR3dsCWBqS1t2cHNTfHIAT3N7aAIAfHBRWXFxVwF/UnBxZ1cDdmhAQFp9A2xdf3Z4c30IB2N+QWBWcnAMWmdKYWJnA1tGck5ZTnBvcwl6A0BScHF3f38JblliZHZrfWNwVGJ3DQFxT355d19wTXhgDXVxc3VxYmIAU3puf1Z8XHAMfVtLcX1mDUIaC1UEXFMLVghPTBUDSkdJcEZkW31/dGReYGJ/X3NucmFrb10NXWBYQWZ6CH1XZHpwUXwDYWt0cH5ja3UIZmQIXnVvdQNqZXZpXWlzb3pjCH5UbmJpdGB3e19lYk1WZG1yVWZ+SWxsZERsZVp9UnYCcWZ2a3BnfF8Ka2ACV05jZ3R4cV5yc31PA2RqSXR1d0NadnBPcmB7QHtnaEp9c3JFdVRycXlVcAhecHx2QWx1cnp7cF1wVHFVQ2t9UFhnbXB4X3N2AXN0UwMOTQhQX1pHWEEVHhpaQFQaCxcbTw==~0a6rhcq\",\"sceneid\":\"couponNinePointNineHome\"}"} 40 | 41 | args = parseArgs() 42 | 43 | ExchangeManagement( 44 | url=url, 45 | headers=headers, 46 | headers_user_agent_random_flag=False, 47 | user_agent="jdapp;android;10.5.2;;;appBuild/96428;ef/1;ep/%7B%22hdid%22%3A%22JM9F1ywUPwflvMIpYPok0tt5k9kW4ArJEU3lfLhxBqw%3D%22%2C%22ts%22%3A1655122900598%2C%22ridx%22%3A-1%2C%22cipher%22%3A%7B%22sv%22%3A%22EG%3D%3D%22%2C%22ad%22%3A%22EJvuZwZtYwYnCtqzDtrwDK%3D%3D%22%2C%22od%22%3A%22YtLwCzc0DQG3ZNOzEQS2Zq%3D%3D%22%2C%22ov%22%3A%22Ctq%3D%22%2C%22ud%22%3A%22EJvuZwZtYwYnCtqzDtrwDK%3D%3D%22%7D%2C%22ciphertype%22%3A5%2C%22version%22%3A%221.2.0%22%2C%22appname%22%3A%22com.jingdong.app.mall%22%7D;jdSupportDarkMode/0;Mozilla/5.0 (Linux; Android 9; MI 6 Build/PKQ1.190118.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/89.0.4389.72 MQQBrowser/6.2 TBS/046010 Mobile Safari/537.36", 48 | body_dict=body_dict, 49 | batch_size=args.batch_size if args.batch_size > 0 else 12, 50 | other_batch_size=0, 51 | second_ahead=0.16, 52 | sleep_time=0, 53 | thread_number=args.thread_number if args.thread_number > 0 else 35, 54 | append_flag=False, 55 | log_flag=False, 56 | sign_flag=False, 57 | day_or_week='day', 58 | post_flag=True, 59 | print_type="cmd", 60 | proxy_flag=args.proxy_flag if args.proxy_flag else False, 61 | coupon_type="9.9", 62 | cookie_type=args.cookie_type if args.cookie_type != 'None' else 'mine_coupons') \ 63 | .executeInDesktop( 64 | clock_list=[10], 65 | debug_flag=args.debug_flag if args.debug_flag else False 66 | ) 67 | -------------------------------------------------------------------------------- /py36/exchange_check_coupons.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称:exchange_check_coupons.py 5 | Author: yangyang 6 | 功能: 7 | Date: 2022-5-22 8 | cron: 0 23 14,20 * * * 9 | new Env("优惠券通知"); 10 | ''' 11 | from exchange_lib import * 12 | 13 | if __name__ == '__main__': 14 | 15 | args = parseArgs() 16 | 17 | ExchangeManagement(cookie_type=args.cookie_type if args.cookie_type != "None" else "mine") 18 | 19 | cookies = os.environ["JD_COOKIE"].split('&') if "JD_COOKIE" in os.environ else [] 20 | 21 | summary = "优惠券速览" 22 | content = "" 23 | for cookie in cookies: 24 | content += findCoupons(cookie) 25 | print(content) 26 | sendNotification(summary=summary, content=content) 27 | -------------------------------------------------------------------------------- /py36/exchange_check_redpacket.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称:exchange_check_coupons.py 5 | Author: yangyang 6 | 功能: 7 | Date: 2022-5-22 8 | cron: 0 23 14,20 * * * 9 | new Env("红包通知"); 10 | ''' 11 | from exchange_lib import * 12 | 13 | if __name__ == '__main__': 14 | 15 | args = parseArgs() 16 | 17 | ExchangeManagement(cookie_type=args.cookie_type if args.cookie_type != "None" else "mine") 18 | 19 | cookies = os.environ["JD_COOKIE"].split('&') if "JD_COOKIE" in os.environ else [] 20 | 21 | summary = "红包速览" 22 | content = "" 23 | for cookie in cookies: 24 | content += findRedPacket(cookie) 25 | print(content) 26 | sendNotification(summary=summary, content=content) 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /py36/exchange_evaluation.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | from exchange_lib import * 3 | try: 4 | import jieba.analyse 5 | except Exception: 6 | print("Error in importing jieba module, please run 'pip install jieba' in command line.") 7 | exit() 8 | 9 | jieba.setLogLevel(jieba.logging.INFO) 10 | 11 | def generateComment(pname): 12 | try: 13 | name = jieba.analyse.textrank(pname, topK=5, allowPOS='n')[0] 14 | except: 15 | name = "宝贝" 16 | 17 | datas = { 18 | "start": [ 19 | "考虑买这个$之前我是有担心过的,因为我不知道$的质量和品质怎么样,但是看了评论后我就放心了。", 20 | "买这个$之前我是有看过好几家店,最后看到这家店的评价不错就决定在这家店买 ", 21 | "看了好几家店,也对比了好几家店,最后发现还是这一家的$评价最好。", 22 | "看来看去最后还是选择了这家。", 23 | "之前在这家店也买过其他东西,感觉不错,这次又来啦。", 24 | "这家的$的真是太好用了,用了第一次就还想再用一次。", 25 | "其实一直都想入手一款$,但找不到合适的。", 26 | "做工看的出很优秀,手感也很好,和描述几乎一致。", 27 | "这个价格来说很具性价比,但是质量还是很不错的,装东西够用了,非常合适,质量也好," 28 | "没感觉到什么难闻的味,能收纳好多东西,结实,实用,方便,厚度和 颜色都是我想要的,最重要的是高度刚刚好" 29 | ], 30 | "mid": [ 31 | "收到货后我非常的开心,因为$的质量和品质真的非常的好!", 32 | "拆开包装后惊艳到我了,这就是我想要的$!", 33 | "快递超快!包装的很好!!很喜欢!!!", 34 | "包装的很精美!$的质量和品质非常不错!", 35 | "收到快递后迫不及待的拆了包装。$我真的是非常喜欢", 36 | "真是一次难忘的购物,这辈子没见过这么好用的东西!!", 37 | "收纳很漂亮很可爱,材质做工很好!无异味!大小尺寸齐全", 38 | "这个价位很满意了,拿回来一会儿就装好", 39 | "接头是那种很有韧性的胶、敲打的过程中不会裂开", 40 | "很有包容性、装好以后不会晃动、很稳,物流也快、五星好评" 41 | ], 42 | "end": [ 43 | "经过了这次愉快的购物,我决定如果下次我还要买$的话,我一定会再来这家店买的。", 44 | "不错不错!", 45 | "我会推荐想买$的朋友也来这家店里买", 46 | "真是一次愉快的购物!", 47 | "大大的好评!以后买$再来你们店!( ̄▽ ̄)", 48 | "大家可以买来试一试,真的是太爽了,一晚上都沉浸在爽之中", 49 | "这种物件,不但轻便,而且在自己拼装完成后有一种成就的喜悦,真是宿舍家居良品", 50 | "自己组装成功,跟价格相称,比较简易", 51 | "操作比较方便。到时候也好拆卸,没想到这么便宜竟然这么好。", 52 | "东西很不错,木头也不错。", 53 | "特别好,而且功能百搭。", 54 | "没有色差,大小合适,组装简单,质量很好" 55 | ] 56 | } 57 | return (random.choice(datas["start"]) + random.choice(datas["mid"]) + random.choice(datas["end"])).replace("$", name) 58 | 59 | 60 | def getOrderList(cookies, shop_name=''): 61 | url = 'https://wq.jd.com/bases/orderlist/list?order_type=8&start_page=1&page_size=100' 62 | headers = { 63 | "accept": "application/json", 64 | "accept-encoding": "gzip, deflate, br", 65 | "accept-language": "zh-CN,zh;q=0.9", 66 | "connection": "keep-alive", 67 | "content-type": "application/x-www-form-urlencoded", 68 | 'origin': 'https://comment.m.jd.com', 69 | "referer": "https://wqs.jd.com/order/orderlist_merge.shtml?jxsid=16355625882984298965&orderType=all&ptag=7155.1.11", 70 | 'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1' 71 | } 72 | result = {} 73 | for cookie in cookies: 74 | result[cookie] = [] 75 | headers['cookie'] = cookie 76 | req = requests.get(url, headers=headers).json() 77 | # print(req) 78 | if 'orderList' not in req: 79 | continue 80 | for order_list in req['orderList']: 81 | 82 | if shop_name in order_list['shopInfo']['shopName']: 83 | 84 | for j in order_list['buttonList']: 85 | if j['id'] == 'toComment': 86 | cname = j['name'] # 评价按钮名字 87 | if cname is None: 88 | continue 89 | 90 | oid = order_list['orderId'] 91 | shopId = order_list['shopInfo']['shopId'] 92 | for order_item in order_list['productList']: 93 | pid = order_item['skuId'] 94 | name = order_item['title'] 95 | result[cookie].append({ 96 | 'name': name, 97 | 'oid': oid, 98 | 'pid': pid, 99 | 'cname': cname, 100 | 'shopId': shopId, 101 | 'shopName': order_list['shopInfo']['shopName'], 102 | 'comment': generateComment(name) 103 | }) 104 | return result 105 | 106 | def commentOrders(comment_orders_dict, proxy_flag=False): 107 | url = "https://api.m.jd.com/api?appid=jd-cphdeveloper-m&functionId=sendEval&loginType=2&sceneval=2&g_login_type=1&g_ty=ajax&appCode=ms0ca95114" 108 | headers = { 109 | "accept": "application/json", 110 | "accept-encoding": "gzip, deflate, br", 111 | "accept-language": "zh-CN,zh;q=0.9", 112 | "connection": "keep-alive", 113 | "content-type": "application/x-www-form-urlencoded", 114 | 'origin': 'https://comment.m.jd.com', 115 | "referer": "https://comment.m.jd.com/", 116 | 'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1' 117 | } 118 | log_num = 0 119 | for value in comment_orders_dict.values(): 120 | log_num += len(value) 121 | logs = getLogs(num=log_num) 122 | log_num = 0 123 | order_id_set = set() 124 | for cookie, orders in comment_orders_dict.items(): 125 | headers['cookie'] = cookie 126 | for order in orders: 127 | body = { 128 | "productId": order['pid'], 129 | "orderId": order['oid'], 130 | "score": 5, 131 | "content": order['comment'], 132 | "commentTagStr": 1, 133 | "userclient": 29, 134 | "anonymous": 0, 135 | "syncsg": 0, 136 | "scence": 101100000 137 | } 138 | 139 | response = requests.post(url=url, headers=headers, data=generateBody(body, logs[log_num]), proxies=getProxies(proxy_flag)).json() 140 | 141 | if 'errMsg' in response and response['errMsg'] == 'success': 142 | printT(f"{getUserName(cookie)}: 评价成功!店铺:{order['shopName']}, 内容:{order['comment']}") 143 | else: 144 | printT(f"{getUserName(cookie)}: 评价失败!店铺:{order['shopName']}, 日志:{response}") 145 | 146 | if order['oid'] not in order_id_set: 147 | 148 | se_url = f'https://wq.jd.com/eval/SendDSR' 149 | se_data = { 150 | 'userclient': '29', 151 | 'orderId': order['oid'], 152 | 'otype': 5, 153 | 'DSR1': 5, 154 | 'DSR2': 5, 155 | 'DSR3': 5, 156 | 'DSR4': 5, 157 | 'g_login_type': '0', 158 | 'g_ty': 'ls' 159 | } 160 | se_req = requests.get(se_url, headers=headers, params=se_data, proxies=getProxies(proxy_flag)).json() 161 | if se_req['errMsg'] == 'success': 162 | order_id_set.add(order['oid']) 163 | printT(f"{getUserName(cookie)}: 评价服务成功!店铺:{order['shopName']}") 164 | else: 165 | printT(f"{getUserName(cookie)}: 评价服务失败!店铺:{order['shopName']}") 166 | 167 | log_num += 1 168 | time.sleep(random.randint(5, 10)) 169 | 170 | 171 | if __name__ == '__main__': 172 | 173 | args = parseArgs() 174 | 175 | ExchangeManagement(cookie_type=args.cookie_type if args.cookie_type != "None" else "mine") 176 | cookies = os.environ['JD_COOKIE'].split("&") 177 | os.environ['proxy_ip'] = args.proxy_ip if len(args.proxy_ip) else "127.0.0.1:7890" 178 | result = getOrderList(cookies, shop_name=args.shop_name) 179 | for key, value in result.items(): 180 | for item in value: 181 | print(getUserName(key), item) 182 | commentOrders(result, proxy_flag=args.proxy_flag if args.proxy_flag else False) 183 | -------------------------------------------------------------------------------- /py36/exchange_general_long_key.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python3 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称:exchange_general_long_key.py 5 | Author: Fisher 6 | 功能:适配定点抢长key类券,需在fisher_configure.json文件内创建对应对象并填写"discount"、“activityId”和"clock_list"参数;不需填写长key,会根据activityId和discount自动搜索 7 | Date: 2022-5-12 8 | cron: 0 59 9,13,19,23 * * * 9 | new Env("适配长key券"); 10 | ''' 11 | from exchange_lib import * 12 | 13 | if __name__ == "__main__": 14 | 15 | headers = { 16 | "Accept": "*/*", 17 | "Accept-Encoding": "gzip, deflate", 18 | "Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7", 19 | "Connection": "keep-alive", 20 | "Content-Type": "application/x-www-form-urlencoded", 21 | 'origin': 'https://pro.m.jd.com', 22 | "Referer": "https://prodev.m.jd.com/jdlite/active/3H885vA4sQj6ctYzzPVix4iiYN2P/index.html?sid=bf6ae253e73f472d5ec294810f46665w&un_area=7_502_35752_35860" 23 | } 24 | 25 | headers = { 26 | "Accept": "*/*", 27 | "Accept-Encoding": "gzip, deflate", 28 | "Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7", 29 | "Connection": "keep-alive", 30 | "Content-Type": "application/x-www-form-urlencoded", 31 | 'origin': 'https://pro.m.jd.com', 32 | "Referer": "https://prodev.m.jd.com/mall/active/3WWbQbmmcqceFHsJbat8Zv1GJaTG/index.html" 33 | } 34 | 35 | body_dict = { 36 | 'activityId': '4TFZNrP43yHwUV3QvJrEvcK53yjM', 37 | 'scene': '1', 38 | "args": "key=E5C4099AC12CA45D0E1392A0395132BB089A2C409B4CDA6B70FD5029A59C3E0B3C181682F3E1732FAC58DB24B9848D90_bingo,roleId=DFA527DAB656121EC55AAF58C1F10841784A28A4284BC0382CA98D709DCB6B71FC4A630392E6611D106F0995B2F5BE5A55014C97F678F311D1F5391B5C888BBE08FCC8F75C99007DAF32582F8576B48D1EE01B07D319ADEF923618980493E3176BD11D1CC689D361061FE59FCE4D3EB4322E0B215226E76B91C22862C087D3A5882D2C83A49CCACE72CB48AB8E518F834F41D4C17481F1F4CE80642B0D3A2B7C_bingo,strengthenKey=19F512DCD8EE34ABE9C4FB4A92C2F42A72D6B80C9B38F8FE98AE3D2BBDCD6808_bingo" 39 | # "args": "key=71A0B43A5801A76425DDBF4945A31FD0A482428781387C293E94FE5D03130B8290CB83F3DEC7A6BC983EBAD60BB41090_bingo,roleId=9BD67B901DB469651E99E6F7D3AD5D4C1AA34CF13B4798B7631A80C978D94B238519E7CFEACA3172B01DA4825405A9DF008A5736EE708F9F4CC1789FE2954CAB0263CD293EAF6D72A4391D16068BA147C40F89C0442154D15341E07CCEBBA886CAE551448E5C321B3502EFCEC85ABADD5B568D52236F53017161146D0CB29D26CD99AC01EED9FA85BCA728275411591E2941E0E19C557799258FB3E209E132D6_bingo,strengthenKey=19F512DCD8EE34ABE9C4FB4A92C2F42AE84B9E1109B76B738665CAD2CB9C6FC3_bingo" 40 | # "args": "key=3DDD4FEE153EDE4F35C6F88EE2E6B0E49BD9CE09F02D3C0AA15513971D7D389ED4783B3577241CE3AD9CF93B4916BF47_bingo,roleId=CBA252302CA43DD8492A5C2BB15E348D8DB7DBDFCD70E07A4B7351090783521AFE55E69D64CAE1EDBE989BACFC81D94CBB81AC1F577723DFF9EB26B402E07D8106A25909D15C0C2B436CFE2542B89FE27AF72604A4B815DC880C2C087938C579F2F2CD22FDC08402E7692AF5E3FFF0F25810D208F7217DF27A4AA244D3F75147B18AE19450BBDBC8E2CD3E613B25500A356AB6ADDF084C5A08C512A0F7B62435_bingo,strengthenKey=19F512DCD8EE34ABE9C4FB4A92C2F42ADA4942001794CD9B77862303197584D9_bingo" 41 | } 42 | url = 'https://api.m.jd.com/client.action?functionId=newBabelAwardCollection&client=wh5&clientVersion=1.0.0' 43 | 44 | args = parseArgs() 45 | 46 | if args.coupon_type == "11-10": 47 | body_dict["args"] = "key=A34B6A46F386EC70113B577994469C1B49D9B59EFF1FDECA912461CA55C67D1D24E41C2888131D20F7F344D85F818827_bingo,roleId=7B7EECE5B05B6737BA5C854DC24388B1ADE7E524DF1E4AD18D961FA660EE34357FC23002A660F27F3F6B88AC400804601D2B2CBED81FF4307C8711CFDD271B3AD8FAC5993180E24F47E96BFC553E852625B115C6DACA1DA819326786635BE1B606304759801B859BBB563EA50573A032D414FCF70559C38860E4176AD464BAF15A8B10CC96430795745A39240FDE5D058EB0A12BDC898EADF0967CBE44006DF0_bingo" 48 | elif args.coupon_type == "15-5": 49 | body_dict["args"] = "key=AF55BC22EF3EBC44F28919EE34B3835ABE5C573C117F01A6A3D8F8CF3C168A08138963DDFFE0C2AB8E9AF062CFAF191D_bingo,roleId=DFA527DAB656121EC55AAF58C1F10841B12A24EFFA45F776EF6BD09851D33D26BB067058CC0082933425C3E1E6DF953520E5E1F68BE7E6A21C5042664648B378401C1007A7FDF66AB9FE83FCA0A4748D1015514C5EEAD3C72332201BCF4D7BA267C52D74E04752DCF0B9F82FDF9A8DD6CB0F6E05C231D60CA2FEB273F40959F8F7A8BF660D80E1DC07697D25DC57FFA7AA63951EC6E7A51F8C49B3A049536FD5_bingo,strengthenKey=19F512DCD8EE34ABE9C4FB4A92C2F42AFCFDB2D343F06C660D24D9EA74C6869A_bingo" 50 | else: 51 | body_dict['args'] = "key=E5C4099AC12CA45D0E1392A0395132BB089A2C409B4CDA6B70FD5029A59C3E0B3C181682F3E1732FAC58DB24B9848D90_bingo,roleId=DFA527DAB656121EC55AAF58C1F10841784A28A4284BC0382CA98D709DCB6B71FC4A630392E6611D106F0995B2F5BE5A55014C97F678F311D1F5391B5C888BBE08FCC8F75C99007DAF32582F8576B48D1EE01B07D319ADEF923618980493E3176BD11D1CC689D361061FE59FCE4D3EB4322E0B215226E76B91C22862C087D3A5882D2C83A49CCACE72CB48AB8E518F834F41D4C17481F1F4CE80642B0D3A2B7C_bingo,strengthenKey=19F512DCD8EE34ABE9C4FB4A92C2F42A72D6B80C9B38F8FE98AE3D2BBDCD6808_bingo" 52 | 53 | 54 | ExchangeManagement( 55 | url=url, 56 | headers=headers, 57 | headers_user_agent_random_flag=True, 58 | user_agent="", 59 | body_dict=body_dict, 60 | activitiId_random_flag=False, 61 | batch_size=args.batch_size if args.batch_size > 0 else 30, 62 | other_batch_size=0, 63 | second_ahead=0, 64 | sleep_time=0, 65 | thread_number=args.thread_number if args.thread_number > 0 else 20, 66 | append_flag=False, 67 | log_flag=True, 68 | sign_flag=False, 69 | day_or_week='day', 70 | post_flag=True, 71 | proxy_flag=args.proxy_flag if args.proxy_flag else False, 72 | proxy_ip=args.proxy_ip if len(args.proxy_ip) else "", 73 | coupon_type=args.coupon_type if args.coupon_type != 'None' else '15-5', 74 | cookie_type=args.cookie_type if args.cookie_type != 'None' else 'mine_coupons') \ 75 | .executeInDesktop( 76 | debug_flag=args.debug_flag if args.debug_flag else False 77 | ) -------------------------------------------------------------------------------- /py36/exchange_general_short_key.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python3 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称:exchange_general_short_key.py 5 | Author: Fisher 6 | 功能:适配定点抢短key类券,需在fisher_configure.json文件内创建对应对象并填写"args"和"clock_list"参数 7 | Date: 2022-5-12 8 | cron: 0 59 9,13,19,23 * * * 9 | new Env("适配短key券"); 10 | ''' 11 | 12 | from exchange_lib import * 13 | 14 | import sys 15 | 16 | if __name__ == "__main__": 17 | 18 | headers = { 19 | "Accept": "*/*", 20 | "Accept-Encoding": "gzip, deflate", 21 | "Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7", 22 | "Connection": "keep-alive", 23 | "Content-Type": "application/x-www-form-urlencoded", 24 | 'origin': 'https://pro.m.jd.com', 25 | "Referer": "https://prodev.m.jd.com/jdlite/active/3H885vA4sQj6ctYzzPVix4iiYN2P/index.html?sid=bf6ae253e73f472d5ec294810f46665w&un_area=7_502_35752_35860", 26 | } 27 | 28 | body_dict = { 29 | # "activityId":"e9z6GPMVDF4fZ2X6NNwJfot4yxhS", 30 | "activityId": "6GPMX6Ne9zNt4yVDF4wJfofZ2xhS", 31 | "from":"H5node", 32 | "scene":"1", 33 | "args": "key=c1m3c0s0o6ae485e936c029467cb3391,roleId=83519576" 34 | } 35 | 36 | url = 'https://api.m.jd.com/client.action?functionId=lite_newBabelAwardCollection&client=wh5&clientVersion=1.0.0' 37 | 38 | args = parseArgs() 39 | 40 | ExchangeManagement( 41 | url=url, 42 | headers=headers, 43 | headers_user_agent_random_flag=True, 44 | user_agent="", 45 | body_dict=body_dict, 46 | activitiId_random_flag=False, 47 | discount="", 48 | batch_size=args.batch_size if args.batch_size > 0 else 10, 49 | other_batch_size=0, 50 | second_ahead=0, 51 | sleep_time=0.01, 52 | thread_number=args.thread_number if args.thread_number > 0 else 20, 53 | append_flag=False, 54 | log_flag=False, 55 | sign_flag=False, 56 | day_or_week='day', 57 | post_flag=True, 58 | proxy_flag=args.proxy_flag if args.proxy_flag else False, 59 | proxy_ip=args.proxy_ip if len(args.proxy_ip) else "", 60 | coupon_type=args.coupon_type if args.coupon_type != 'None' else 'general_coupons', 61 | cookie_type=args.cookie_type if args.cookie_type != 'None' else 'mine_coupons')\ 62 | .executeInDesktop( 63 | debug_flag=args.debug_flag if args.debug_flag else False, 64 | ) -------------------------------------------------------------------------------- /py36/exchange_plus.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python3 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称:exchange_plus.py 5 | Author: yangyang 6 | 功能: 7 | Date: 2022-5-12 8 | cron: 0 59 9,13,19,23 * * * 9 | new Env("plus权益-无验证券模板"); 10 | ''' 11 | 12 | from exchange_lib import * 13 | 14 | if __name__ == "__main__": 15 | 16 | headers = { 17 | "Host": "rsp.jd.com", 18 | "accept": "application/json, text/plain, */*", 19 | "user-agent": "jdapp;android;10.5.2;;;appBuild/96428;ef/1;ep/%7B%22hdid%22%3A%22JM9F1ywUPwflvMIpYPok0tt5k9kW4ArJEU3lfLhxBqw%3D%22%2C%22ts%22%3A1654535539316%2C%22ridx%22%3A-1%2C%22cipher%22%3A%7B%22sv%22%3A%22EG%3D%3D%22%2C%22ad%22%3A%22CzUmCzvsYzSnCtYzDNq0ZG%3D%3D%22%2C%22od%22%3A%22YtLwCzc0DQG3ZNOzEQS2Zq%3D%3D%22%2C%22ov%22%3A%22Ctq%3D%22%2C%22ud%22%3A%22ENY1DNGnCNC1DNC0EJY4BJHtDNvvC2Y1DNUzCm%3D%3D%22%7D%2C%22ciphertype%22%3A5%2C%22version%22%3A%221.2.0%22%2C%22appname%22%3A%22com.jingdong.app.mall%22%7D;jdSupportDarkMode/0;Mozilla/5.0 (Linux; Android 9; MI 6 Build/PKQ1.190118.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/89.0.4389.72 MQQBrowser/6.2 TBS/045946 Mobile Safari/537.36", 20 | "origin": "https://plus.m.jd.com", 21 | "x-requested-with": "com.jingdong.app.mall", 22 | "sec-fetch-site": "same-site", 23 | "sec-fetch-mode": "cors", 24 | "sec-fetch-dest": "empty", 25 | "referer": "https://plus.m.jd.com/", 26 | "accept-encoding": "gzip, deflate, br", 27 | "accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7" 28 | } 29 | # Coco 30 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=60946520270113&_={int(round(time.time()*1000))}' 31 | # 万达 32 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=60946520269991&_={int(round(time.time()*1000))}' 33 | # 肯德基 34 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=60947948441996&_={int(round(time.time()*1000))}' 35 | 36 | # 烧仙草 coco 37 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=71704511585025&_={int(round(time.time()*1000))}' 38 | 39 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=71704534652075&_={int(round(time.time() * 1000))}' 40 | 41 | 42 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=71705057879950&_={int(round(time.time() * 1000))}' 43 | 44 | # 体检 45 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=71705009647680&_={int(round(time.time() * 1000))}' 46 | 47 | # 烧仙草 48 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=71704988678033&_={int(round(time.time() * 1000))}' 49 | 50 | # 万达 51 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=71704447587533&_={int(round(time.time() * 1000))}' 52 | 53 | args = parseArgs() 54 | 55 | ExchangeManagement( 56 | url=url, 57 | headers=headers, 58 | headers_user_agent_random_flag=True, 59 | user_agent="", 60 | body_dict={}, 61 | batch_size=args.batch_size if args.batch_size > 0 else 12, 62 | other_batch_size=0, 63 | second_ahead=0, 64 | sleep_time=0, 65 | thread_number=args.thread_number if args.thread_number > 0 else 20, 66 | log_flag=False, 67 | sign_flag=False, 68 | day_or_week='day', 69 | post_flag=False, 70 | proxy_flag=args.proxy_flag if args.proxy_flag else True, 71 | print_type="cmd", 72 | coupon_type="plus_quanyi", 73 | cookie_type=args.cookie_type if args.cookie_type != "None" else "mine_coupons").\ 74 | executeInDesktop( 75 | clock_list=[0, 10], 76 | debug_flag=args.debug_flag if args.debug_flag else True) -------------------------------------------------------------------------------- /py36/exchange_test_delay.py: -------------------------------------------------------------------------------- 1 | from exchange_lib import * 2 | 3 | 4 | def testRequestDelayThread(url, headers, body_dict, proxy_flag, thread_id, res_dict={}, post_flag=True): 5 | printT("Calculating request delay test...") 6 | 7 | start_time = time.time() 8 | try: 9 | if post_flag: 10 | res = requests.post(url=url, verify=False, headers=headers, 11 | data=body_dict, proxies=getProxies(proxy_flag), timeout=3) 12 | else: 13 | res = requests.get(url=url, verify=False, headers=headers, 14 | data=body_dict, proxies=getProxies(proxy_flag), timeout=3) 15 | # res_dict[thread_id] = time.time() - start_time 16 | res_dict[thread_id] = res.elapsed.total_seconds() 17 | # print(res.headers) 18 | print(res_dict[thread_id], time.time() - start_time) 19 | d = datetime.datetime.fromtimestamp(int(res.headers['X-API-Request-Id'].split('-')[-1]) / 1000) 20 | str1 = d.strftime("%Y-%m-%d %H:%M:%S.%f") 21 | 22 | 23 | # print(time.time() - start_time, res_dict[thread_id]) 24 | # printT(f"Current IP address and Port: {res.raw._connection.sock.socket.getsockname()}") 25 | except Exception: 26 | return 27 | 28 | 29 | def testRequestDelay(url, headers, body_dict, sleep_time=0.03, proxy_flag=False, post_flag=True): 30 | printT("Calculating request delay...") 31 | headers = json.loads(json.dumps(headers)) 32 | if "Cookie" in headers: headers['Cookie'] = "" 33 | if "cookie" in headers: headers['cookie'] = "" 34 | thread_number, threads, res_dict = 30, [], {} 35 | for i in range(thread_number): 36 | threads.append(threading.Thread(target=testRequestDelayThread, 37 | args=(url, headers, body_dict, proxy_flag, i, res_dict, post_flag, ))) 38 | for i in range(thread_number): 39 | threads[i].start() 40 | time.sleep(sleep_time) 41 | for i in range(thread_number): 42 | threads[i].join() 43 | res = sorted(res_dict.values()) 44 | res_dict = collections.Counter([int(100*x+1)/100.0 for x in res]) 45 | 46 | # import matplotlib.pyplot as plt 47 | # 48 | # params = { 49 | # 'figure.figsize': '8, 4' 50 | # } 51 | # plt.rcParams.update(params) 52 | # plt.bar(res_dict.keys(), res_dict.values(), width=0.01) 53 | # plt.show() 54 | 55 | printT(res_dict) 56 | res = [x[0] for x in res_dict.most_common(3)] 57 | if len(res): 58 | result = min(res) + 0.02 59 | printT(f"Request delay: {result}s.") 60 | return result 61 | else: 62 | printT("Warning: The proxy is not available! Set the delay to 0.12ms.") 63 | return 0.12 64 | 65 | 66 | if __name__ == "__main__": 67 | 68 | headers = { 69 | "Accept": "*/*", 70 | "Accept-Encoding": "gzip, deflate", 71 | "Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7", 72 | "Connection": "keep-alive", 73 | "Content-Type": "application/x-www-form-urlencoded", 74 | 'origin': 'https://pro.m.jd.com', 75 | "Referer": "https://prodev.m.jd.com/jdlite/active/3H885vA4sQj6ctYzzPVix4iiYN2P/index.html?sid=bf6ae253e73f472d5ec294810f46665w&un_area=7_502_35752_35860" 76 | } 77 | body_dict = { 78 | 'activityId': '3H885vA4sQj6ctYzzPVix4iiYN2P', 79 | 'scene': '1', 80 | 'args': 'key=6E3ED4217CA5BA50CC868072587749279A819E91EC8217F49BC1DB9DC674DA27CF93291755C086262CF2BD2DADDD8138_bingo,roleId=A921D0996A757D3D319487D17C0F25FE0F6830D8485A69E35623B13BFBA59D1E7C2386D90F3D9D3A6D752ADCDEAB0529AA56BDE4467494DC5590AEB5C7C950D03EA337E197D9AF250FA7148376C8A9C2C3FC8B2D9632A67F79B5A98776BF5B6C94F3F3F8F3770E265EF7D6CAD2E5F1B98EE03623B492E1C2B96EBC7500E20DAB9C2BBC9CBBA7AA027CBB17434C77651F9DE32AEAE13EA4C6B7660D4FD53E63FF_bingo,strengthenKey=3FE987FADD098B5D46BA38B21875A5EBD8C02F19572CB3C5CC0385902CD416A2FE3B5DC71CEBCF672000554484FB93E5_bingo' 81 | } 82 | url = 'https://api.m.jd.com/client.action?functionId=lite_newBabelAwardCollection&client=wh5&clientVersion=1.0.0' 83 | 84 | args = parseArgs() 85 | 86 | requests.packages.urllib3.disable_warnings() 87 | 88 | os.environ["PROXY_IP"] = args.proxy_ip if len(args.proxy_ip) else 'http://127.0.0.1:7890' 89 | 90 | if args.proxy_flag: 91 | printT(f"The proxy ip is set to {os.environ['PROXY_IP']}") 92 | 93 | testRequestDelay(url, headers, body_dict, 94 | sleep_time=0, 95 | proxy_flag=args.proxy_flag if args.proxy_flag else False, 96 | post_flag=True) 97 | -------------------------------------------------------------------------------- /py36/exchange_xiaomi.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | from exchange_lib import * 4 | 5 | cookie = '' 6 | 7 | headers = { 8 | "Host": "m.mi.com", 9 | "accept": "application/json, text/plain, */*", 10 | "content-type": "application/x-www-form-urlencoded", 11 | "origin": "https://m.mi.com", 12 | "x-requested-with": "com.tencent.mm", 13 | "sec-fetch-site": "same-origin", 14 | "sec-fetch-mode": "cors", 15 | "sec-fetch-dest": "empty", 16 | "referer": "https://m.mi.com/w/mishop_activity?_rt=weex&pageid=861&sign=e86407ce821e68e65aec6c7cdbab9dad&pdl=jianyu&g_device_id=xmlitedevice_urrjpnxhe9rfj00h", 17 | "accept-encoding": "gzip, deflate", 18 | "accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7" 19 | # "cookie": ".thumbcache_2959214a7e70e5f2bd017e23a2a3e462=KifJ0TJXA5D66fNHvMYtIakmi27D8KNo8Q2jNvDBF+GbRYXw6CUX+jHYIh2x+Ja3GZP+2Nsv3GTABOXDsVs3pw%3D%3D" 20 | } 21 | 22 | url = "https://m.mi.com/v1/activity/page_draw_query" 23 | 24 | body_dict = "activity_codes=0Tg3B8vHw8Xcrs57JfEmeA==" 25 | 26 | args = parseArgs() 27 | 28 | ExchangeManagement( 29 | url=url, 30 | headers=headers, 31 | headers_user_agent_random_flag=False, 32 | user_agent="Mozilla/5.0 (Linux; Android 9; MI 6 Build/PKQ1.190118.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/86.0.4240.99 XWEB/3263 MMWEBSDK/20210902 Mobile Safari/537.36 MMWEBID/2219 MicroMessenger/8.0.15.2020(0x28000F3D) Process/appbrand0 WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 miniProgram", 33 | body_dict=body_dict, 34 | batch_size=args.batch_size if args.batch_size > 0 else 12, 35 | other_batch_size=0, 36 | second_ahead=0, 37 | sleep_time=0, 38 | thread_number=args.thread_number if args.thread_number > 0 else 40, 39 | append_flag=False, 40 | log_flag=False, 41 | sign_flag=False, 42 | day_or_week='day', 43 | post_flag=True, 44 | print_type="cmd", 45 | proxy_flag=args.proxy_flag if args.proxy_flag else True, 46 | coupon_type="xiaomi", 47 | cookie_type=args.cookie_type if args.cookie_type != 'None' else 'xiaomi') \ 48 | .executeInDesktop( 49 | clock_list=[10], 50 | debug_flag=args.debug_flag if args.debug_flag else False 51 | ) 52 | -------------------------------------------------------------------------------- /py36/pytransform/__init__.py: -------------------------------------------------------------------------------- 1 | # These module alos are used by protection code, so that protection 2 | # code needn't import anything 3 | import os 4 | import platform 5 | import sys 6 | import struct 7 | 8 | # Because ctypes is new from Python 2.5, so pytransform doesn't work 9 | # before Python 2.5 10 | # 11 | from ctypes import cdll, c_char, c_char_p, c_int, c_void_p, \ 12 | pythonapi, py_object, PYFUNCTYPE, CFUNCTYPE 13 | from fnmatch import fnmatch 14 | 15 | # 16 | # Support Platforms 17 | # 18 | plat_path = 'platforms' 19 | 20 | plat_table = ( 21 | ('windows', ('windows', 'cygwin-*')), 22 | ('darwin', ('darwin', 'ios')), 23 | ('linux', ('linux*',)), 24 | ('freebsd', ('freebsd*', 'openbsd*')), 25 | ('poky', ('poky',)), 26 | ) 27 | 28 | arch_table = ( 29 | ('x86', ('i?86', )), 30 | ('x86_64', ('x64', 'x86_64', 'amd64', 'intel')), 31 | ('arm', ('armv5',)), 32 | ('armv6', ('armv6l',)), 33 | ('armv7', ('armv7l',)), 34 | ('ppc64', ('ppc64le',)), 35 | ('mips32', ('mips',)), 36 | ('aarch32', ('aarch32',)), 37 | ('aarch64', ('aarch64', 'arm64')) 38 | ) 39 | 40 | # 41 | # Hardware type 42 | # 43 | HT_HARDDISK, HT_IFMAC, HT_IPV4, HT_IPV6, HT_DOMAIN = range(5) 44 | 45 | # 46 | # Global 47 | # 48 | _pytransform = None 49 | 50 | 51 | class PytransformError(Exception): 52 | pass 53 | 54 | 55 | def dllmethod(func): 56 | def wrap(*args, **kwargs): 57 | return func(*args, **kwargs) 58 | return wrap 59 | 60 | 61 | @dllmethod 62 | def version_info(): 63 | prototype = PYFUNCTYPE(py_object) 64 | dlfunc = prototype(('version_info', _pytransform)) 65 | return dlfunc() 66 | 67 | 68 | @dllmethod 69 | def init_pytransform(): 70 | major, minor = sys.version_info[0:2] 71 | # Python2.5 no sys.maxsize but sys.maxint 72 | # bitness = 64 if sys.maxsize > 2**32 else 32 73 | prototype = PYFUNCTYPE(c_int, c_int, c_int, c_void_p) 74 | init_module = prototype(('init_module', _pytransform)) 75 | ret = init_module(major, minor, pythonapi._handle) 76 | if (ret & 0xF000) == 0x1000: 77 | raise PytransformError('Initialize python wrapper failed (%d)' 78 | % (ret & 0xFFF)) 79 | return ret 80 | 81 | 82 | @dllmethod 83 | def init_runtime(): 84 | prototype = PYFUNCTYPE(c_int, c_int, c_int, c_int, c_int) 85 | _init_runtime = prototype(('init_runtime', _pytransform)) 86 | return _init_runtime(0, 0, 0, 0) 87 | 88 | 89 | @dllmethod 90 | def encrypt_code_object(pubkey, co, flags, suffix=''): 91 | _pytransform.set_option(6, suffix.encode()) 92 | prototype = PYFUNCTYPE(py_object, py_object, py_object, c_int) 93 | dlfunc = prototype(('encrypt_code_object', _pytransform)) 94 | return dlfunc(pubkey, co, flags) 95 | 96 | 97 | @dllmethod 98 | def generate_license_file(filename, priname, rcode, start=-1, count=1): 99 | prototype = PYFUNCTYPE(c_int, c_char_p, c_char_p, c_char_p, c_int, c_int) 100 | dlfunc = prototype(('generate_project_license_files', _pytransform)) 101 | return dlfunc(filename.encode(), priname.encode(), rcode.encode(), 102 | start, count) if sys.version_info[0] == 3 \ 103 | else dlfunc(filename, priname, rcode, start, count) 104 | 105 | 106 | @dllmethod 107 | def generate_license_key(prikey, keysize, rcode): 108 | prototype = PYFUNCTYPE(py_object, c_char_p, c_int, c_char_p) 109 | dlfunc = prototype(('generate_license_key', _pytransform)) 110 | return dlfunc(prikey, keysize, rcode) if sys.version_info[0] == 2 \ 111 | else dlfunc(prikey, keysize, rcode.encode()) 112 | 113 | 114 | @dllmethod 115 | def get_registration_code(): 116 | prototype = PYFUNCTYPE(py_object) 117 | dlfunc = prototype(('get_registration_code', _pytransform)) 118 | return dlfunc() 119 | 120 | 121 | @dllmethod 122 | def get_expired_days(): 123 | prototype = PYFUNCTYPE(py_object) 124 | dlfunc = prototype(('get_expired_days', _pytransform)) 125 | return dlfunc() 126 | 127 | 128 | @dllmethod 129 | def clean_obj(obj, kind): 130 | prototype = PYFUNCTYPE(c_int, py_object, c_int) 131 | dlfunc = prototype(('clean_obj', _pytransform)) 132 | return dlfunc(obj, kind) 133 | 134 | 135 | def clean_str(*args): 136 | tdict = { 137 | 'str': 0, 138 | 'bytearray': 1, 139 | 'unicode': 2 140 | } 141 | for obj in args: 142 | k = tdict.get(type(obj).__name__) 143 | if k is None: 144 | raise RuntimeError('Can not clean object: %s' % obj) 145 | clean_obj(obj, k) 146 | 147 | 148 | def get_hd_info(hdtype, size=256): 149 | if hdtype not in range(HT_DOMAIN + 1): 150 | raise RuntimeError('Invalid parameter hdtype: %s' % hdtype) 151 | t_buf = c_char * size 152 | buf = t_buf() 153 | if (_pytransform.get_hd_info(hdtype, buf, size) == -1): 154 | raise PytransformError('Get hardware information failed') 155 | return buf.value.decode() 156 | 157 | 158 | def show_hd_info(): 159 | return _pytransform.show_hd_info() 160 | 161 | 162 | def assert_armored(*names): 163 | prototype = PYFUNCTYPE(py_object, py_object) 164 | dlfunc = prototype(('assert_armored', _pytransform)) 165 | 166 | def wrapper(func): 167 | def wrap_execute(*args, **kwargs): 168 | dlfunc(names) 169 | return func(*args, **kwargs) 170 | return wrap_execute 171 | return wrapper 172 | 173 | 174 | def get_license_info(): 175 | info = { 176 | 'ISSUER': None, 177 | 'EXPIRED': None, 178 | 'HARDDISK': None, 179 | 'IFMAC': None, 180 | 'IFIPV4': None, 181 | 'DOMAIN': None, 182 | 'DATA': None, 183 | 'CODE': None, 184 | } 185 | rcode = get_registration_code().decode() 186 | if rcode.startswith('*VERSION:'): 187 | index = rcode.find('\n') 188 | info['ISSUER'] = rcode[9:index].split('.')[0].replace('-sn-1.txt', '') 189 | rcode = rcode[index+1:] 190 | 191 | index = 0 192 | if rcode.startswith('*TIME:'): 193 | from time import ctime 194 | index = rcode.find('\n') 195 | info['EXPIRED'] = ctime(float(rcode[6:index])) 196 | index += 1 197 | 198 | if rcode[index:].startswith('*FLAGS:'): 199 | index += len('*FLAGS:') + 1 200 | info['FLAGS'] = ord(rcode[index - 1]) 201 | 202 | prev = None 203 | start = index 204 | for k in ['HARDDISK', 'IFMAC', 'IFIPV4', 'DOMAIN', 'FIXKEY', 'CODE']: 205 | index = rcode.find('*%s:' % k) 206 | if index > -1: 207 | if prev is not None: 208 | info[prev] = rcode[start:index] 209 | prev = k 210 | start = index + len(k) + 2 211 | info['CODE'] = rcode[start:] 212 | i = info['CODE'].find(';') 213 | if i > 0: 214 | info['DATA'] = info['CODE'][i+1:] 215 | info['CODE'] = info['CODE'][:i] 216 | return info 217 | 218 | 219 | def get_license_code(): 220 | return get_license_info()['CODE'] 221 | 222 | 223 | def get_user_data(): 224 | return get_license_info()['DATA'] 225 | 226 | 227 | def _match_features(patterns, s): 228 | for pat in patterns: 229 | if fnmatch(s, pat): 230 | return True 231 | 232 | 233 | def _gnu_get_libc_version(): 234 | try: 235 | prototype = CFUNCTYPE(c_char_p) 236 | ver = prototype(('gnu_get_libc_version', cdll.LoadLibrary('')))() 237 | return ver.decode().split('.') 238 | except Exception: 239 | pass 240 | 241 | 242 | def format_platform(platid=None): 243 | if platid: 244 | return os.path.normpath(platid) 245 | 246 | plat = platform.system().lower() 247 | mach = platform.machine().lower() 248 | 249 | for alias, platlist in plat_table: 250 | if _match_features(platlist, plat): 251 | plat = alias 252 | break 253 | 254 | if plat == 'linux': 255 | cname, cver = platform.libc_ver() 256 | if cname == 'musl': 257 | plat = 'musl' 258 | elif cname == 'libc': 259 | plat = 'android' 260 | elif cname == 'glibc': 261 | v = _gnu_get_libc_version() 262 | if v and len(v) >= 2 and (int(v[0]) * 100 + int(v[1])) < 214: 263 | plat = 'centos6' 264 | 265 | for alias, archlist in arch_table: 266 | if _match_features(archlist, mach): 267 | mach = alias 268 | break 269 | 270 | if plat == 'windows' and mach == 'x86_64': 271 | bitness = struct.calcsize('P'.encode()) * 8 272 | if bitness == 32: 273 | mach = 'x86' 274 | 275 | return os.path.join(plat, mach) 276 | 277 | 278 | # Load _pytransform library 279 | def _load_library(path=None, is_runtime=0, platid=None, suffix=''): 280 | path = os.path.dirname(__file__) if path is None \ 281 | else os.path.normpath(path) 282 | 283 | plat = platform.system().lower() 284 | name = '_pytransform' + suffix 285 | if plat == 'linux': 286 | filename = os.path.abspath(os.path.join(path, name + '.so')) 287 | elif plat == 'darwin': 288 | filename = os.path.join(path, name + '.dylib') 289 | elif plat == 'windows': 290 | filename = os.path.join(path, name + '.dll') 291 | elif plat == 'freebsd': 292 | filename = os.path.join(path, name + '.so') 293 | else: 294 | raise PytransformError('Platform %s not supported' % plat) 295 | 296 | if platid is not None and os.path.isfile(platid): 297 | filename = platid 298 | elif platid is not None or not os.path.exists(filename) or not is_runtime: 299 | libpath = platid if platid is not None and os.path.isabs(platid) else \ 300 | os.path.join(path, plat_path, format_platform(platid)) 301 | filename = os.path.join(libpath, os.path.basename(filename)) 302 | 303 | if not os.path.exists(filename): 304 | raise PytransformError('Could not find "%s"' % filename) 305 | 306 | try: 307 | m = cdll.LoadLibrary(filename) 308 | except Exception as e: 309 | if sys.flags.debug: 310 | print('Load %s failed:\n%s' % (filename, e)) 311 | raise 312 | 313 | # Removed from v4.6.1 314 | # if plat == 'linux': 315 | # m.set_option(-1, find_library('c').encode()) 316 | 317 | if not os.path.abspath('.') == os.path.abspath(path): 318 | m.set_option(1, path.encode() if sys.version_info[0] == 3 else path) 319 | 320 | # Required from Python3.6 321 | m.set_option(2, sys.byteorder.encode()) 322 | 323 | if sys.flags.debug: 324 | m.set_option(3, c_char_p(1)) 325 | m.set_option(4, c_char_p(not is_runtime)) 326 | 327 | # Disable advanced mode if required 328 | # m.set_option(5, c_char_p(1)) 329 | 330 | # Set suffix for private package 331 | if suffix: 332 | m.set_option(6, suffix.encode()) 333 | 334 | return m 335 | 336 | 337 | def pyarmor_init(path=None, is_runtime=0, platid=None, suffix=''): 338 | global _pytransform 339 | _pytransform = _load_library(path, is_runtime, platid, suffix) 340 | return init_pytransform() 341 | 342 | 343 | def pyarmor_runtime(path=None, suffix=''): 344 | pyarmor_init(path, is_runtime=1, suffix=suffix) 345 | init_runtime() 346 | 347 | # ---------------------------------------------------------- 348 | # End of pytransform 349 | # ---------------------------------------------------------- 350 | 351 | # 352 | # Not available from v5.6 353 | # 354 | 355 | 356 | def generate_capsule(licfile): 357 | prikey, pubkey, prolic = _generate_project_capsule() 358 | capkey, newkey = _generate_pytransform_key(licfile, pubkey) 359 | return prikey, pubkey, capkey, newkey, prolic 360 | 361 | 362 | @dllmethod 363 | def _generate_project_capsule(): 364 | prototype = PYFUNCTYPE(py_object) 365 | dlfunc = prototype(('generate_project_capsule', _pytransform)) 366 | return dlfunc() 367 | 368 | 369 | @dllmethod 370 | def _generate_pytransform_key(licfile, pubkey): 371 | prototype = PYFUNCTYPE(py_object, c_char_p, py_object) 372 | dlfunc = prototype(('generate_pytransform_key', _pytransform)) 373 | return dlfunc(licfile.encode() if sys.version_info[0] == 3 else licfile, 374 | pubkey) 375 | 376 | 377 | # 378 | # Deprecated functions from v5.1 379 | # 380 | @dllmethod 381 | def encrypt_project_files(proname, filelist, mode=0): 382 | prototype = PYFUNCTYPE(c_int, c_char_p, py_object, c_int) 383 | dlfunc = prototype(('encrypt_project_files', _pytransform)) 384 | return dlfunc(proname.encode(), filelist, mode) 385 | 386 | 387 | def generate_project_capsule(licfile): 388 | prikey, pubkey, prolic = _generate_project_capsule() 389 | capkey = _encode_capsule_key_file(licfile) 390 | return prikey, pubkey, capkey, prolic 391 | 392 | 393 | @dllmethod 394 | def _encode_capsule_key_file(licfile): 395 | prototype = PYFUNCTYPE(py_object, c_char_p, c_char_p) 396 | dlfunc = prototype(('encode_capsule_key_file', _pytransform)) 397 | return dlfunc(licfile.encode(), None) 398 | 399 | 400 | @dllmethod 401 | def encrypt_files(key, filelist, mode=0): 402 | t_key = c_char * 32 403 | prototype = PYFUNCTYPE(c_int, t_key, py_object, c_int) 404 | dlfunc = prototype(('encrypt_files', _pytransform)) 405 | return dlfunc(t_key(*key), filelist, mode) 406 | 407 | 408 | @dllmethod 409 | def generate_module_key(pubname, key): 410 | t_key = c_char * 32 411 | prototype = PYFUNCTYPE(py_object, c_char_p, t_key, c_char_p) 412 | dlfunc = prototype(('generate_module_key', _pytransform)) 413 | return dlfunc(pubname.encode(), t_key(*key), None) 414 | 415 | # 416 | # Compatible for PyArmor v3.0 417 | # 418 | @dllmethod 419 | def old_init_runtime(systrace=0, sysprofile=1, threadtrace=0, threadprofile=1): 420 | '''Only for old version, before PyArmor 3''' 421 | pyarmor_init(is_runtime=1) 422 | prototype = PYFUNCTYPE(c_int, c_int, c_int, c_int, c_int) 423 | _init_runtime = prototype(('init_runtime', _pytransform)) 424 | return _init_runtime(systrace, sysprofile, threadtrace, threadprofile) 425 | 426 | 427 | @dllmethod 428 | def import_module(modname, filename): 429 | '''Only for old version, before PyArmor 3''' 430 | prototype = PYFUNCTYPE(py_object, c_char_p, c_char_p) 431 | _import_module = prototype(('import_module', _pytransform)) 432 | return _import_module(modname.encode(), filename.encode()) 433 | 434 | 435 | @dllmethod 436 | def exec_file(filename): 437 | '''Only for old version, before PyArmor 3''' 438 | prototype = PYFUNCTYPE(c_int, c_char_p) 439 | _exec_file = prototype(('exec_file', _pytransform)) 440 | return _exec_file(filename.encode()) 441 | -------------------------------------------------------------------------------- /py36/pytransform/platforms/darwin/x86_64/_pytransform.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BeHalcyon/fisher_script/dcf6f09fde8a442d90c39ac96fdbb1360fe0879a/py36/pytransform/platforms/darwin/x86_64/_pytransform.dylib -------------------------------------------------------------------------------- /py36/pytransform/platforms/linux/aarch64/_pytransform.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BeHalcyon/fisher_script/dcf6f09fde8a442d90c39ac96fdbb1360fe0879a/py36/pytransform/platforms/linux/aarch64/_pytransform.so -------------------------------------------------------------------------------- /py36/pytransform/platforms/linux/x86_64/_pytransform.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BeHalcyon/fisher_script/dcf6f09fde8a442d90c39ac96fdbb1360fe0879a/py36/pytransform/platforms/linux/x86_64/_pytransform.so -------------------------------------------------------------------------------- /py36/pytransform/platforms/windows/x86_64/_pytransform.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BeHalcyon/fisher_script/dcf6f09fde8a442d90c39ac96fdbb1360fe0879a/py36/pytransform/platforms/windows/x86_64/_pytransform.dll -------------------------------------------------------------------------------- /py37/exchange_59_20.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python3 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称: exchange_59_20_1.py 5 | Author: Fisher 6 | 功能: 7 | Date: 2022-5-12 8 | cron: 0 59 9,13,17,21,23 * * * 9 | ''' 10 | 11 | from exchange_lib import * 12 | 13 | if __name__ == "__main__": 14 | 15 | args = parseArgs() 16 | 17 | ExchangeManagement( 18 | url="", 19 | headers={}, 20 | headers_user_agent_random_flag=False, 21 | user_agent="okhttp/3.12.1;jdmall;android;version/11.0.2;build/97565;", 22 | body_dict={}, 23 | batch_size=args.batch_size if args.batch_size > 0 else 7, 24 | activitiId_random_flag=False, 25 | other_batch_size=0, 26 | # second_ahead=0.31, 27 | second_ahead=0, 28 | sleep_time=0, 29 | thread_number=args.thread_number if args.thread_number > 0 else 40, 30 | append_flag=False, 31 | log_flag=False, 32 | sign_flag=True, 33 | day_or_week='week', 34 | post_flag=True, 35 | proxy_flag=args.proxy_flag if args.proxy_flag else False, 36 | coupon_type="59-20_1", 37 | cookie_type=args.cookie_type if args.cookie_type != 'None' else 'ws_cookies') \ 38 | .executeInDesktop( 39 | clock_list=[0, 10, 14, 18, 22], 40 | debug_flag=args.debug_flag if args.debug_flag else False 41 | ) -------------------------------------------------------------------------------- /py37/exchange_9.9.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python3 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称:exchange_9.9.py 5 | Author: yangyang 6 | 功能: 7 | Date: 2022-5-7 8 | cron: 10 59 9,15 * * * 9 | new Env("券后9.9"); 10 | ''' 11 | from exchange_lib import * 12 | 13 | if __name__ == "__main__": 14 | url = "https://api.m.jd.com/client.action?functionId=centerReceiveCoupon&appid=XPMSGC2019&monitorSource=&client=m&eu=5616666313239356&fv=4683736316461646" 15 | headers = { 16 | "accept": "application/json, text/plain, */*", 17 | "accept-language": "en-US,en;q=0.9", 18 | "accept-encoding": "gzip, deflate, br", 19 | "content-type": "application/x-www-form-urlencoded", 20 | "origin": "https://h5.m.jd.com", 21 | "x-request-with": "com.jingdong.app.mall", 22 | "referer": "https://h5.m.jd.com/", 23 | "sec-fetch-dest": "empty", 24 | "sec-fetch-mode": "cors", 25 | "sec-fetch-site": "same-site" 26 | } 27 | # extend = "A0F322DB0C038E1603CAC2127B1D86BC0F09FFD58755FE96E1687E0350887FBA79997E8E037402B0F6EF97C2D50C376F1B80FD03148C5F7D1054DBAE7D8F6D995F271D3665A05F94AB2F5C83B6D04B1B80251EF1D2F4633121F074F21AB9B37948B88A080E5C2891179D54F7ABB3756673D538D9372A24D540DDFB6C7C4541793A8C1E67C32FD58559501873FAD35D3FAF0788F5881EF1D96C826EA822F393642E93EF2864D4897D9C3FD1FD190BDBDAB8B1A95438847E5310BAC4F859166A9DBAE68C094DD31B5C5003C4C44373373F" 28 | 29 | extend = "A0F322DB0C038E1603CAC2127B1D86BC0F09FFD58755FE96E1687E0350887FBA79997E8E037402B0F6EF97C2D50C376F1B80FD03148C5F7D1054DBAE7D8F6D995F271D3665A05F94AB2F5C83B6D04B1B80251EF1D2F4633121F074F21AB9B3795DEACE40B717C2B866502C1577E6DC65E9B3BA97EBD16C414EB97B9758C203763A8C1E67C32FD58559501873FAD35D3FAF0788F5881EF1D96C826EA822F393642E93EF2864D4897D9C3FD1FD190BDBDA0D3E790119A83BE78D78AB958319ABAABAE68C094DD31B5C5003C4C44373373F" 30 | body_dict = { 31 | "extend": extend, 32 | "rcType": "1", "source": "couponCenter_app", "random": "7172621", "couponSource": "1", 33 | "extraData": "{\"log\":\"1664262320487~1zcCSCr3sAvMDFHQ1hvTjAxMQ==.dnVuW3xxcWpWf3NzaxEUAHVgDAUOdzM/MHZvbkN7a3ImXTB2PSY=.e8166796~5,1~52A8C75FE07D55CA0A9C1BCBC761465F9927C7A4~1jjtok1~C~SBNBXhEDaWQVFEZbXhELbhFXCB8OARoEeh9mHUAfRxseG10DHwIEHwd4HwIKHggXBgIFH0cTGRFXDh8ODhoEeB8BCRkCHQkCCRVCEGgfEVZHXREDAwgVFEFGEQkTBAUFDQAPCwUDDAQDCQELAwwQFRtBV1ERCRNBR0dNRhsVFEVQUhELF1VVTUZNTUNTFx8RQVFdEQNpDRUDAAUfBR0EAh8IHgxkGhBfWRELBh8RWkEbAxRUUwUABQYGCl9XXQgCVldRVlACVQILBg8BAAFQVgIDUREfG1xJGwwQeVpdRE0TUlhAWlEABhcfEUUXCQIPBA0LAAAGAQMFDQQfG1hSGwwQGARQAQYGVl9QCgBVARhWUlcDAgEAV10BAQRUV1JVGFYBDwMNCQVXDQoBVFBVBwAHWg1TA1QDCgBXCgsMUA5cAFRRAQcTGRFVSVAbAxQQGRFdRxcJEX5dVl5aVxV6XVIbER8bXFhPFAgXCgsCBgMRFRBKWkQQD2gLAA0fAAABZBUUQFoRCWoXfnoZChsVFFNbV0FeXFcRFRAAGxoQBAIdAxsFERUQAAEFAQURHxMABQIPBA8PBQMGAQAIBgYFFAYPAQUFBgUAAAMHBQgEDQ8UHhcCEWwZEVpWUxsDFFRTVVVXU0dHGx4bWFwQDxFGExkRUFAQAxtBARsCHQEXHxFaVGZPFAgXAwITGRFRXRADG0RTW1dcXAgEAg4ADwsHEBkRXlsXCWgIHgkVBm8ZEVFdWlQRAxAIDwAGBwUBAw0EBQEERwh7UFlrZmNQW0VDf31zXWhtdUplYXJKdFUEBBhkY317Y1sKYG9na3xQA3dmYmBCY2ttUV54XGBkcXZocn5Eb3h6CANcZnViYWd3fW91QQFvfkJ6XH9mVEZ1cG9+ZkhWGHdLBQpyXmdxfnRzRGNgeAV7SUp1fWxjW1NlRGNzYFxwdmpoUHNnRHp9d2ZHcWBsYXFnbwR3dFJ0dmFZanxiZwd/SgRgfWBwfn9qf0d7WmZ4Y3BYCHNRbGBzcFBRemd6BHIBCX51Smd0f3MBV2BsZ2NwTmNdeHtGd39LdAZwb3NjeHELdntycl9weE5/Z3Bif3BnZkBwWUpPegNkVHxIWWJ9fGdfX0wCfHZaXg16d3wHdHtRZHBifnpyRH1sdENeUGpncmpwW1h7fWd3fWZzd2t/WWBJHQsLCwAABwVSTUkZAk1HTHtHYgJzdWJwDWZmaAd+emN8ZGsCBVd2X153flJ4VmJhZX5zAnpuZWtvd3VnYWRjQkt7b0psWHNebHBSWXRkcFFrentjc292ZnN3d2Z4cXh4B2ZzdlhkbVhianYJYHBhUmZgdndxUnxaWnNwXnh0ZlZkZnRsVm99dGN7dXV8cmBUXXt7UXx4SwJBAUFXRksQFRtbQVIRCRMXTg==~19cnnnp\",\"sceneid\":\"couponNinePointNineHome\"}"} 34 | 35 | # 感冒灵 36 | extend = "43637CD87226EA2E335863F219ABC3D7F6C12FFEF67B4A334C3FD21871640F7283AB3B66E44F81A17C1A6A624A9DA4801B80FD03148C5F7D1054DBAE7D8F6D995F271D3665A05F94AB2F5C83B6D04B1BE54C50985C41FD2D58DBA76F2CD6DB02AC56646B328B4C44646B973087A7213FF3A98E7DBB08CFBC1DFCF12089B6A3533A8C1E67C32FD58559501873FAD35D3FED6926BB1743834D4361F61A275BD74B2E93EF2864D4897D9C3FD1FD190BDBDA8FE0F737B1945FC4B1D71C3FE08EF38392E65B68F750B18F516AF30F55398C7150AC93F8FAD90D456227C60734534054" 37 | body_dict = { 38 | "extend": extend, 39 | "rcType":"1","source":"couponCenter_app","random":"2908621","couponSource":"1","extraData":"{\"log\":\"1664298182254~1KDw59zPMGzMDF3bE5FRTAxMQ==.Rlp4cXdOVH9zc0VVejsQGDV3HCk9VB8HO0ZAeGlwW10wdztGEjA=.59d6dec8~5,1~9F31050F51E8246CEDE624F5182C8C173B9BEB47~0rr2xke~C~SRZNWhACbG4fGkVbVBAOYhVWDRoFZRQHZBV2fgkbAxYHAwMURRcVEFAOGgRuGwViFHV+dh4FFwcCCBtHEWUdF15AWhsNAxQVQEAaCxcIBAINBQsABgUHDQYCDwoMDBUeGkBWVxoLF01GQE1DEBQVRFZZEw8bVFJNQ0ZMQlIRFBNFXVwWA2wGFAIBAxQHGQgDGAgbB2UbEVlSEw8IHhZaRBACFVVVDgIBCgcNX1JWCQNXUVpUVA5UBQsDBAABAFZdAAddEBgbWUIaDRF/UV9AQRJVWEVRUAEHERQTQRsIBQ8BBgoOCwIAAwcMBhgbXVkaDREeD1IFCgdRX1UBAVQAHl1QUw8DBgBSVgAABVJcUFEUVwYPBgYIBFYLAQNQXFQAAAJRDFICUggIBFsLDAxVBV0BVVcKBRcVEFJJVRACFREfGl9DGwgWflhdX1tWE3FfVhcQGBtZU04VCREBCQYKAhYVFUFbRREJYwkEAR4HAARvFBVBXBoLbht/fRkPEBQVUl1cQ1pQVhYVFQsaGxECCR8HFwQWFRULAAQAAxodFwwEBQ8BBA4EAgAKAgwKBwIUAwQABAQADgIEDwYCCAEGDhUfEQkTaBUQXVZWEAIVVVVeV1NfRkAbGxBZXREJGkQXFRBXUBUIGkAAHQkfBRseFlpRbU4VCREIABcVEFZdFQgaRVJdXF5YBAANCQ8ECgYRHxpcXxsIbwgbAhQHbh8aU1lWVRYDFQMOAQcBAQkEDAEHDAVMCX5nAEsFf25LBmN6dnIDVl1ye2NDc010UA8FGWBmQHRTbmR2bWJGAG0DdXVgT1plYFIPRXFfRAN1WlZxeWZVYHF/YQplfUJ4X0tYc3VwT119YQwCe1F/BHR2Qn51cANRdHENdXN7XGt/TkBEcWUFCnh3fFZ3U25paQhwen9acWpyZktUfFRhZHhBa2N7QFlxcF0CUHRzWnR/VHp9fF1qfXZlf3V8XFJlcWwHR3dsCWBqS1t2cHNTfHIAT3N7aAIAfHBRWXFxVwF/UnBxZ1cDdmhAQFp9A2xdf3Z4c30IB2N+QWBWcnAMWmdKYWJnA1tGck5ZTnBvcwl6A0BScHF3f38JblliZHZrfWNwVGJ3DQFxT355d19wTXhgDXVxc3VxYmIAU3puf1Z8XHAMfVtLcX1mDUIaC1UEXFMLVghPTBUDSkdJcEZkW31/dGReYGJ/X3NucmFrb10NXWBYQWZ6CH1XZHpwUXwDYWt0cH5ja3UIZmQIXnVvdQNqZXZpXWlzb3pjCH5UbmJpdGB3e19lYk1WZG1yVWZ+SWxsZERsZVp9UnYCcWZ2a3BnfF8Ka2ACV05jZ3R4cV5yc31PA2RqSXR1d0NadnBPcmB7QHtnaEp9c3JFdVRycXlVcAhecHx2QWx1cnp7cF1wVHFVQ2t9UFhnbXB4X3N2AXN0UwMOTQhQX1pHWEEVHhpaQFQaCxcbTw==~0a6rhcq\",\"sceneid\":\"couponNinePointNineHome\"}"} 40 | 41 | args = parseArgs() 42 | 43 | ExchangeManagement( 44 | url=url, 45 | headers=headers, 46 | headers_user_agent_random_flag=False, 47 | user_agent="jdapp;android;10.5.2;;;appBuild/96428;ef/1;ep/%7B%22hdid%22%3A%22JM9F1ywUPwflvMIpYPok0tt5k9kW4ArJEU3lfLhxBqw%3D%22%2C%22ts%22%3A1655122900598%2C%22ridx%22%3A-1%2C%22cipher%22%3A%7B%22sv%22%3A%22EG%3D%3D%22%2C%22ad%22%3A%22EJvuZwZtYwYnCtqzDtrwDK%3D%3D%22%2C%22od%22%3A%22YtLwCzc0DQG3ZNOzEQS2Zq%3D%3D%22%2C%22ov%22%3A%22Ctq%3D%22%2C%22ud%22%3A%22EJvuZwZtYwYnCtqzDtrwDK%3D%3D%22%7D%2C%22ciphertype%22%3A5%2C%22version%22%3A%221.2.0%22%2C%22appname%22%3A%22com.jingdong.app.mall%22%7D;jdSupportDarkMode/0;Mozilla/5.0 (Linux; Android 9; MI 6 Build/PKQ1.190118.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/89.0.4389.72 MQQBrowser/6.2 TBS/046010 Mobile Safari/537.36", 48 | body_dict=body_dict, 49 | batch_size=args.batch_size if args.batch_size > 0 else 12, 50 | other_batch_size=0, 51 | second_ahead=0.16, 52 | sleep_time=0, 53 | thread_number=args.thread_number if args.thread_number > 0 else 35, 54 | append_flag=False, 55 | log_flag=False, 56 | sign_flag=False, 57 | day_or_week='day', 58 | post_flag=True, 59 | print_type="cmd", 60 | proxy_flag=args.proxy_flag if args.proxy_flag else False, 61 | coupon_type="9.9", 62 | cookie_type=args.cookie_type if args.cookie_type != 'None' else 'mine_coupons') \ 63 | .executeInDesktop( 64 | clock_list=[10], 65 | debug_flag=args.debug_flag if args.debug_flag else False 66 | ) 67 | -------------------------------------------------------------------------------- /py37/exchange_check_coupons.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称:exchange_check_coupons.py 5 | Author: yangyang 6 | 功能: 7 | Date: 2022-5-22 8 | cron: 0 23 14,20 * * * 9 | new Env("优惠券通知"); 10 | ''' 11 | from exchange_lib import * 12 | 13 | if __name__ == '__main__': 14 | 15 | args = parseArgs() 16 | 17 | ExchangeManagement(cookie_type=args.cookie_type if args.cookie_type != "None" else "mine") 18 | 19 | cookies = os.environ["JD_COOKIE"].split('&') if "JD_COOKIE" in os.environ else [] 20 | 21 | summary = "优惠券速览" 22 | content = "" 23 | for cookie in cookies: 24 | content += findCoupons(cookie) 25 | print(content) 26 | sendNotification(summary=summary, content=content) 27 | -------------------------------------------------------------------------------- /py37/exchange_check_redpacket.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称:exchange_check_coupons.py 5 | Author: yangyang 6 | 功能: 7 | Date: 2022-5-22 8 | cron: 0 23 14,20 * * * 9 | new Env("红包通知"); 10 | ''' 11 | from exchange_lib import * 12 | 13 | if __name__ == '__main__': 14 | 15 | args = parseArgs() 16 | 17 | ExchangeManagement(cookie_type=args.cookie_type if args.cookie_type != "None" else "mine") 18 | 19 | cookies = os.environ["JD_COOKIE"].split('&') if "JD_COOKIE" in os.environ else [] 20 | 21 | summary = "红包速览" 22 | content = "" 23 | for cookie in cookies: 24 | content += findRedPacket(cookie) 25 | print(content) 26 | sendNotification(summary=summary, content=content) 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /py37/exchange_evaluation.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | from exchange_lib import * 3 | try: 4 | import jieba.analyse 5 | except Exception: 6 | print("Error in importing jieba module, please run 'pip install jieba' in command line.") 7 | exit() 8 | 9 | jieba.setLogLevel(jieba.logging.INFO) 10 | 11 | def generateComment(pname): 12 | try: 13 | name = jieba.analyse.textrank(pname, topK=5, allowPOS='n')[0] 14 | except: 15 | name = "宝贝" 16 | 17 | datas = { 18 | "start": [ 19 | "考虑买这个$之前我是有担心过的,因为我不知道$的质量和品质怎么样,但是看了评论后我就放心了。", 20 | "买这个$之前我是有看过好几家店,最后看到这家店的评价不错就决定在这家店买 ", 21 | "看了好几家店,也对比了好几家店,最后发现还是这一家的$评价最好。", 22 | "看来看去最后还是选择了这家。", 23 | "之前在这家店也买过其他东西,感觉不错,这次又来啦。", 24 | "这家的$的真是太好用了,用了第一次就还想再用一次。", 25 | "其实一直都想入手一款$,但找不到合适的。", 26 | "做工看的出很优秀,手感也很好,和描述几乎一致。", 27 | "这个价格来说很具性价比,但是质量还是很不错的,装东西够用了,非常合适,质量也好," 28 | "没感觉到什么难闻的味,能收纳好多东西,结实,实用,方便,厚度和 颜色都是我想要的,最重要的是高度刚刚好" 29 | ], 30 | "mid": [ 31 | "收到货后我非常的开心,因为$的质量和品质真的非常的好!", 32 | "拆开包装后惊艳到我了,这就是我想要的$!", 33 | "快递超快!包装的很好!!很喜欢!!!", 34 | "包装的很精美!$的质量和品质非常不错!", 35 | "收到快递后迫不及待的拆了包装。$我真的是非常喜欢", 36 | "真是一次难忘的购物,这辈子没见过这么好用的东西!!", 37 | "收纳很漂亮很可爱,材质做工很好!无异味!大小尺寸齐全", 38 | "这个价位很满意了,拿回来一会儿就装好", 39 | "接头是那种很有韧性的胶、敲打的过程中不会裂开", 40 | "很有包容性、装好以后不会晃动、很稳,物流也快、五星好评" 41 | ], 42 | "end": [ 43 | "经过了这次愉快的购物,我决定如果下次我还要买$的话,我一定会再来这家店买的。", 44 | "不错不错!", 45 | "我会推荐想买$的朋友也来这家店里买", 46 | "真是一次愉快的购物!", 47 | "大大的好评!以后买$再来你们店!( ̄▽ ̄)", 48 | "大家可以买来试一试,真的是太爽了,一晚上都沉浸在爽之中", 49 | "这种物件,不但轻便,而且在自己拼装完成后有一种成就的喜悦,真是宿舍家居良品", 50 | "自己组装成功,跟价格相称,比较简易", 51 | "操作比较方便。到时候也好拆卸,没想到这么便宜竟然这么好。", 52 | "东西很不错,木头也不错。", 53 | "特别好,而且功能百搭。", 54 | "没有色差,大小合适,组装简单,质量很好" 55 | ] 56 | } 57 | return (random.choice(datas["start"]) + random.choice(datas["mid"]) + random.choice(datas["end"])).replace("$", name) 58 | 59 | 60 | def getOrderList(cookies, shop_name=''): 61 | url = 'https://wq.jd.com/bases/orderlist/list?order_type=8&start_page=1&page_size=100' 62 | headers = { 63 | "accept": "application/json", 64 | "accept-encoding": "gzip, deflate, br", 65 | "accept-language": "zh-CN,zh;q=0.9", 66 | "connection": "keep-alive", 67 | "content-type": "application/x-www-form-urlencoded", 68 | 'origin': 'https://comment.m.jd.com', 69 | "referer": "https://wqs.jd.com/order/orderlist_merge.shtml?jxsid=16355625882984298965&orderType=all&ptag=7155.1.11", 70 | 'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1' 71 | } 72 | result = {} 73 | for cookie in cookies: 74 | result[cookie] = [] 75 | headers['cookie'] = cookie 76 | req = requests.get(url, headers=headers).json() 77 | # print(req) 78 | if 'orderList' not in req: 79 | continue 80 | for order_list in req['orderList']: 81 | 82 | if shop_name in order_list['shopInfo']['shopName']: 83 | 84 | for j in order_list['buttonList']: 85 | if j['id'] == 'toComment': 86 | cname = j['name'] # 评价按钮名字 87 | if cname is None: 88 | continue 89 | 90 | oid = order_list['orderId'] 91 | shopId = order_list['shopInfo']['shopId'] 92 | for order_item in order_list['productList']: 93 | pid = order_item['skuId'] 94 | name = order_item['title'] 95 | result[cookie].append({ 96 | 'name': name, 97 | 'oid': oid, 98 | 'pid': pid, 99 | 'cname': cname, 100 | 'shopId': shopId, 101 | 'shopName': order_list['shopInfo']['shopName'], 102 | 'comment': generateComment(name) 103 | }) 104 | return result 105 | 106 | def commentOrders(comment_orders_dict, proxy_flag=False): 107 | url = "https://api.m.jd.com/api?appid=jd-cphdeveloper-m&functionId=sendEval&loginType=2&sceneval=2&g_login_type=1&g_ty=ajax&appCode=ms0ca95114" 108 | headers = { 109 | "accept": "application/json", 110 | "accept-encoding": "gzip, deflate, br", 111 | "accept-language": "zh-CN,zh;q=0.9", 112 | "connection": "keep-alive", 113 | "content-type": "application/x-www-form-urlencoded", 114 | 'origin': 'https://comment.m.jd.com', 115 | "referer": "https://comment.m.jd.com/", 116 | 'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1' 117 | } 118 | log_num = 0 119 | for value in comment_orders_dict.values(): 120 | log_num += len(value) 121 | logs = getLogs(num=log_num) 122 | log_num = 0 123 | order_id_set = set() 124 | for cookie, orders in comment_orders_dict.items(): 125 | headers['cookie'] = cookie 126 | for order in orders: 127 | body = { 128 | "productId": order['pid'], 129 | "orderId": order['oid'], 130 | "score": 5, 131 | "content": order['comment'], 132 | "commentTagStr": 1, 133 | "userclient": 29, 134 | "anonymous": 0, 135 | "syncsg": 0, 136 | "scence": 101100000 137 | } 138 | 139 | response = requests.post(url=url, headers=headers, data=generateBody(body, logs[log_num]), proxies=getProxies(proxy_flag)).json() 140 | 141 | if 'errMsg' in response and response['errMsg'] == 'success': 142 | printT(f"{getUserName(cookie)}: 评价成功!店铺:{order['shopName']}, 内容:{order['comment']}") 143 | else: 144 | printT(f"{getUserName(cookie)}: 评价失败!店铺:{order['shopName']}, 日志:{response}") 145 | 146 | if order['oid'] not in order_id_set: 147 | 148 | se_url = f'https://wq.jd.com/eval/SendDSR' 149 | se_data = { 150 | 'userclient': '29', 151 | 'orderId': order['oid'], 152 | 'otype': 5, 153 | 'DSR1': 5, 154 | 'DSR2': 5, 155 | 'DSR3': 5, 156 | 'DSR4': 5, 157 | 'g_login_type': '0', 158 | 'g_ty': 'ls' 159 | } 160 | se_req = requests.get(se_url, headers=headers, params=se_data, proxies=getProxies(proxy_flag)).json() 161 | if se_req['errMsg'] == 'success': 162 | order_id_set.add(order['oid']) 163 | printT(f"{getUserName(cookie)}: 评价服务成功!店铺:{order['shopName']}") 164 | else: 165 | printT(f"{getUserName(cookie)}: 评价服务失败!店铺:{order['shopName']}") 166 | 167 | log_num += 1 168 | time.sleep(random.randint(5, 10)) 169 | 170 | 171 | if __name__ == '__main__': 172 | 173 | args = parseArgs() 174 | 175 | ExchangeManagement(cookie_type=args.cookie_type if args.cookie_type != "None" else "mine") 176 | cookies = os.environ['JD_COOKIE'].split("&") 177 | os.environ['proxy_ip'] = args.proxy_ip if len(args.proxy_ip) else "127.0.0.1:7890" 178 | result = getOrderList(cookies, shop_name=args.shop_name) 179 | for key, value in result.items(): 180 | for item in value: 181 | print(getUserName(key), item) 182 | commentOrders(result, proxy_flag=args.proxy_flag if args.proxy_flag else False) 183 | -------------------------------------------------------------------------------- /py37/exchange_general_long_key.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python3 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称:exchange_general_long_key.py 5 | Author: Fisher 6 | 功能:适配定点抢长key类券,需在fisher_configure.json文件内创建对应对象并填写"discount"、“activityId”和"clock_list"参数;不需填写长key,会根据activityId和discount自动搜索 7 | Date: 2022-5-12 8 | cron: 0 59 9,13,19,23 * * * 9 | new Env("适配长key券"); 10 | ''' 11 | from exchange_lib import * 12 | 13 | if __name__ == "__main__": 14 | 15 | headers = { 16 | "Accept": "*/*", 17 | "Accept-Encoding": "gzip, deflate", 18 | "Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7", 19 | "Connection": "keep-alive", 20 | "Content-Type": "application/x-www-form-urlencoded", 21 | 'origin': 'https://pro.m.jd.com', 22 | "Referer": "https://prodev.m.jd.com/jdlite/active/3H885vA4sQj6ctYzzPVix4iiYN2P/index.html?sid=bf6ae253e73f472d5ec294810f46665w&un_area=7_502_35752_35860" 23 | } 24 | 25 | headers = { 26 | "Accept": "*/*", 27 | "Accept-Encoding": "gzip, deflate", 28 | "Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7", 29 | "Connection": "keep-alive", 30 | "Content-Type": "application/x-www-form-urlencoded", 31 | 'origin': 'https://pro.m.jd.com', 32 | "Referer": "https://prodev.m.jd.com/mall/active/3WWbQbmmcqceFHsJbat8Zv1GJaTG/index.html" 33 | } 34 | 35 | body_dict = { 36 | 'activityId': '4TFZNrP43yHwUV3QvJrEvcK53yjM', 37 | 'scene': '1', 38 | "args": "key=E5C4099AC12CA45D0E1392A0395132BB089A2C409B4CDA6B70FD5029A59C3E0B3C181682F3E1732FAC58DB24B9848D90_bingo,roleId=DFA527DAB656121EC55AAF58C1F10841784A28A4284BC0382CA98D709DCB6B71FC4A630392E6611D106F0995B2F5BE5A55014C97F678F311D1F5391B5C888BBE08FCC8F75C99007DAF32582F8576B48D1EE01B07D319ADEF923618980493E3176BD11D1CC689D361061FE59FCE4D3EB4322E0B215226E76B91C22862C087D3A5882D2C83A49CCACE72CB48AB8E518F834F41D4C17481F1F4CE80642B0D3A2B7C_bingo,strengthenKey=19F512DCD8EE34ABE9C4FB4A92C2F42A72D6B80C9B38F8FE98AE3D2BBDCD6808_bingo" 39 | # "args": "key=71A0B43A5801A76425DDBF4945A31FD0A482428781387C293E94FE5D03130B8290CB83F3DEC7A6BC983EBAD60BB41090_bingo,roleId=9BD67B901DB469651E99E6F7D3AD5D4C1AA34CF13B4798B7631A80C978D94B238519E7CFEACA3172B01DA4825405A9DF008A5736EE708F9F4CC1789FE2954CAB0263CD293EAF6D72A4391D16068BA147C40F89C0442154D15341E07CCEBBA886CAE551448E5C321B3502EFCEC85ABADD5B568D52236F53017161146D0CB29D26CD99AC01EED9FA85BCA728275411591E2941E0E19C557799258FB3E209E132D6_bingo,strengthenKey=19F512DCD8EE34ABE9C4FB4A92C2F42AE84B9E1109B76B738665CAD2CB9C6FC3_bingo" 40 | # "args": "key=3DDD4FEE153EDE4F35C6F88EE2E6B0E49BD9CE09F02D3C0AA15513971D7D389ED4783B3577241CE3AD9CF93B4916BF47_bingo,roleId=CBA252302CA43DD8492A5C2BB15E348D8DB7DBDFCD70E07A4B7351090783521AFE55E69D64CAE1EDBE989BACFC81D94CBB81AC1F577723DFF9EB26B402E07D8106A25909D15C0C2B436CFE2542B89FE27AF72604A4B815DC880C2C087938C579F2F2CD22FDC08402E7692AF5E3FFF0F25810D208F7217DF27A4AA244D3F75147B18AE19450BBDBC8E2CD3E613B25500A356AB6ADDF084C5A08C512A0F7B62435_bingo,strengthenKey=19F512DCD8EE34ABE9C4FB4A92C2F42ADA4942001794CD9B77862303197584D9_bingo" 41 | } 42 | url = 'https://api.m.jd.com/client.action?functionId=newBabelAwardCollection&client=wh5&clientVersion=1.0.0' 43 | 44 | args = parseArgs() 45 | 46 | if args.coupon_type == "11-10": 47 | body_dict["args"] = "key=A34B6A46F386EC70113B577994469C1B49D9B59EFF1FDECA912461CA55C67D1D24E41C2888131D20F7F344D85F818827_bingo,roleId=7B7EECE5B05B6737BA5C854DC24388B1ADE7E524DF1E4AD18D961FA660EE34357FC23002A660F27F3F6B88AC400804601D2B2CBED81FF4307C8711CFDD271B3AD8FAC5993180E24F47E96BFC553E852625B115C6DACA1DA819326786635BE1B606304759801B859BBB563EA50573A032D414FCF70559C38860E4176AD464BAF15A8B10CC96430795745A39240FDE5D058EB0A12BDC898EADF0967CBE44006DF0_bingo" 48 | elif args.coupon_type == "15-5": 49 | body_dict["args"] = "key=AF55BC22EF3EBC44F28919EE34B3835ABE5C573C117F01A6A3D8F8CF3C168A08138963DDFFE0C2AB8E9AF062CFAF191D_bingo,roleId=DFA527DAB656121EC55AAF58C1F10841B12A24EFFA45F776EF6BD09851D33D26BB067058CC0082933425C3E1E6DF953520E5E1F68BE7E6A21C5042664648B378401C1007A7FDF66AB9FE83FCA0A4748D1015514C5EEAD3C72332201BCF4D7BA267C52D74E04752DCF0B9F82FDF9A8DD6CB0F6E05C231D60CA2FEB273F40959F8F7A8BF660D80E1DC07697D25DC57FFA7AA63951EC6E7A51F8C49B3A049536FD5_bingo,strengthenKey=19F512DCD8EE34ABE9C4FB4A92C2F42AFCFDB2D343F06C660D24D9EA74C6869A_bingo" 50 | else: 51 | body_dict['args'] = "key=E5C4099AC12CA45D0E1392A0395132BB089A2C409B4CDA6B70FD5029A59C3E0B3C181682F3E1732FAC58DB24B9848D90_bingo,roleId=DFA527DAB656121EC55AAF58C1F10841784A28A4284BC0382CA98D709DCB6B71FC4A630392E6611D106F0995B2F5BE5A55014C97F678F311D1F5391B5C888BBE08FCC8F75C99007DAF32582F8576B48D1EE01B07D319ADEF923618980493E3176BD11D1CC689D361061FE59FCE4D3EB4322E0B215226E76B91C22862C087D3A5882D2C83A49CCACE72CB48AB8E518F834F41D4C17481F1F4CE80642B0D3A2B7C_bingo,strengthenKey=19F512DCD8EE34ABE9C4FB4A92C2F42A72D6B80C9B38F8FE98AE3D2BBDCD6808_bingo" 52 | 53 | 54 | ExchangeManagement( 55 | url=url, 56 | headers=headers, 57 | headers_user_agent_random_flag=True, 58 | user_agent="", 59 | body_dict=body_dict, 60 | activitiId_random_flag=False, 61 | batch_size=args.batch_size if args.batch_size > 0 else 30, 62 | other_batch_size=0, 63 | second_ahead=0, 64 | sleep_time=0, 65 | thread_number=args.thread_number if args.thread_number > 0 else 20, 66 | append_flag=False, 67 | log_flag=True, 68 | sign_flag=False, 69 | day_or_week='day', 70 | post_flag=True, 71 | proxy_flag=args.proxy_flag if args.proxy_flag else False, 72 | proxy_ip=args.proxy_ip if len(args.proxy_ip) else "", 73 | coupon_type=args.coupon_type if args.coupon_type != 'None' else '15-5', 74 | cookie_type=args.cookie_type if args.cookie_type != 'None' else 'mine_coupons') \ 75 | .executeInDesktop( 76 | debug_flag=args.debug_flag if args.debug_flag else False 77 | ) -------------------------------------------------------------------------------- /py37/exchange_general_short_key.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python3 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称:exchange_general_short_key.py 5 | Author: Fisher 6 | 功能:适配定点抢短key类券,需在fisher_configure.json文件内创建对应对象并填写"args"和"clock_list"参数 7 | Date: 2022-5-12 8 | cron: 0 59 9,13,19,23 * * * 9 | new Env("适配短key券"); 10 | ''' 11 | 12 | from exchange_lib import * 13 | 14 | import sys 15 | 16 | if __name__ == "__main__": 17 | 18 | headers = { 19 | "Accept": "*/*", 20 | "Accept-Encoding": "gzip, deflate", 21 | "Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7", 22 | "Connection": "keep-alive", 23 | "Content-Type": "application/x-www-form-urlencoded", 24 | 'origin': 'https://pro.m.jd.com', 25 | "Referer": "https://prodev.m.jd.com/jdlite/active/3H885vA4sQj6ctYzzPVix4iiYN2P/index.html?sid=bf6ae253e73f472d5ec294810f46665w&un_area=7_502_35752_35860", 26 | } 27 | 28 | body_dict = { 29 | # "activityId":"e9z6GPMVDF4fZ2X6NNwJfot4yxhS", 30 | "activityId": "6GPMX6Ne9zNt4yVDF4wJfofZ2xhS", 31 | "from":"H5node", 32 | "scene":"1", 33 | "args": "key=c1m3c0s0o6ae485e936c029467cb3391,roleId=83519576" 34 | } 35 | 36 | url = 'https://api.m.jd.com/client.action?functionId=lite_newBabelAwardCollection&client=wh5&clientVersion=1.0.0' 37 | 38 | args = parseArgs() 39 | 40 | ExchangeManagement( 41 | url=url, 42 | headers=headers, 43 | headers_user_agent_random_flag=True, 44 | user_agent="", 45 | body_dict=body_dict, 46 | activitiId_random_flag=False, 47 | discount="", 48 | batch_size=args.batch_size if args.batch_size > 0 else 10, 49 | other_batch_size=0, 50 | second_ahead=0, 51 | sleep_time=0.01, 52 | thread_number=args.thread_number if args.thread_number > 0 else 20, 53 | append_flag=False, 54 | log_flag=False, 55 | sign_flag=False, 56 | day_or_week='day', 57 | post_flag=True, 58 | proxy_flag=args.proxy_flag if args.proxy_flag else False, 59 | proxy_ip=args.proxy_ip if len(args.proxy_ip) else "", 60 | coupon_type=args.coupon_type if args.coupon_type != 'None' else 'general_coupons', 61 | cookie_type=args.cookie_type if args.cookie_type != 'None' else 'mine_coupons')\ 62 | .executeInDesktop( 63 | debug_flag=args.debug_flag if args.debug_flag else False, 64 | ) -------------------------------------------------------------------------------- /py37/exchange_plus.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python3 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称:exchange_plus.py 5 | Author: yangyang 6 | 功能: 7 | Date: 2022-5-12 8 | cron: 0 59 9,13,19,23 * * * 9 | new Env("plus权益-无验证券模板"); 10 | ''' 11 | 12 | from exchange_lib import * 13 | 14 | if __name__ == "__main__": 15 | 16 | headers = { 17 | "Host": "rsp.jd.com", 18 | "accept": "application/json, text/plain, */*", 19 | "user-agent": "jdapp;android;10.5.2;;;appBuild/96428;ef/1;ep/%7B%22hdid%22%3A%22JM9F1ywUPwflvMIpYPok0tt5k9kW4ArJEU3lfLhxBqw%3D%22%2C%22ts%22%3A1654535539316%2C%22ridx%22%3A-1%2C%22cipher%22%3A%7B%22sv%22%3A%22EG%3D%3D%22%2C%22ad%22%3A%22CzUmCzvsYzSnCtYzDNq0ZG%3D%3D%22%2C%22od%22%3A%22YtLwCzc0DQG3ZNOzEQS2Zq%3D%3D%22%2C%22ov%22%3A%22Ctq%3D%22%2C%22ud%22%3A%22ENY1DNGnCNC1DNC0EJY4BJHtDNvvC2Y1DNUzCm%3D%3D%22%7D%2C%22ciphertype%22%3A5%2C%22version%22%3A%221.2.0%22%2C%22appname%22%3A%22com.jingdong.app.mall%22%7D;jdSupportDarkMode/0;Mozilla/5.0 (Linux; Android 9; MI 6 Build/PKQ1.190118.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/89.0.4389.72 MQQBrowser/6.2 TBS/045946 Mobile Safari/537.36", 20 | "origin": "https://plus.m.jd.com", 21 | "x-requested-with": "com.jingdong.app.mall", 22 | "sec-fetch-site": "same-site", 23 | "sec-fetch-mode": "cors", 24 | "sec-fetch-dest": "empty", 25 | "referer": "https://plus.m.jd.com/", 26 | "accept-encoding": "gzip, deflate, br", 27 | "accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7" 28 | } 29 | # Coco 30 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=60946520270113&_={int(round(time.time()*1000))}' 31 | # 万达 32 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=60946520269991&_={int(round(time.time()*1000))}' 33 | # 肯德基 34 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=60947948441996&_={int(round(time.time()*1000))}' 35 | 36 | # 烧仙草 coco 37 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=71704511585025&_={int(round(time.time()*1000))}' 38 | 39 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=71704534652075&_={int(round(time.time() * 1000))}' 40 | 41 | 42 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=71705057879950&_={int(round(time.time() * 1000))}' 43 | 44 | # 体检 45 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=71705009647680&_={int(round(time.time() * 1000))}' 46 | 47 | # 烧仙草 48 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=71704988678033&_={int(round(time.time() * 1000))}' 49 | 50 | # 万达 51 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=71704447587533&_={int(round(time.time() * 1000))}' 52 | 53 | args = parseArgs() 54 | 55 | ExchangeManagement( 56 | url=url, 57 | headers=headers, 58 | headers_user_agent_random_flag=True, 59 | user_agent="", 60 | body_dict={}, 61 | batch_size=args.batch_size if args.batch_size > 0 else 12, 62 | other_batch_size=0, 63 | second_ahead=0, 64 | sleep_time=0, 65 | thread_number=args.thread_number if args.thread_number > 0 else 20, 66 | log_flag=False, 67 | sign_flag=False, 68 | day_or_week='day', 69 | post_flag=False, 70 | proxy_flag=args.proxy_flag if args.proxy_flag else True, 71 | print_type="cmd", 72 | coupon_type="plus_quanyi", 73 | cookie_type=args.cookie_type if args.cookie_type != "None" else "mine_coupons").\ 74 | executeInDesktop( 75 | clock_list=[0, 10], 76 | debug_flag=args.debug_flag if args.debug_flag else True) -------------------------------------------------------------------------------- /py37/exchange_test_delay.py: -------------------------------------------------------------------------------- 1 | from exchange_lib import * 2 | 3 | 4 | def testRequestDelayThread(url, headers, body_dict, proxy_flag, thread_id, res_dict={}, post_flag=True): 5 | printT("Calculating request delay test...") 6 | 7 | start_time = time.time() 8 | try: 9 | if post_flag: 10 | res = requests.post(url=url, verify=False, headers=headers, 11 | data=body_dict, proxies=getProxies(proxy_flag), timeout=3) 12 | else: 13 | res = requests.get(url=url, verify=False, headers=headers, 14 | data=body_dict, proxies=getProxies(proxy_flag), timeout=3) 15 | # res_dict[thread_id] = time.time() - start_time 16 | res_dict[thread_id] = res.elapsed.total_seconds() 17 | # print(res.headers) 18 | print(res_dict[thread_id], time.time() - start_time) 19 | d = datetime.datetime.fromtimestamp(int(res.headers['X-API-Request-Id'].split('-')[-1]) / 1000) 20 | str1 = d.strftime("%Y-%m-%d %H:%M:%S.%f") 21 | 22 | 23 | # print(time.time() - start_time, res_dict[thread_id]) 24 | # printT(f"Current IP address and Port: {res.raw._connection.sock.socket.getsockname()}") 25 | except Exception: 26 | return 27 | 28 | 29 | def testRequestDelay(url, headers, body_dict, sleep_time=0.03, proxy_flag=False, post_flag=True): 30 | printT("Calculating request delay...") 31 | headers = json.loads(json.dumps(headers)) 32 | if "Cookie" in headers: headers['Cookie'] = "" 33 | if "cookie" in headers: headers['cookie'] = "" 34 | thread_number, threads, res_dict = 30, [], {} 35 | for i in range(thread_number): 36 | threads.append(threading.Thread(target=testRequestDelayThread, 37 | args=(url, headers, body_dict, proxy_flag, i, res_dict, post_flag, ))) 38 | for i in range(thread_number): 39 | threads[i].start() 40 | time.sleep(sleep_time) 41 | for i in range(thread_number): 42 | threads[i].join() 43 | res = sorted(res_dict.values()) 44 | res_dict = collections.Counter([int(100*x+1)/100.0 for x in res]) 45 | 46 | # import matplotlib.pyplot as plt 47 | # 48 | # params = { 49 | # 'figure.figsize': '8, 4' 50 | # } 51 | # plt.rcParams.update(params) 52 | # plt.bar(res_dict.keys(), res_dict.values(), width=0.01) 53 | # plt.show() 54 | 55 | printT(res_dict) 56 | res = [x[0] for x in res_dict.most_common(3)] 57 | if len(res): 58 | result = min(res) + 0.02 59 | printT(f"Request delay: {result}s.") 60 | return result 61 | else: 62 | printT("Warning: The proxy is not available! Set the delay to 0.12ms.") 63 | return 0.12 64 | 65 | 66 | if __name__ == "__main__": 67 | 68 | headers = { 69 | "Accept": "*/*", 70 | "Accept-Encoding": "gzip, deflate", 71 | "Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7", 72 | "Connection": "keep-alive", 73 | "Content-Type": "application/x-www-form-urlencoded", 74 | 'origin': 'https://pro.m.jd.com', 75 | "Referer": "https://prodev.m.jd.com/jdlite/active/3H885vA4sQj6ctYzzPVix4iiYN2P/index.html?sid=bf6ae253e73f472d5ec294810f46665w&un_area=7_502_35752_35860" 76 | } 77 | body_dict = { 78 | 'activityId': '3H885vA4sQj6ctYzzPVix4iiYN2P', 79 | 'scene': '1', 80 | 'args': 'key=6E3ED4217CA5BA50CC868072587749279A819E91EC8217F49BC1DB9DC674DA27CF93291755C086262CF2BD2DADDD8138_bingo,roleId=A921D0996A757D3D319487D17C0F25FE0F6830D8485A69E35623B13BFBA59D1E7C2386D90F3D9D3A6D752ADCDEAB0529AA56BDE4467494DC5590AEB5C7C950D03EA337E197D9AF250FA7148376C8A9C2C3FC8B2D9632A67F79B5A98776BF5B6C94F3F3F8F3770E265EF7D6CAD2E5F1B98EE03623B492E1C2B96EBC7500E20DAB9C2BBC9CBBA7AA027CBB17434C77651F9DE32AEAE13EA4C6B7660D4FD53E63FF_bingo,strengthenKey=3FE987FADD098B5D46BA38B21875A5EBD8C02F19572CB3C5CC0385902CD416A2FE3B5DC71CEBCF672000554484FB93E5_bingo' 81 | } 82 | url = 'https://api.m.jd.com/client.action?functionId=lite_newBabelAwardCollection&client=wh5&clientVersion=1.0.0' 83 | 84 | args = parseArgs() 85 | 86 | requests.packages.urllib3.disable_warnings() 87 | 88 | os.environ["PROXY_IP"] = args.proxy_ip if len(args.proxy_ip) else 'http://127.0.0.1:7890' 89 | 90 | if args.proxy_flag: 91 | printT(f"The proxy ip is set to {os.environ['PROXY_IP']}") 92 | 93 | testRequestDelay(url, headers, body_dict, 94 | sleep_time=0, 95 | proxy_flag=args.proxy_flag if args.proxy_flag else False, 96 | post_flag=True) 97 | -------------------------------------------------------------------------------- /py37/exchange_xiaomi.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | from exchange_lib import * 4 | 5 | cookie = '' 6 | 7 | headers = { 8 | "Host": "m.mi.com", 9 | "accept": "application/json, text/plain, */*", 10 | "content-type": "application/x-www-form-urlencoded", 11 | "origin": "https://m.mi.com", 12 | "x-requested-with": "com.tencent.mm", 13 | "sec-fetch-site": "same-origin", 14 | "sec-fetch-mode": "cors", 15 | "sec-fetch-dest": "empty", 16 | "referer": "https://m.mi.com/w/mishop_activity?_rt=weex&pageid=861&sign=e86407ce821e68e65aec6c7cdbab9dad&pdl=jianyu&g_device_id=xmlitedevice_urrjpnxhe9rfj00h", 17 | "accept-encoding": "gzip, deflate", 18 | "accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7" 19 | # "cookie": ".thumbcache_2959214a7e70e5f2bd017e23a2a3e462=KifJ0TJXA5D66fNHvMYtIakmi27D8KNo8Q2jNvDBF+GbRYXw6CUX+jHYIh2x+Ja3GZP+2Nsv3GTABOXDsVs3pw%3D%3D" 20 | } 21 | 22 | url = "https://m.mi.com/v1/activity/page_draw_query" 23 | 24 | body_dict = "activity_codes=0Tg3B8vHw8Xcrs57JfEmeA==" 25 | 26 | args = parseArgs() 27 | 28 | ExchangeManagement( 29 | url=url, 30 | headers=headers, 31 | headers_user_agent_random_flag=False, 32 | user_agent="Mozilla/5.0 (Linux; Android 9; MI 6 Build/PKQ1.190118.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/86.0.4240.99 XWEB/3263 MMWEBSDK/20210902 Mobile Safari/537.36 MMWEBID/2219 MicroMessenger/8.0.15.2020(0x28000F3D) Process/appbrand0 WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 miniProgram", 33 | body_dict=body_dict, 34 | batch_size=args.batch_size if args.batch_size > 0 else 12, 35 | other_batch_size=0, 36 | second_ahead=0, 37 | sleep_time=0, 38 | thread_number=args.thread_number if args.thread_number > 0 else 40, 39 | append_flag=False, 40 | log_flag=False, 41 | sign_flag=False, 42 | day_or_week='day', 43 | post_flag=True, 44 | print_type="cmd", 45 | proxy_flag=args.proxy_flag if args.proxy_flag else True, 46 | coupon_type="xiaomi", 47 | cookie_type=args.cookie_type if args.cookie_type != 'None' else 'xiaomi') \ 48 | .executeInDesktop( 49 | clock_list=[10], 50 | debug_flag=args.debug_flag if args.debug_flag else False 51 | ) 52 | -------------------------------------------------------------------------------- /py37/pytransform/__init__.py: -------------------------------------------------------------------------------- 1 | # These module alos are used by protection code, so that protection 2 | # code needn't import anything 3 | import os 4 | import platform 5 | import sys 6 | import struct 7 | 8 | # Because ctypes is new from Python 2.5, so pytransform doesn't work 9 | # before Python 2.5 10 | # 11 | from ctypes import cdll, c_char, c_char_p, c_int, c_void_p, \ 12 | pythonapi, py_object, PYFUNCTYPE, CFUNCTYPE 13 | from fnmatch import fnmatch 14 | 15 | # 16 | # Support Platforms 17 | # 18 | plat_path = 'platforms' 19 | 20 | plat_table = ( 21 | ('windows', ('windows', 'cygwin-*')), 22 | ('darwin', ('darwin', 'ios')), 23 | ('linux', ('linux*',)), 24 | ('freebsd', ('freebsd*', 'openbsd*')), 25 | ('poky', ('poky',)), 26 | ) 27 | 28 | arch_table = ( 29 | ('x86', ('i?86', )), 30 | ('x86_64', ('x64', 'x86_64', 'amd64', 'intel')), 31 | ('arm', ('armv5',)), 32 | ('armv6', ('armv6l',)), 33 | ('armv7', ('armv7l',)), 34 | ('ppc64', ('ppc64le',)), 35 | ('mips32', ('mips',)), 36 | ('aarch32', ('aarch32',)), 37 | ('aarch64', ('aarch64', 'arm64')) 38 | ) 39 | 40 | # 41 | # Hardware type 42 | # 43 | HT_HARDDISK, HT_IFMAC, HT_IPV4, HT_IPV6, HT_DOMAIN = range(5) 44 | 45 | # 46 | # Global 47 | # 48 | _pytransform = None 49 | 50 | 51 | class PytransformError(Exception): 52 | pass 53 | 54 | 55 | def dllmethod(func): 56 | def wrap(*args, **kwargs): 57 | return func(*args, **kwargs) 58 | return wrap 59 | 60 | 61 | @dllmethod 62 | def version_info(): 63 | prototype = PYFUNCTYPE(py_object) 64 | dlfunc = prototype(('version_info', _pytransform)) 65 | return dlfunc() 66 | 67 | 68 | @dllmethod 69 | def init_pytransform(): 70 | major, minor = sys.version_info[0:2] 71 | # Python2.5 no sys.maxsize but sys.maxint 72 | # bitness = 64 if sys.maxsize > 2**32 else 32 73 | prototype = PYFUNCTYPE(c_int, c_int, c_int, c_void_p) 74 | init_module = prototype(('init_module', _pytransform)) 75 | ret = init_module(major, minor, pythonapi._handle) 76 | if (ret & 0xF000) == 0x1000: 77 | raise PytransformError('Initialize python wrapper failed (%d)' 78 | % (ret & 0xFFF)) 79 | return ret 80 | 81 | 82 | @dllmethod 83 | def init_runtime(): 84 | prototype = PYFUNCTYPE(c_int, c_int, c_int, c_int, c_int) 85 | _init_runtime = prototype(('init_runtime', _pytransform)) 86 | return _init_runtime(0, 0, 0, 0) 87 | 88 | 89 | @dllmethod 90 | def encrypt_code_object(pubkey, co, flags, suffix=''): 91 | _pytransform.set_option(6, suffix.encode()) 92 | prototype = PYFUNCTYPE(py_object, py_object, py_object, c_int) 93 | dlfunc = prototype(('encrypt_code_object', _pytransform)) 94 | return dlfunc(pubkey, co, flags) 95 | 96 | 97 | @dllmethod 98 | def generate_license_file(filename, priname, rcode, start=-1, count=1): 99 | prototype = PYFUNCTYPE(c_int, c_char_p, c_char_p, c_char_p, c_int, c_int) 100 | dlfunc = prototype(('generate_project_license_files', _pytransform)) 101 | return dlfunc(filename.encode(), priname.encode(), rcode.encode(), 102 | start, count) if sys.version_info[0] == 3 \ 103 | else dlfunc(filename, priname, rcode, start, count) 104 | 105 | 106 | @dllmethod 107 | def generate_license_key(prikey, keysize, rcode): 108 | prototype = PYFUNCTYPE(py_object, c_char_p, c_int, c_char_p) 109 | dlfunc = prototype(('generate_license_key', _pytransform)) 110 | return dlfunc(prikey, keysize, rcode) if sys.version_info[0] == 2 \ 111 | else dlfunc(prikey, keysize, rcode.encode()) 112 | 113 | 114 | @dllmethod 115 | def get_registration_code(): 116 | prototype = PYFUNCTYPE(py_object) 117 | dlfunc = prototype(('get_registration_code', _pytransform)) 118 | return dlfunc() 119 | 120 | 121 | @dllmethod 122 | def get_expired_days(): 123 | prototype = PYFUNCTYPE(py_object) 124 | dlfunc = prototype(('get_expired_days', _pytransform)) 125 | return dlfunc() 126 | 127 | 128 | @dllmethod 129 | def clean_obj(obj, kind): 130 | prototype = PYFUNCTYPE(c_int, py_object, c_int) 131 | dlfunc = prototype(('clean_obj', _pytransform)) 132 | return dlfunc(obj, kind) 133 | 134 | 135 | def clean_str(*args): 136 | tdict = { 137 | 'str': 0, 138 | 'bytearray': 1, 139 | 'unicode': 2 140 | } 141 | for obj in args: 142 | k = tdict.get(type(obj).__name__) 143 | if k is None: 144 | raise RuntimeError('Can not clean object: %s' % obj) 145 | clean_obj(obj, k) 146 | 147 | 148 | def get_hd_info(hdtype, size=256): 149 | if hdtype not in range(HT_DOMAIN + 1): 150 | raise RuntimeError('Invalid parameter hdtype: %s' % hdtype) 151 | t_buf = c_char * size 152 | buf = t_buf() 153 | if (_pytransform.get_hd_info(hdtype, buf, size) == -1): 154 | raise PytransformError('Get hardware information failed') 155 | return buf.value.decode() 156 | 157 | 158 | def show_hd_info(): 159 | return _pytransform.show_hd_info() 160 | 161 | 162 | def assert_armored(*names): 163 | prototype = PYFUNCTYPE(py_object, py_object) 164 | dlfunc = prototype(('assert_armored', _pytransform)) 165 | 166 | def wrapper(func): 167 | def wrap_execute(*args, **kwargs): 168 | dlfunc(names) 169 | return func(*args, **kwargs) 170 | return wrap_execute 171 | return wrapper 172 | 173 | 174 | def get_license_info(): 175 | info = { 176 | 'ISSUER': None, 177 | 'EXPIRED': None, 178 | 'HARDDISK': None, 179 | 'IFMAC': None, 180 | 'IFIPV4': None, 181 | 'DOMAIN': None, 182 | 'DATA': None, 183 | 'CODE': None, 184 | } 185 | rcode = get_registration_code().decode() 186 | if rcode.startswith('*VERSION:'): 187 | index = rcode.find('\n') 188 | info['ISSUER'] = rcode[9:index].split('.')[0].replace('-sn-1.txt', '') 189 | rcode = rcode[index+1:] 190 | 191 | index = 0 192 | if rcode.startswith('*TIME:'): 193 | from time import ctime 194 | index = rcode.find('\n') 195 | info['EXPIRED'] = ctime(float(rcode[6:index])) 196 | index += 1 197 | 198 | if rcode[index:].startswith('*FLAGS:'): 199 | index += len('*FLAGS:') + 1 200 | info['FLAGS'] = ord(rcode[index - 1]) 201 | 202 | prev = None 203 | start = index 204 | for k in ['HARDDISK', 'IFMAC', 'IFIPV4', 'DOMAIN', 'FIXKEY', 'CODE']: 205 | index = rcode.find('*%s:' % k) 206 | if index > -1: 207 | if prev is not None: 208 | info[prev] = rcode[start:index] 209 | prev = k 210 | start = index + len(k) + 2 211 | info['CODE'] = rcode[start:] 212 | i = info['CODE'].find(';') 213 | if i > 0: 214 | info['DATA'] = info['CODE'][i+1:] 215 | info['CODE'] = info['CODE'][:i] 216 | return info 217 | 218 | 219 | def get_license_code(): 220 | return get_license_info()['CODE'] 221 | 222 | 223 | def get_user_data(): 224 | return get_license_info()['DATA'] 225 | 226 | 227 | def _match_features(patterns, s): 228 | for pat in patterns: 229 | if fnmatch(s, pat): 230 | return True 231 | 232 | 233 | def _gnu_get_libc_version(): 234 | try: 235 | prototype = CFUNCTYPE(c_char_p) 236 | ver = prototype(('gnu_get_libc_version', cdll.LoadLibrary('')))() 237 | return ver.decode().split('.') 238 | except Exception: 239 | pass 240 | 241 | 242 | def format_platform(platid=None): 243 | if platid: 244 | return os.path.normpath(platid) 245 | 246 | plat = platform.system().lower() 247 | mach = platform.machine().lower() 248 | 249 | for alias, platlist in plat_table: 250 | if _match_features(platlist, plat): 251 | plat = alias 252 | break 253 | 254 | if plat == 'linux': 255 | cname, cver = platform.libc_ver() 256 | if cname == 'musl': 257 | plat = 'musl' 258 | elif cname == 'libc': 259 | plat = 'android' 260 | elif cname == 'glibc': 261 | v = _gnu_get_libc_version() 262 | if v and len(v) >= 2 and (int(v[0]) * 100 + int(v[1])) < 214: 263 | plat = 'centos6' 264 | 265 | for alias, archlist in arch_table: 266 | if _match_features(archlist, mach): 267 | mach = alias 268 | break 269 | 270 | if plat == 'windows' and mach == 'x86_64': 271 | bitness = struct.calcsize('P'.encode()) * 8 272 | if bitness == 32: 273 | mach = 'x86' 274 | 275 | return os.path.join(plat, mach) 276 | 277 | 278 | # Load _pytransform library 279 | def _load_library(path=None, is_runtime=0, platid=None, suffix=''): 280 | path = os.path.dirname(__file__) if path is None \ 281 | else os.path.normpath(path) 282 | 283 | plat = platform.system().lower() 284 | name = '_pytransform' + suffix 285 | if plat == 'linux': 286 | filename = os.path.abspath(os.path.join(path, name + '.so')) 287 | elif plat == 'darwin': 288 | filename = os.path.join(path, name + '.dylib') 289 | elif plat == 'windows': 290 | filename = os.path.join(path, name + '.dll') 291 | elif plat == 'freebsd': 292 | filename = os.path.join(path, name + '.so') 293 | else: 294 | raise PytransformError('Platform %s not supported' % plat) 295 | 296 | if platid is not None and os.path.isfile(platid): 297 | filename = platid 298 | elif platid is not None or not os.path.exists(filename) or not is_runtime: 299 | libpath = platid if platid is not None and os.path.isabs(platid) else \ 300 | os.path.join(path, plat_path, format_platform(platid)) 301 | filename = os.path.join(libpath, os.path.basename(filename)) 302 | 303 | if not os.path.exists(filename): 304 | raise PytransformError('Could not find "%s"' % filename) 305 | 306 | try: 307 | m = cdll.LoadLibrary(filename) 308 | except Exception as e: 309 | if sys.flags.debug: 310 | print('Load %s failed:\n%s' % (filename, e)) 311 | raise 312 | 313 | # Removed from v4.6.1 314 | # if plat == 'linux': 315 | # m.set_option(-1, find_library('c').encode()) 316 | 317 | if not os.path.abspath('.') == os.path.abspath(path): 318 | m.set_option(1, path.encode() if sys.version_info[0] == 3 else path) 319 | 320 | # Required from Python3.6 321 | m.set_option(2, sys.byteorder.encode()) 322 | 323 | if sys.flags.debug: 324 | m.set_option(3, c_char_p(1)) 325 | m.set_option(4, c_char_p(not is_runtime)) 326 | 327 | # Disable advanced mode if required 328 | # m.set_option(5, c_char_p(1)) 329 | 330 | # Set suffix for private package 331 | if suffix: 332 | m.set_option(6, suffix.encode()) 333 | 334 | return m 335 | 336 | 337 | def pyarmor_init(path=None, is_runtime=0, platid=None, suffix=''): 338 | global _pytransform 339 | _pytransform = _load_library(path, is_runtime, platid, suffix) 340 | return init_pytransform() 341 | 342 | 343 | def pyarmor_runtime(path=None, suffix=''): 344 | pyarmor_init(path, is_runtime=1, suffix=suffix) 345 | init_runtime() 346 | 347 | # ---------------------------------------------------------- 348 | # End of pytransform 349 | # ---------------------------------------------------------- 350 | 351 | # 352 | # Not available from v5.6 353 | # 354 | 355 | 356 | def generate_capsule(licfile): 357 | prikey, pubkey, prolic = _generate_project_capsule() 358 | capkey, newkey = _generate_pytransform_key(licfile, pubkey) 359 | return prikey, pubkey, capkey, newkey, prolic 360 | 361 | 362 | @dllmethod 363 | def _generate_project_capsule(): 364 | prototype = PYFUNCTYPE(py_object) 365 | dlfunc = prototype(('generate_project_capsule', _pytransform)) 366 | return dlfunc() 367 | 368 | 369 | @dllmethod 370 | def _generate_pytransform_key(licfile, pubkey): 371 | prototype = PYFUNCTYPE(py_object, c_char_p, py_object) 372 | dlfunc = prototype(('generate_pytransform_key', _pytransform)) 373 | return dlfunc(licfile.encode() if sys.version_info[0] == 3 else licfile, 374 | pubkey) 375 | 376 | 377 | # 378 | # Deprecated functions from v5.1 379 | # 380 | @dllmethod 381 | def encrypt_project_files(proname, filelist, mode=0): 382 | prototype = PYFUNCTYPE(c_int, c_char_p, py_object, c_int) 383 | dlfunc = prototype(('encrypt_project_files', _pytransform)) 384 | return dlfunc(proname.encode(), filelist, mode) 385 | 386 | 387 | def generate_project_capsule(licfile): 388 | prikey, pubkey, prolic = _generate_project_capsule() 389 | capkey = _encode_capsule_key_file(licfile) 390 | return prikey, pubkey, capkey, prolic 391 | 392 | 393 | @dllmethod 394 | def _encode_capsule_key_file(licfile): 395 | prototype = PYFUNCTYPE(py_object, c_char_p, c_char_p) 396 | dlfunc = prototype(('encode_capsule_key_file', _pytransform)) 397 | return dlfunc(licfile.encode(), None) 398 | 399 | 400 | @dllmethod 401 | def encrypt_files(key, filelist, mode=0): 402 | t_key = c_char * 32 403 | prototype = PYFUNCTYPE(c_int, t_key, py_object, c_int) 404 | dlfunc = prototype(('encrypt_files', _pytransform)) 405 | return dlfunc(t_key(*key), filelist, mode) 406 | 407 | 408 | @dllmethod 409 | def generate_module_key(pubname, key): 410 | t_key = c_char * 32 411 | prototype = PYFUNCTYPE(py_object, c_char_p, t_key, c_char_p) 412 | dlfunc = prototype(('generate_module_key', _pytransform)) 413 | return dlfunc(pubname.encode(), t_key(*key), None) 414 | 415 | # 416 | # Compatible for PyArmor v3.0 417 | # 418 | @dllmethod 419 | def old_init_runtime(systrace=0, sysprofile=1, threadtrace=0, threadprofile=1): 420 | '''Only for old version, before PyArmor 3''' 421 | pyarmor_init(is_runtime=1) 422 | prototype = PYFUNCTYPE(c_int, c_int, c_int, c_int, c_int) 423 | _init_runtime = prototype(('init_runtime', _pytransform)) 424 | return _init_runtime(systrace, sysprofile, threadtrace, threadprofile) 425 | 426 | 427 | @dllmethod 428 | def import_module(modname, filename): 429 | '''Only for old version, before PyArmor 3''' 430 | prototype = PYFUNCTYPE(py_object, c_char_p, c_char_p) 431 | _import_module = prototype(('import_module', _pytransform)) 432 | return _import_module(modname.encode(), filename.encode()) 433 | 434 | 435 | @dllmethod 436 | def exec_file(filename): 437 | '''Only for old version, before PyArmor 3''' 438 | prototype = PYFUNCTYPE(c_int, c_char_p) 439 | _exec_file = prototype(('exec_file', _pytransform)) 440 | return _exec_file(filename.encode()) 441 | -------------------------------------------------------------------------------- /py37/pytransform/platforms/darwin/x86_64/_pytransform.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BeHalcyon/fisher_script/dcf6f09fde8a442d90c39ac96fdbb1360fe0879a/py37/pytransform/platforms/darwin/x86_64/_pytransform.dylib -------------------------------------------------------------------------------- /py37/pytransform/platforms/linux/aarch64/_pytransform.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BeHalcyon/fisher_script/dcf6f09fde8a442d90c39ac96fdbb1360fe0879a/py37/pytransform/platforms/linux/aarch64/_pytransform.so -------------------------------------------------------------------------------- /py37/pytransform/platforms/linux/x86_64/_pytransform.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BeHalcyon/fisher_script/dcf6f09fde8a442d90c39ac96fdbb1360fe0879a/py37/pytransform/platforms/linux/x86_64/_pytransform.so -------------------------------------------------------------------------------- /py37/pytransform/platforms/windows/x86_64/_pytransform.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BeHalcyon/fisher_script/dcf6f09fde8a442d90c39ac96fdbb1360fe0879a/py37/pytransform/platforms/windows/x86_64/_pytransform.dll -------------------------------------------------------------------------------- /py38/exchange_59_20.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python3 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称: exchange_59_20_1.py 5 | Author: Fisher 6 | 功能: 7 | Date: 2022-5-12 8 | cron: 0 59 9,13,17,21,23 * * * 9 | ''' 10 | 11 | from exchange_lib import * 12 | 13 | if __name__ == "__main__": 14 | 15 | args = parseArgs() 16 | 17 | ExchangeManagement( 18 | url="", 19 | headers={}, 20 | headers_user_agent_random_flag=False, 21 | user_agent="okhttp/3.12.1;jdmall;android;version/11.0.2;build/97565;", 22 | body_dict={}, 23 | batch_size=args.batch_size if args.batch_size > 0 else 7, 24 | activitiId_random_flag=False, 25 | other_batch_size=0, 26 | # second_ahead=0.31, 27 | second_ahead=0, 28 | sleep_time=0, 29 | thread_number=args.thread_number if args.thread_number > 0 else 40, 30 | append_flag=False, 31 | log_flag=False, 32 | sign_flag=True, 33 | day_or_week='week', 34 | post_flag=True, 35 | proxy_flag=args.proxy_flag if args.proxy_flag else False, 36 | coupon_type="59-20_1", 37 | cookie_type=args.cookie_type if args.cookie_type != 'None' else 'ws_cookies') \ 38 | .executeInDesktop( 39 | clock_list=[0, 10, 14, 18, 22], 40 | debug_flag=args.debug_flag if args.debug_flag else False 41 | ) -------------------------------------------------------------------------------- /py38/exchange_9.9.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python3 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称:exchange_9.9.py 5 | Author: yangyang 6 | 功能: 7 | Date: 2022-5-7 8 | cron: 10 59 9,15 * * * 9 | new Env("券后9.9"); 10 | ''' 11 | from exchange_lib import * 12 | 13 | if __name__ == "__main__": 14 | url = "https://api.m.jd.com/client.action?functionId=centerReceiveCoupon&appid=XPMSGC2019&monitorSource=&client=m&eu=5616666313239356&fv=4683736316461646" 15 | headers = { 16 | "accept": "application/json, text/plain, */*", 17 | "accept-language": "en-US,en;q=0.9", 18 | "accept-encoding": "gzip, deflate, br", 19 | "content-type": "application/x-www-form-urlencoded", 20 | "origin": "https://h5.m.jd.com", 21 | "x-request-with": "com.jingdong.app.mall", 22 | "referer": "https://h5.m.jd.com/", 23 | "sec-fetch-dest": "empty", 24 | "sec-fetch-mode": "cors", 25 | "sec-fetch-site": "same-site" 26 | } 27 | # extend = "A0F322DB0C038E1603CAC2127B1D86BC0F09FFD58755FE96E1687E0350887FBA79997E8E037402B0F6EF97C2D50C376F1B80FD03148C5F7D1054DBAE7D8F6D995F271D3665A05F94AB2F5C83B6D04B1B80251EF1D2F4633121F074F21AB9B37948B88A080E5C2891179D54F7ABB3756673D538D9372A24D540DDFB6C7C4541793A8C1E67C32FD58559501873FAD35D3FAF0788F5881EF1D96C826EA822F393642E93EF2864D4897D9C3FD1FD190BDBDAB8B1A95438847E5310BAC4F859166A9DBAE68C094DD31B5C5003C4C44373373F" 28 | 29 | extend = "A0F322DB0C038E1603CAC2127B1D86BC0F09FFD58755FE96E1687E0350887FBA79997E8E037402B0F6EF97C2D50C376F1B80FD03148C5F7D1054DBAE7D8F6D995F271D3665A05F94AB2F5C83B6D04B1B80251EF1D2F4633121F074F21AB9B3795DEACE40B717C2B866502C1577E6DC65E9B3BA97EBD16C414EB97B9758C203763A8C1E67C32FD58559501873FAD35D3FAF0788F5881EF1D96C826EA822F393642E93EF2864D4897D9C3FD1FD190BDBDA0D3E790119A83BE78D78AB958319ABAABAE68C094DD31B5C5003C4C44373373F" 30 | body_dict = { 31 | "extend": extend, 32 | "rcType": "1", "source": "couponCenter_app", "random": "7172621", "couponSource": "1", 33 | "extraData": "{\"log\":\"1664262320487~1zcCSCr3sAvMDFHQ1hvTjAxMQ==.dnVuW3xxcWpWf3NzaxEUAHVgDAUOdzM/MHZvbkN7a3ImXTB2PSY=.e8166796~5,1~52A8C75FE07D55CA0A9C1BCBC761465F9927C7A4~1jjtok1~C~SBNBXhEDaWQVFEZbXhELbhFXCB8OARoEeh9mHUAfRxseG10DHwIEHwd4HwIKHggXBgIFH0cTGRFXDh8ODhoEeB8BCRkCHQkCCRVCEGgfEVZHXREDAwgVFEFGEQkTBAUFDQAPCwUDDAQDCQELAwwQFRtBV1ERCRNBR0dNRhsVFEVQUhELF1VVTUZNTUNTFx8RQVFdEQNpDRUDAAUfBR0EAh8IHgxkGhBfWRELBh8RWkEbAxRUUwUABQYGCl9XXQgCVldRVlACVQILBg8BAAFQVgIDUREfG1xJGwwQeVpdRE0TUlhAWlEABhcfEUUXCQIPBA0LAAAGAQMFDQQfG1hSGwwQGARQAQYGVl9QCgBVARhWUlcDAgEAV10BAQRUV1JVGFYBDwMNCQVXDQoBVFBVBwAHWg1TA1QDCgBXCgsMUA5cAFRRAQcTGRFVSVAbAxQQGRFdRxcJEX5dVl5aVxV6XVIbER8bXFhPFAgXCgsCBgMRFRBKWkQQD2gLAA0fAAABZBUUQFoRCWoXfnoZChsVFFNbV0FeXFcRFRAAGxoQBAIdAxsFERUQAAEFAQURHxMABQIPBA8PBQMGAQAIBgYFFAYPAQUFBgUAAAMHBQgEDQ8UHhcCEWwZEVpWUxsDFFRTVVVXU0dHGx4bWFwQDxFGExkRUFAQAxtBARsCHQEXHxFaVGZPFAgXAwITGRFRXRADG0RTW1dcXAgEAg4ADwsHEBkRXlsXCWgIHgkVBm8ZEVFdWlQRAxAIDwAGBwUBAw0EBQEERwh7UFlrZmNQW0VDf31zXWhtdUplYXJKdFUEBBhkY317Y1sKYG9na3xQA3dmYmBCY2ttUV54XGBkcXZocn5Eb3h6CANcZnViYWd3fW91QQFvfkJ6XH9mVEZ1cG9+ZkhWGHdLBQpyXmdxfnRzRGNgeAV7SUp1fWxjW1NlRGNzYFxwdmpoUHNnRHp9d2ZHcWBsYXFnbwR3dFJ0dmFZanxiZwd/SgRgfWBwfn9qf0d7WmZ4Y3BYCHNRbGBzcFBRemd6BHIBCX51Smd0f3MBV2BsZ2NwTmNdeHtGd39LdAZwb3NjeHELdntycl9weE5/Z3Bif3BnZkBwWUpPegNkVHxIWWJ9fGdfX0wCfHZaXg16d3wHdHtRZHBifnpyRH1sdENeUGpncmpwW1h7fWd3fWZzd2t/WWBJHQsLCwAABwVSTUkZAk1HTHtHYgJzdWJwDWZmaAd+emN8ZGsCBVd2X153flJ4VmJhZX5zAnpuZWtvd3VnYWRjQkt7b0psWHNebHBSWXRkcFFrentjc292ZnN3d2Z4cXh4B2ZzdlhkbVhianYJYHBhUmZgdndxUnxaWnNwXnh0ZlZkZnRsVm99dGN7dXV8cmBUXXt7UXx4SwJBAUFXRksQFRtbQVIRCRMXTg==~19cnnnp\",\"sceneid\":\"couponNinePointNineHome\"}"} 34 | 35 | # 感冒灵 36 | extend = "43637CD87226EA2E335863F219ABC3D7F6C12FFEF67B4A334C3FD21871640F7283AB3B66E44F81A17C1A6A624A9DA4801B80FD03148C5F7D1054DBAE7D8F6D995F271D3665A05F94AB2F5C83B6D04B1BE54C50985C41FD2D58DBA76F2CD6DB02AC56646B328B4C44646B973087A7213FF3A98E7DBB08CFBC1DFCF12089B6A3533A8C1E67C32FD58559501873FAD35D3FED6926BB1743834D4361F61A275BD74B2E93EF2864D4897D9C3FD1FD190BDBDA8FE0F737B1945FC4B1D71C3FE08EF38392E65B68F750B18F516AF30F55398C7150AC93F8FAD90D456227C60734534054" 37 | body_dict = { 38 | "extend": extend, 39 | "rcType":"1","source":"couponCenter_app","random":"2908621","couponSource":"1","extraData":"{\"log\":\"1664298182254~1KDw59zPMGzMDF3bE5FRTAxMQ==.Rlp4cXdOVH9zc0VVejsQGDV3HCk9VB8HO0ZAeGlwW10wdztGEjA=.59d6dec8~5,1~9F31050F51E8246CEDE624F5182C8C173B9BEB47~0rr2xke~C~SRZNWhACbG4fGkVbVBAOYhVWDRoFZRQHZBV2fgkbAxYHAwMURRcVEFAOGgRuGwViFHV+dh4FFwcCCBtHEWUdF15AWhsNAxQVQEAaCxcIBAINBQsABgUHDQYCDwoMDBUeGkBWVxoLF01GQE1DEBQVRFZZEw8bVFJNQ0ZMQlIRFBNFXVwWA2wGFAIBAxQHGQgDGAgbB2UbEVlSEw8IHhZaRBACFVVVDgIBCgcNX1JWCQNXUVpUVA5UBQsDBAABAFZdAAddEBgbWUIaDRF/UV9AQRJVWEVRUAEHERQTQRsIBQ8BBgoOCwIAAwcMBhgbXVkaDREeD1IFCgdRX1UBAVQAHl1QUw8DBgBSVgAABVJcUFEUVwYPBgYIBFYLAQNQXFQAAAJRDFICUggIBFsLDAxVBV0BVVcKBRcVEFJJVRACFREfGl9DGwgWflhdX1tWE3FfVhcQGBtZU04VCREBCQYKAhYVFUFbRREJYwkEAR4HAARvFBVBXBoLbht/fRkPEBQVUl1cQ1pQVhYVFQsaGxECCR8HFwQWFRULAAQAAxodFwwEBQ8BBA4EAgAKAgwKBwIUAwQABAQADgIEDwYCCAEGDhUfEQkTaBUQXVZWEAIVVVVeV1NfRkAbGxBZXREJGkQXFRBXUBUIGkAAHQkfBRseFlpRbU4VCREIABcVEFZdFQgaRVJdXF5YBAANCQ8ECgYRHxpcXxsIbwgbAhQHbh8aU1lWVRYDFQMOAQcBAQkEDAEHDAVMCX5nAEsFf25LBmN6dnIDVl1ye2NDc010UA8FGWBmQHRTbmR2bWJGAG0DdXVgT1plYFIPRXFfRAN1WlZxeWZVYHF/YQplfUJ4X0tYc3VwT119YQwCe1F/BHR2Qn51cANRdHENdXN7XGt/TkBEcWUFCnh3fFZ3U25paQhwen9acWpyZktUfFRhZHhBa2N7QFlxcF0CUHRzWnR/VHp9fF1qfXZlf3V8XFJlcWwHR3dsCWBqS1t2cHNTfHIAT3N7aAIAfHBRWXFxVwF/UnBxZ1cDdmhAQFp9A2xdf3Z4c30IB2N+QWBWcnAMWmdKYWJnA1tGck5ZTnBvcwl6A0BScHF3f38JblliZHZrfWNwVGJ3DQFxT355d19wTXhgDXVxc3VxYmIAU3puf1Z8XHAMfVtLcX1mDUIaC1UEXFMLVghPTBUDSkdJcEZkW31/dGReYGJ/X3NucmFrb10NXWBYQWZ6CH1XZHpwUXwDYWt0cH5ja3UIZmQIXnVvdQNqZXZpXWlzb3pjCH5UbmJpdGB3e19lYk1WZG1yVWZ+SWxsZERsZVp9UnYCcWZ2a3BnfF8Ka2ACV05jZ3R4cV5yc31PA2RqSXR1d0NadnBPcmB7QHtnaEp9c3JFdVRycXlVcAhecHx2QWx1cnp7cF1wVHFVQ2t9UFhnbXB4X3N2AXN0UwMOTQhQX1pHWEEVHhpaQFQaCxcbTw==~0a6rhcq\",\"sceneid\":\"couponNinePointNineHome\"}"} 40 | 41 | args = parseArgs() 42 | 43 | ExchangeManagement( 44 | url=url, 45 | headers=headers, 46 | headers_user_agent_random_flag=False, 47 | user_agent="jdapp;android;10.5.2;;;appBuild/96428;ef/1;ep/%7B%22hdid%22%3A%22JM9F1ywUPwflvMIpYPok0tt5k9kW4ArJEU3lfLhxBqw%3D%22%2C%22ts%22%3A1655122900598%2C%22ridx%22%3A-1%2C%22cipher%22%3A%7B%22sv%22%3A%22EG%3D%3D%22%2C%22ad%22%3A%22EJvuZwZtYwYnCtqzDtrwDK%3D%3D%22%2C%22od%22%3A%22YtLwCzc0DQG3ZNOzEQS2Zq%3D%3D%22%2C%22ov%22%3A%22Ctq%3D%22%2C%22ud%22%3A%22EJvuZwZtYwYnCtqzDtrwDK%3D%3D%22%7D%2C%22ciphertype%22%3A5%2C%22version%22%3A%221.2.0%22%2C%22appname%22%3A%22com.jingdong.app.mall%22%7D;jdSupportDarkMode/0;Mozilla/5.0 (Linux; Android 9; MI 6 Build/PKQ1.190118.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/89.0.4389.72 MQQBrowser/6.2 TBS/046010 Mobile Safari/537.36", 48 | body_dict=body_dict, 49 | batch_size=args.batch_size if args.batch_size > 0 else 12, 50 | other_batch_size=0, 51 | second_ahead=0.16, 52 | sleep_time=0, 53 | thread_number=args.thread_number if args.thread_number > 0 else 35, 54 | append_flag=False, 55 | log_flag=False, 56 | sign_flag=False, 57 | day_or_week='day', 58 | post_flag=True, 59 | print_type="cmd", 60 | proxy_flag=args.proxy_flag if args.proxy_flag else False, 61 | coupon_type="9.9", 62 | cookie_type=args.cookie_type if args.cookie_type != 'None' else 'mine_coupons') \ 63 | .executeInDesktop( 64 | clock_list=[10], 65 | debug_flag=args.debug_flag if args.debug_flag else False 66 | ) 67 | -------------------------------------------------------------------------------- /py38/exchange_check_coupons.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称:exchange_check_coupons.py 5 | Author: yangyang 6 | 功能: 7 | Date: 2022-5-22 8 | cron: 0 23 14,20 * * * 9 | new Env("优惠券通知"); 10 | ''' 11 | from exchange_lib import * 12 | 13 | if __name__ == '__main__': 14 | 15 | args = parseArgs() 16 | 17 | ExchangeManagement(cookie_type=args.cookie_type if args.cookie_type != "None" else "mine") 18 | 19 | cookies = os.environ["JD_COOKIE"].split('&') if "JD_COOKIE" in os.environ else [] 20 | 21 | summary = "优惠券速览" 22 | content = "" 23 | for cookie in cookies: 24 | content += findCoupons(cookie) 25 | print(content) 26 | sendNotification(summary=summary, content=content) 27 | -------------------------------------------------------------------------------- /py38/exchange_check_redpacket.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称:exchange_check_coupons.py 5 | Author: yangyang 6 | 功能: 7 | Date: 2022-5-22 8 | cron: 0 23 14,20 * * * 9 | new Env("红包通知"); 10 | ''' 11 | from exchange_lib import * 12 | 13 | if __name__ == '__main__': 14 | 15 | args = parseArgs() 16 | 17 | ExchangeManagement(cookie_type=args.cookie_type if args.cookie_type != "None" else "mine") 18 | 19 | cookies = os.environ["JD_COOKIE"].split('&') if "JD_COOKIE" in os.environ else [] 20 | 21 | summary = "红包速览" 22 | content = "" 23 | for cookie in cookies: 24 | content += findRedPacket(cookie) 25 | print(content) 26 | sendNotification(summary=summary, content=content) 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /py38/exchange_evaluation.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | from exchange_lib import * 3 | try: 4 | import jieba.analyse 5 | except Exception: 6 | print("Error in importing jieba module, please run 'pip install jieba' in command line.") 7 | exit() 8 | 9 | jieba.setLogLevel(jieba.logging.INFO) 10 | 11 | def generateComment(pname): 12 | try: 13 | name = jieba.analyse.textrank(pname, topK=5, allowPOS='n')[0] 14 | except: 15 | name = "宝贝" 16 | 17 | datas = { 18 | "start": [ 19 | "考虑买这个$之前我是有担心过的,因为我不知道$的质量和品质怎么样,但是看了评论后我就放心了。", 20 | "买这个$之前我是有看过好几家店,最后看到这家店的评价不错就决定在这家店买 ", 21 | "看了好几家店,也对比了好几家店,最后发现还是这一家的$评价最好。", 22 | "看来看去最后还是选择了这家。", 23 | "之前在这家店也买过其他东西,感觉不错,这次又来啦。", 24 | "这家的$的真是太好用了,用了第一次就还想再用一次。", 25 | "其实一直都想入手一款$,但找不到合适的。", 26 | "做工看的出很优秀,手感也很好,和描述几乎一致。", 27 | "这个价格来说很具性价比,但是质量还是很不错的,装东西够用了,非常合适,质量也好," 28 | "没感觉到什么难闻的味,能收纳好多东西,结实,实用,方便,厚度和 颜色都是我想要的,最重要的是高度刚刚好" 29 | ], 30 | "mid": [ 31 | "收到货后我非常的开心,因为$的质量和品质真的非常的好!", 32 | "拆开包装后惊艳到我了,这就是我想要的$!", 33 | "快递超快!包装的很好!!很喜欢!!!", 34 | "包装的很精美!$的质量和品质非常不错!", 35 | "收到快递后迫不及待的拆了包装。$我真的是非常喜欢", 36 | "真是一次难忘的购物,这辈子没见过这么好用的东西!!", 37 | "收纳很漂亮很可爱,材质做工很好!无异味!大小尺寸齐全", 38 | "这个价位很满意了,拿回来一会儿就装好", 39 | "接头是那种很有韧性的胶、敲打的过程中不会裂开", 40 | "很有包容性、装好以后不会晃动、很稳,物流也快、五星好评" 41 | ], 42 | "end": [ 43 | "经过了这次愉快的购物,我决定如果下次我还要买$的话,我一定会再来这家店买的。", 44 | "不错不错!", 45 | "我会推荐想买$的朋友也来这家店里买", 46 | "真是一次愉快的购物!", 47 | "大大的好评!以后买$再来你们店!( ̄▽ ̄)", 48 | "大家可以买来试一试,真的是太爽了,一晚上都沉浸在爽之中", 49 | "这种物件,不但轻便,而且在自己拼装完成后有一种成就的喜悦,真是宿舍家居良品", 50 | "自己组装成功,跟价格相称,比较简易", 51 | "操作比较方便。到时候也好拆卸,没想到这么便宜竟然这么好。", 52 | "东西很不错,木头也不错。", 53 | "特别好,而且功能百搭。", 54 | "没有色差,大小合适,组装简单,质量很好" 55 | ] 56 | } 57 | return (random.choice(datas["start"]) + random.choice(datas["mid"]) + random.choice(datas["end"])).replace("$", name) 58 | 59 | 60 | def getOrderList(cookies, shop_name=''): 61 | url = 'https://wq.jd.com/bases/orderlist/list?order_type=8&start_page=1&page_size=100' 62 | headers = { 63 | "accept": "application/json", 64 | "accept-encoding": "gzip, deflate, br", 65 | "accept-language": "zh-CN,zh;q=0.9", 66 | "connection": "keep-alive", 67 | "content-type": "application/x-www-form-urlencoded", 68 | 'origin': 'https://comment.m.jd.com', 69 | "referer": "https://wqs.jd.com/order/orderlist_merge.shtml?jxsid=16355625882984298965&orderType=all&ptag=7155.1.11", 70 | 'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1' 71 | } 72 | result = {} 73 | for cookie in cookies: 74 | result[cookie] = [] 75 | headers['cookie'] = cookie 76 | req = requests.get(url, headers=headers).json() 77 | # print(req) 78 | if 'orderList' not in req: 79 | continue 80 | for order_list in req['orderList']: 81 | 82 | if shop_name in order_list['shopInfo']['shopName']: 83 | 84 | for j in order_list['buttonList']: 85 | if j['id'] == 'toComment': 86 | cname = j['name'] # 评价按钮名字 87 | if cname is None: 88 | continue 89 | 90 | oid = order_list['orderId'] 91 | shopId = order_list['shopInfo']['shopId'] 92 | for order_item in order_list['productList']: 93 | pid = order_item['skuId'] 94 | name = order_item['title'] 95 | result[cookie].append({ 96 | 'name': name, 97 | 'oid': oid, 98 | 'pid': pid, 99 | 'cname': cname, 100 | 'shopId': shopId, 101 | 'shopName': order_list['shopInfo']['shopName'], 102 | 'comment': generateComment(name) 103 | }) 104 | return result 105 | 106 | def commentOrders(comment_orders_dict, proxy_flag=False): 107 | url = "https://api.m.jd.com/api?appid=jd-cphdeveloper-m&functionId=sendEval&loginType=2&sceneval=2&g_login_type=1&g_ty=ajax&appCode=ms0ca95114" 108 | headers = { 109 | "accept": "application/json", 110 | "accept-encoding": "gzip, deflate, br", 111 | "accept-language": "zh-CN,zh;q=0.9", 112 | "connection": "keep-alive", 113 | "content-type": "application/x-www-form-urlencoded", 114 | 'origin': 'https://comment.m.jd.com', 115 | "referer": "https://comment.m.jd.com/", 116 | 'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1' 117 | } 118 | log_num = 0 119 | for value in comment_orders_dict.values(): 120 | log_num += len(value) 121 | logs = getLogs(num=log_num) 122 | log_num = 0 123 | order_id_set = set() 124 | for cookie, orders in comment_orders_dict.items(): 125 | headers['cookie'] = cookie 126 | for order in orders: 127 | body = { 128 | "productId": order['pid'], 129 | "orderId": order['oid'], 130 | "score": 5, 131 | "content": order['comment'], 132 | "commentTagStr": 1, 133 | "userclient": 29, 134 | "anonymous": 0, 135 | "syncsg": 0, 136 | "scence": 101100000 137 | } 138 | 139 | response = requests.post(url=url, headers=headers, data=generateBody(body, logs[log_num]), proxies=getProxies(proxy_flag)).json() 140 | 141 | if 'errMsg' in response and response['errMsg'] == 'success': 142 | printT(f"{getUserName(cookie)}: 评价成功!店铺:{order['shopName']}, 内容:{order['comment']}") 143 | else: 144 | printT(f"{getUserName(cookie)}: 评价失败!店铺:{order['shopName']}, 日志:{response}") 145 | 146 | if order['oid'] not in order_id_set: 147 | 148 | se_url = f'https://wq.jd.com/eval/SendDSR' 149 | se_data = { 150 | 'userclient': '29', 151 | 'orderId': order['oid'], 152 | 'otype': 5, 153 | 'DSR1': 5, 154 | 'DSR2': 5, 155 | 'DSR3': 5, 156 | 'DSR4': 5, 157 | 'g_login_type': '0', 158 | 'g_ty': 'ls' 159 | } 160 | se_req = requests.get(se_url, headers=headers, params=se_data, proxies=getProxies(proxy_flag)).json() 161 | if se_req['errMsg'] == 'success': 162 | order_id_set.add(order['oid']) 163 | printT(f"{getUserName(cookie)}: 评价服务成功!店铺:{order['shopName']}") 164 | else: 165 | printT(f"{getUserName(cookie)}: 评价服务失败!店铺:{order['shopName']}") 166 | 167 | log_num += 1 168 | time.sleep(random.randint(5, 10)) 169 | 170 | 171 | if __name__ == '__main__': 172 | 173 | args = parseArgs() 174 | 175 | ExchangeManagement(cookie_type=args.cookie_type if args.cookie_type != "None" else "mine") 176 | cookies = os.environ['JD_COOKIE'].split("&") 177 | os.environ['proxy_ip'] = args.proxy_ip if len(args.proxy_ip) else "127.0.0.1:7890" 178 | result = getOrderList(cookies, shop_name=args.shop_name) 179 | for key, value in result.items(): 180 | for item in value: 181 | print(getUserName(key), item) 182 | commentOrders(result, proxy_flag=args.proxy_flag if args.proxy_flag else False) 183 | -------------------------------------------------------------------------------- /py38/exchange_general_long_key.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python3 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称:exchange_general_long_key.py 5 | Author: Fisher 6 | 功能:适配定点抢长key类券,需在fisher_configure.json文件内创建对应对象并填写"discount"、“activityId”和"clock_list"参数;不需填写长key,会根据activityId和discount自动搜索 7 | Date: 2022-5-12 8 | cron: 0 59 9,13,19,23 * * * 9 | new Env("适配长key券"); 10 | ''' 11 | from exchange_lib import * 12 | 13 | if __name__ == "__main__": 14 | 15 | headers = { 16 | "Accept": "*/*", 17 | "Accept-Encoding": "gzip, deflate", 18 | "Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7", 19 | "Connection": "keep-alive", 20 | "Content-Type": "application/x-www-form-urlencoded", 21 | 'origin': 'https://pro.m.jd.com', 22 | "Referer": "https://prodev.m.jd.com/jdlite/active/3H885vA4sQj6ctYzzPVix4iiYN2P/index.html?sid=bf6ae253e73f472d5ec294810f46665w&un_area=7_502_35752_35860" 23 | } 24 | 25 | headers = { 26 | "Accept": "*/*", 27 | "Accept-Encoding": "gzip, deflate", 28 | "Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7", 29 | "Connection": "keep-alive", 30 | "Content-Type": "application/x-www-form-urlencoded", 31 | 'origin': 'https://pro.m.jd.com', 32 | "Referer": "https://prodev.m.jd.com/mall/active/3WWbQbmmcqceFHsJbat8Zv1GJaTG/index.html" 33 | } 34 | 35 | body_dict = { 36 | 'activityId': '4TFZNrP43yHwUV3QvJrEvcK53yjM', 37 | 'scene': '1', 38 | "args": "key=E5C4099AC12CA45D0E1392A0395132BB089A2C409B4CDA6B70FD5029A59C3E0B3C181682F3E1732FAC58DB24B9848D90_bingo,roleId=DFA527DAB656121EC55AAF58C1F10841784A28A4284BC0382CA98D709DCB6B71FC4A630392E6611D106F0995B2F5BE5A55014C97F678F311D1F5391B5C888BBE08FCC8F75C99007DAF32582F8576B48D1EE01B07D319ADEF923618980493E3176BD11D1CC689D361061FE59FCE4D3EB4322E0B215226E76B91C22862C087D3A5882D2C83A49CCACE72CB48AB8E518F834F41D4C17481F1F4CE80642B0D3A2B7C_bingo,strengthenKey=19F512DCD8EE34ABE9C4FB4A92C2F42A72D6B80C9B38F8FE98AE3D2BBDCD6808_bingo" 39 | # "args": "key=71A0B43A5801A76425DDBF4945A31FD0A482428781387C293E94FE5D03130B8290CB83F3DEC7A6BC983EBAD60BB41090_bingo,roleId=9BD67B901DB469651E99E6F7D3AD5D4C1AA34CF13B4798B7631A80C978D94B238519E7CFEACA3172B01DA4825405A9DF008A5736EE708F9F4CC1789FE2954CAB0263CD293EAF6D72A4391D16068BA147C40F89C0442154D15341E07CCEBBA886CAE551448E5C321B3502EFCEC85ABADD5B568D52236F53017161146D0CB29D26CD99AC01EED9FA85BCA728275411591E2941E0E19C557799258FB3E209E132D6_bingo,strengthenKey=19F512DCD8EE34ABE9C4FB4A92C2F42AE84B9E1109B76B738665CAD2CB9C6FC3_bingo" 40 | # "args": "key=3DDD4FEE153EDE4F35C6F88EE2E6B0E49BD9CE09F02D3C0AA15513971D7D389ED4783B3577241CE3AD9CF93B4916BF47_bingo,roleId=CBA252302CA43DD8492A5C2BB15E348D8DB7DBDFCD70E07A4B7351090783521AFE55E69D64CAE1EDBE989BACFC81D94CBB81AC1F577723DFF9EB26B402E07D8106A25909D15C0C2B436CFE2542B89FE27AF72604A4B815DC880C2C087938C579F2F2CD22FDC08402E7692AF5E3FFF0F25810D208F7217DF27A4AA244D3F75147B18AE19450BBDBC8E2CD3E613B25500A356AB6ADDF084C5A08C512A0F7B62435_bingo,strengthenKey=19F512DCD8EE34ABE9C4FB4A92C2F42ADA4942001794CD9B77862303197584D9_bingo" 41 | } 42 | url = 'https://api.m.jd.com/client.action?functionId=newBabelAwardCollection&client=wh5&clientVersion=1.0.0' 43 | 44 | args = parseArgs() 45 | 46 | if args.coupon_type == "11-10": 47 | body_dict["args"] = "key=A34B6A46F386EC70113B577994469C1B49D9B59EFF1FDECA912461CA55C67D1D24E41C2888131D20F7F344D85F818827_bingo,roleId=7B7EECE5B05B6737BA5C854DC24388B1ADE7E524DF1E4AD18D961FA660EE34357FC23002A660F27F3F6B88AC400804601D2B2CBED81FF4307C8711CFDD271B3AD8FAC5993180E24F47E96BFC553E852625B115C6DACA1DA819326786635BE1B606304759801B859BBB563EA50573A032D414FCF70559C38860E4176AD464BAF15A8B10CC96430795745A39240FDE5D058EB0A12BDC898EADF0967CBE44006DF0_bingo" 48 | elif args.coupon_type == "15-5": 49 | body_dict["args"] = "key=AF55BC22EF3EBC44F28919EE34B3835ABE5C573C117F01A6A3D8F8CF3C168A08138963DDFFE0C2AB8E9AF062CFAF191D_bingo,roleId=DFA527DAB656121EC55AAF58C1F10841B12A24EFFA45F776EF6BD09851D33D26BB067058CC0082933425C3E1E6DF953520E5E1F68BE7E6A21C5042664648B378401C1007A7FDF66AB9FE83FCA0A4748D1015514C5EEAD3C72332201BCF4D7BA267C52D74E04752DCF0B9F82FDF9A8DD6CB0F6E05C231D60CA2FEB273F40959F8F7A8BF660D80E1DC07697D25DC57FFA7AA63951EC6E7A51F8C49B3A049536FD5_bingo,strengthenKey=19F512DCD8EE34ABE9C4FB4A92C2F42AFCFDB2D343F06C660D24D9EA74C6869A_bingo" 50 | else: 51 | body_dict['args'] = "key=E5C4099AC12CA45D0E1392A0395132BB089A2C409B4CDA6B70FD5029A59C3E0B3C181682F3E1732FAC58DB24B9848D90_bingo,roleId=DFA527DAB656121EC55AAF58C1F10841784A28A4284BC0382CA98D709DCB6B71FC4A630392E6611D106F0995B2F5BE5A55014C97F678F311D1F5391B5C888BBE08FCC8F75C99007DAF32582F8576B48D1EE01B07D319ADEF923618980493E3176BD11D1CC689D361061FE59FCE4D3EB4322E0B215226E76B91C22862C087D3A5882D2C83A49CCACE72CB48AB8E518F834F41D4C17481F1F4CE80642B0D3A2B7C_bingo,strengthenKey=19F512DCD8EE34ABE9C4FB4A92C2F42A72D6B80C9B38F8FE98AE3D2BBDCD6808_bingo" 52 | 53 | 54 | ExchangeManagement( 55 | url=url, 56 | headers=headers, 57 | headers_user_agent_random_flag=True, 58 | user_agent="", 59 | body_dict=body_dict, 60 | activitiId_random_flag=False, 61 | batch_size=args.batch_size if args.batch_size > 0 else 30, 62 | other_batch_size=0, 63 | second_ahead=0, 64 | sleep_time=0, 65 | thread_number=args.thread_number if args.thread_number > 0 else 20, 66 | append_flag=False, 67 | log_flag=True, 68 | sign_flag=False, 69 | day_or_week='day', 70 | post_flag=True, 71 | proxy_flag=args.proxy_flag if args.proxy_flag else False, 72 | proxy_ip=args.proxy_ip if len(args.proxy_ip) else "", 73 | coupon_type=args.coupon_type if args.coupon_type != 'None' else '15-5', 74 | cookie_type=args.cookie_type if args.cookie_type != 'None' else 'mine_coupons') \ 75 | .executeInDesktop( 76 | debug_flag=args.debug_flag if args.debug_flag else False 77 | ) -------------------------------------------------------------------------------- /py38/exchange_general_short_key.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python3 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称:exchange_general_short_key.py 5 | Author: Fisher 6 | 功能:适配定点抢短key类券,需在fisher_configure.json文件内创建对应对象并填写"args"和"clock_list"参数 7 | Date: 2022-5-12 8 | cron: 0 59 9,13,19,23 * * * 9 | new Env("适配短key券"); 10 | ''' 11 | 12 | from exchange_lib import * 13 | 14 | import sys 15 | 16 | if __name__ == "__main__": 17 | 18 | headers = { 19 | "Accept": "*/*", 20 | "Accept-Encoding": "gzip, deflate", 21 | "Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7", 22 | "Connection": "keep-alive", 23 | "Content-Type": "application/x-www-form-urlencoded", 24 | 'origin': 'https://pro.m.jd.com', 25 | "Referer": "https://prodev.m.jd.com/jdlite/active/3H885vA4sQj6ctYzzPVix4iiYN2P/index.html?sid=bf6ae253e73f472d5ec294810f46665w&un_area=7_502_35752_35860", 26 | } 27 | 28 | body_dict = { 29 | # "activityId":"e9z6GPMVDF4fZ2X6NNwJfot4yxhS", 30 | "activityId": "6GPMX6Ne9zNt4yVDF4wJfofZ2xhS", 31 | "from":"H5node", 32 | "scene":"1", 33 | "args": "key=c1m3c0s0o6ae485e936c029467cb3391,roleId=83519576" 34 | } 35 | 36 | url = 'https://api.m.jd.com/client.action?functionId=lite_newBabelAwardCollection&client=wh5&clientVersion=1.0.0' 37 | 38 | args = parseArgs() 39 | 40 | ExchangeManagement( 41 | url=url, 42 | headers=headers, 43 | headers_user_agent_random_flag=True, 44 | user_agent="", 45 | body_dict=body_dict, 46 | activitiId_random_flag=False, 47 | discount="", 48 | batch_size=args.batch_size if args.batch_size > 0 else 10, 49 | other_batch_size=0, 50 | second_ahead=0, 51 | sleep_time=0.01, 52 | thread_number=args.thread_number if args.thread_number > 0 else 20, 53 | append_flag=False, 54 | log_flag=False, 55 | sign_flag=False, 56 | day_or_week='day', 57 | post_flag=True, 58 | proxy_flag=args.proxy_flag if args.proxy_flag else False, 59 | proxy_ip=args.proxy_ip if len(args.proxy_ip) else "", 60 | coupon_type=args.coupon_type if args.coupon_type != 'None' else 'general_coupons', 61 | cookie_type=args.cookie_type if args.cookie_type != 'None' else 'mine_coupons')\ 62 | .executeInDesktop( 63 | debug_flag=args.debug_flag if args.debug_flag else False, 64 | ) -------------------------------------------------------------------------------- /py38/exchange_plus.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python3 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称:exchange_plus.py 5 | Author: yangyang 6 | 功能: 7 | Date: 2022-5-12 8 | cron: 0 59 9,13,19,23 * * * 9 | new Env("plus权益-无验证券模板"); 10 | ''' 11 | 12 | from exchange_lib import * 13 | 14 | if __name__ == "__main__": 15 | 16 | headers = { 17 | "Host": "rsp.jd.com", 18 | "accept": "application/json, text/plain, */*", 19 | "user-agent": "jdapp;android;10.5.2;;;appBuild/96428;ef/1;ep/%7B%22hdid%22%3A%22JM9F1ywUPwflvMIpYPok0tt5k9kW4ArJEU3lfLhxBqw%3D%22%2C%22ts%22%3A1654535539316%2C%22ridx%22%3A-1%2C%22cipher%22%3A%7B%22sv%22%3A%22EG%3D%3D%22%2C%22ad%22%3A%22CzUmCzvsYzSnCtYzDNq0ZG%3D%3D%22%2C%22od%22%3A%22YtLwCzc0DQG3ZNOzEQS2Zq%3D%3D%22%2C%22ov%22%3A%22Ctq%3D%22%2C%22ud%22%3A%22ENY1DNGnCNC1DNC0EJY4BJHtDNvvC2Y1DNUzCm%3D%3D%22%7D%2C%22ciphertype%22%3A5%2C%22version%22%3A%221.2.0%22%2C%22appname%22%3A%22com.jingdong.app.mall%22%7D;jdSupportDarkMode/0;Mozilla/5.0 (Linux; Android 9; MI 6 Build/PKQ1.190118.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/89.0.4389.72 MQQBrowser/6.2 TBS/045946 Mobile Safari/537.36", 20 | "origin": "https://plus.m.jd.com", 21 | "x-requested-with": "com.jingdong.app.mall", 22 | "sec-fetch-site": "same-site", 23 | "sec-fetch-mode": "cors", 24 | "sec-fetch-dest": "empty", 25 | "referer": "https://plus.m.jd.com/", 26 | "accept-encoding": "gzip, deflate, br", 27 | "accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7" 28 | } 29 | # Coco 30 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=60946520270113&_={int(round(time.time()*1000))}' 31 | # 万达 32 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=60946520269991&_={int(round(time.time()*1000))}' 33 | # 肯德基 34 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=60947948441996&_={int(round(time.time()*1000))}' 35 | 36 | # 烧仙草 coco 37 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=71704511585025&_={int(round(time.time()*1000))}' 38 | 39 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=71704534652075&_={int(round(time.time() * 1000))}' 40 | 41 | 42 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=71705057879950&_={int(round(time.time() * 1000))}' 43 | 44 | # 体检 45 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=71705009647680&_={int(round(time.time() * 1000))}' 46 | 47 | # 烧仙草 48 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=71704988678033&_={int(round(time.time() * 1000))}' 49 | 50 | # 万达 51 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=71704447587533&_={int(round(time.time() * 1000))}' 52 | 53 | args = parseArgs() 54 | 55 | ExchangeManagement( 56 | url=url, 57 | headers=headers, 58 | headers_user_agent_random_flag=True, 59 | user_agent="", 60 | body_dict={}, 61 | batch_size=args.batch_size if args.batch_size > 0 else 12, 62 | other_batch_size=0, 63 | second_ahead=0, 64 | sleep_time=0, 65 | thread_number=args.thread_number if args.thread_number > 0 else 20, 66 | log_flag=False, 67 | sign_flag=False, 68 | day_or_week='day', 69 | post_flag=False, 70 | proxy_flag=args.proxy_flag if args.proxy_flag else True, 71 | print_type="cmd", 72 | coupon_type="plus_quanyi", 73 | cookie_type=args.cookie_type if args.cookie_type != "None" else "mine_coupons").\ 74 | executeInDesktop( 75 | clock_list=[0, 10], 76 | debug_flag=args.debug_flag if args.debug_flag else True) -------------------------------------------------------------------------------- /py38/exchange_test_delay.py: -------------------------------------------------------------------------------- 1 | from exchange_lib import * 2 | 3 | 4 | def testRequestDelayThread(url, headers, body_dict, proxy_flag, thread_id, res_dict={}, post_flag=True): 5 | printT("Calculating request delay test...") 6 | 7 | start_time = time.time() 8 | try: 9 | if post_flag: 10 | res = requests.post(url=url, verify=False, headers=headers, 11 | data=body_dict, proxies=getProxies(proxy_flag), timeout=3) 12 | else: 13 | res = requests.get(url=url, verify=False, headers=headers, 14 | data=body_dict, proxies=getProxies(proxy_flag), timeout=3) 15 | # res_dict[thread_id] = time.time() - start_time 16 | res_dict[thread_id] = res.elapsed.total_seconds() 17 | # print(res.headers) 18 | print(res_dict[thread_id], time.time() - start_time) 19 | d = datetime.datetime.fromtimestamp(int(res.headers['X-API-Request-Id'].split('-')[-1]) / 1000) 20 | str1 = d.strftime("%Y-%m-%d %H:%M:%S.%f") 21 | 22 | 23 | # print(time.time() - start_time, res_dict[thread_id]) 24 | # printT(f"Current IP address and Port: {res.raw._connection.sock.socket.getsockname()}") 25 | except Exception: 26 | return 27 | 28 | 29 | def testRequestDelay(url, headers, body_dict, sleep_time=0.03, proxy_flag=False, post_flag=True): 30 | printT("Calculating request delay...") 31 | headers = json.loads(json.dumps(headers)) 32 | if "Cookie" in headers: headers['Cookie'] = "" 33 | if "cookie" in headers: headers['cookie'] = "" 34 | thread_number, threads, res_dict = 30, [], {} 35 | for i in range(thread_number): 36 | threads.append(threading.Thread(target=testRequestDelayThread, 37 | args=(url, headers, body_dict, proxy_flag, i, res_dict, post_flag, ))) 38 | for i in range(thread_number): 39 | threads[i].start() 40 | time.sleep(sleep_time) 41 | for i in range(thread_number): 42 | threads[i].join() 43 | res = sorted(res_dict.values()) 44 | res_dict = collections.Counter([int(100*x+1)/100.0 for x in res]) 45 | 46 | # import matplotlib.pyplot as plt 47 | # 48 | # params = { 49 | # 'figure.figsize': '8, 4' 50 | # } 51 | # plt.rcParams.update(params) 52 | # plt.bar(res_dict.keys(), res_dict.values(), width=0.01) 53 | # plt.show() 54 | 55 | printT(res_dict) 56 | res = [x[0] for x in res_dict.most_common(3)] 57 | if len(res): 58 | result = min(res) + 0.02 59 | printT(f"Request delay: {result}s.") 60 | return result 61 | else: 62 | printT("Warning: The proxy is not available! Set the delay to 0.12ms.") 63 | return 0.12 64 | 65 | 66 | if __name__ == "__main__": 67 | 68 | headers = { 69 | "Accept": "*/*", 70 | "Accept-Encoding": "gzip, deflate", 71 | "Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7", 72 | "Connection": "keep-alive", 73 | "Content-Type": "application/x-www-form-urlencoded", 74 | 'origin': 'https://pro.m.jd.com', 75 | "Referer": "https://prodev.m.jd.com/jdlite/active/3H885vA4sQj6ctYzzPVix4iiYN2P/index.html?sid=bf6ae253e73f472d5ec294810f46665w&un_area=7_502_35752_35860" 76 | } 77 | body_dict = { 78 | 'activityId': '3H885vA4sQj6ctYzzPVix4iiYN2P', 79 | 'scene': '1', 80 | 'args': 'key=6E3ED4217CA5BA50CC868072587749279A819E91EC8217F49BC1DB9DC674DA27CF93291755C086262CF2BD2DADDD8138_bingo,roleId=A921D0996A757D3D319487D17C0F25FE0F6830D8485A69E35623B13BFBA59D1E7C2386D90F3D9D3A6D752ADCDEAB0529AA56BDE4467494DC5590AEB5C7C950D03EA337E197D9AF250FA7148376C8A9C2C3FC8B2D9632A67F79B5A98776BF5B6C94F3F3F8F3770E265EF7D6CAD2E5F1B98EE03623B492E1C2B96EBC7500E20DAB9C2BBC9CBBA7AA027CBB17434C77651F9DE32AEAE13EA4C6B7660D4FD53E63FF_bingo,strengthenKey=3FE987FADD098B5D46BA38B21875A5EBD8C02F19572CB3C5CC0385902CD416A2FE3B5DC71CEBCF672000554484FB93E5_bingo' 81 | } 82 | url = 'https://api.m.jd.com/client.action?functionId=lite_newBabelAwardCollection&client=wh5&clientVersion=1.0.0' 83 | 84 | args = parseArgs() 85 | 86 | requests.packages.urllib3.disable_warnings() 87 | 88 | os.environ["PROXY_IP"] = args.proxy_ip if len(args.proxy_ip) else 'http://127.0.0.1:7890' 89 | 90 | if args.proxy_flag: 91 | printT(f"The proxy ip is set to {os.environ['PROXY_IP']}") 92 | 93 | testRequestDelay(url, headers, body_dict, 94 | sleep_time=0, 95 | proxy_flag=args.proxy_flag if args.proxy_flag else False, 96 | post_flag=True) 97 | -------------------------------------------------------------------------------- /py38/exchange_xiaomi.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | from exchange_lib import * 4 | 5 | cookie = '' 6 | 7 | headers = { 8 | "Host": "m.mi.com", 9 | "accept": "application/json, text/plain, */*", 10 | "content-type": "application/x-www-form-urlencoded", 11 | "origin": "https://m.mi.com", 12 | "x-requested-with": "com.tencent.mm", 13 | "sec-fetch-site": "same-origin", 14 | "sec-fetch-mode": "cors", 15 | "sec-fetch-dest": "empty", 16 | "referer": "https://m.mi.com/w/mishop_activity?_rt=weex&pageid=861&sign=e86407ce821e68e65aec6c7cdbab9dad&pdl=jianyu&g_device_id=xmlitedevice_urrjpnxhe9rfj00h", 17 | "accept-encoding": "gzip, deflate", 18 | "accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7" 19 | # "cookie": ".thumbcache_2959214a7e70e5f2bd017e23a2a3e462=KifJ0TJXA5D66fNHvMYtIakmi27D8KNo8Q2jNvDBF+GbRYXw6CUX+jHYIh2x+Ja3GZP+2Nsv3GTABOXDsVs3pw%3D%3D" 20 | } 21 | 22 | url = "https://m.mi.com/v1/activity/page_draw_query" 23 | 24 | body_dict = "activity_codes=0Tg3B8vHw8Xcrs57JfEmeA==" 25 | 26 | args = parseArgs() 27 | 28 | ExchangeManagement( 29 | url=url, 30 | headers=headers, 31 | headers_user_agent_random_flag=False, 32 | user_agent="Mozilla/5.0 (Linux; Android 9; MI 6 Build/PKQ1.190118.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/86.0.4240.99 XWEB/3263 MMWEBSDK/20210902 Mobile Safari/537.36 MMWEBID/2219 MicroMessenger/8.0.15.2020(0x28000F3D) Process/appbrand0 WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 miniProgram", 33 | body_dict=body_dict, 34 | batch_size=args.batch_size if args.batch_size > 0 else 12, 35 | other_batch_size=0, 36 | second_ahead=0, 37 | sleep_time=0, 38 | thread_number=args.thread_number if args.thread_number > 0 else 40, 39 | append_flag=False, 40 | log_flag=False, 41 | sign_flag=False, 42 | day_or_week='day', 43 | post_flag=True, 44 | print_type="cmd", 45 | proxy_flag=args.proxy_flag if args.proxy_flag else True, 46 | coupon_type="xiaomi", 47 | cookie_type=args.cookie_type if args.cookie_type != 'None' else 'xiaomi') \ 48 | .executeInDesktop( 49 | clock_list=[10], 50 | debug_flag=args.debug_flag if args.debug_flag else False 51 | ) 52 | -------------------------------------------------------------------------------- /py38/pytransform/__init__.py: -------------------------------------------------------------------------------- 1 | # These module alos are used by protection code, so that protection 2 | # code needn't import anything 3 | import os 4 | import platform 5 | import sys 6 | import struct 7 | 8 | # Because ctypes is new from Python 2.5, so pytransform doesn't work 9 | # before Python 2.5 10 | # 11 | from ctypes import cdll, c_char, c_char_p, c_int, c_void_p, \ 12 | pythonapi, py_object, PYFUNCTYPE, CFUNCTYPE 13 | from fnmatch import fnmatch 14 | 15 | # 16 | # Support Platforms 17 | # 18 | plat_path = 'platforms' 19 | 20 | plat_table = ( 21 | ('windows', ('windows', 'cygwin-*')), 22 | ('darwin', ('darwin', 'ios')), 23 | ('linux', ('linux*',)), 24 | ('freebsd', ('freebsd*', 'openbsd*')), 25 | ('poky', ('poky',)), 26 | ) 27 | 28 | arch_table = ( 29 | ('x86', ('i?86', )), 30 | ('x86_64', ('x64', 'x86_64', 'amd64', 'intel')), 31 | ('arm', ('armv5',)), 32 | ('armv6', ('armv6l',)), 33 | ('armv7', ('armv7l',)), 34 | ('ppc64', ('ppc64le',)), 35 | ('mips32', ('mips',)), 36 | ('aarch32', ('aarch32',)), 37 | ('aarch64', ('aarch64', 'arm64')) 38 | ) 39 | 40 | # 41 | # Hardware type 42 | # 43 | HT_HARDDISK, HT_IFMAC, HT_IPV4, HT_IPV6, HT_DOMAIN = range(5) 44 | 45 | # 46 | # Global 47 | # 48 | _pytransform = None 49 | 50 | 51 | class PytransformError(Exception): 52 | pass 53 | 54 | 55 | def dllmethod(func): 56 | def wrap(*args, **kwargs): 57 | return func(*args, **kwargs) 58 | return wrap 59 | 60 | 61 | @dllmethod 62 | def version_info(): 63 | prototype = PYFUNCTYPE(py_object) 64 | dlfunc = prototype(('version_info', _pytransform)) 65 | return dlfunc() 66 | 67 | 68 | @dllmethod 69 | def init_pytransform(): 70 | major, minor = sys.version_info[0:2] 71 | # Python2.5 no sys.maxsize but sys.maxint 72 | # bitness = 64 if sys.maxsize > 2**32 else 32 73 | prototype = PYFUNCTYPE(c_int, c_int, c_int, c_void_p) 74 | init_module = prototype(('init_module', _pytransform)) 75 | ret = init_module(major, minor, pythonapi._handle) 76 | if (ret & 0xF000) == 0x1000: 77 | raise PytransformError('Initialize python wrapper failed (%d)' 78 | % (ret & 0xFFF)) 79 | return ret 80 | 81 | 82 | @dllmethod 83 | def init_runtime(): 84 | prototype = PYFUNCTYPE(c_int, c_int, c_int, c_int, c_int) 85 | _init_runtime = prototype(('init_runtime', _pytransform)) 86 | return _init_runtime(0, 0, 0, 0) 87 | 88 | 89 | @dllmethod 90 | def encrypt_code_object(pubkey, co, flags, suffix=''): 91 | _pytransform.set_option(6, suffix.encode()) 92 | prototype = PYFUNCTYPE(py_object, py_object, py_object, c_int) 93 | dlfunc = prototype(('encrypt_code_object', _pytransform)) 94 | return dlfunc(pubkey, co, flags) 95 | 96 | 97 | @dllmethod 98 | def generate_license_file(filename, priname, rcode, start=-1, count=1): 99 | prototype = PYFUNCTYPE(c_int, c_char_p, c_char_p, c_char_p, c_int, c_int) 100 | dlfunc = prototype(('generate_project_license_files', _pytransform)) 101 | return dlfunc(filename.encode(), priname.encode(), rcode.encode(), 102 | start, count) if sys.version_info[0] == 3 \ 103 | else dlfunc(filename, priname, rcode, start, count) 104 | 105 | 106 | @dllmethod 107 | def generate_license_key(prikey, keysize, rcode): 108 | prototype = PYFUNCTYPE(py_object, c_char_p, c_int, c_char_p) 109 | dlfunc = prototype(('generate_license_key', _pytransform)) 110 | return dlfunc(prikey, keysize, rcode) if sys.version_info[0] == 2 \ 111 | else dlfunc(prikey, keysize, rcode.encode()) 112 | 113 | 114 | @dllmethod 115 | def get_registration_code(): 116 | prototype = PYFUNCTYPE(py_object) 117 | dlfunc = prototype(('get_registration_code', _pytransform)) 118 | return dlfunc() 119 | 120 | 121 | @dllmethod 122 | def get_expired_days(): 123 | prototype = PYFUNCTYPE(py_object) 124 | dlfunc = prototype(('get_expired_days', _pytransform)) 125 | return dlfunc() 126 | 127 | 128 | @dllmethod 129 | def clean_obj(obj, kind): 130 | prototype = PYFUNCTYPE(c_int, py_object, c_int) 131 | dlfunc = prototype(('clean_obj', _pytransform)) 132 | return dlfunc(obj, kind) 133 | 134 | 135 | def clean_str(*args): 136 | tdict = { 137 | 'str': 0, 138 | 'bytearray': 1, 139 | 'unicode': 2 140 | } 141 | for obj in args: 142 | k = tdict.get(type(obj).__name__) 143 | if k is None: 144 | raise RuntimeError('Can not clean object: %s' % obj) 145 | clean_obj(obj, k) 146 | 147 | 148 | def get_hd_info(hdtype, size=256): 149 | if hdtype not in range(HT_DOMAIN + 1): 150 | raise RuntimeError('Invalid parameter hdtype: %s' % hdtype) 151 | t_buf = c_char * size 152 | buf = t_buf() 153 | if (_pytransform.get_hd_info(hdtype, buf, size) == -1): 154 | raise PytransformError('Get hardware information failed') 155 | return buf.value.decode() 156 | 157 | 158 | def show_hd_info(): 159 | return _pytransform.show_hd_info() 160 | 161 | 162 | def assert_armored(*names): 163 | prototype = PYFUNCTYPE(py_object, py_object) 164 | dlfunc = prototype(('assert_armored', _pytransform)) 165 | 166 | def wrapper(func): 167 | def wrap_execute(*args, **kwargs): 168 | dlfunc(names) 169 | return func(*args, **kwargs) 170 | return wrap_execute 171 | return wrapper 172 | 173 | 174 | def get_license_info(): 175 | info = { 176 | 'ISSUER': None, 177 | 'EXPIRED': None, 178 | 'HARDDISK': None, 179 | 'IFMAC': None, 180 | 'IFIPV4': None, 181 | 'DOMAIN': None, 182 | 'DATA': None, 183 | 'CODE': None, 184 | } 185 | rcode = get_registration_code().decode() 186 | if rcode.startswith('*VERSION:'): 187 | index = rcode.find('\n') 188 | info['ISSUER'] = rcode[9:index].split('.')[0].replace('-sn-1.txt', '') 189 | rcode = rcode[index+1:] 190 | 191 | index = 0 192 | if rcode.startswith('*TIME:'): 193 | from time import ctime 194 | index = rcode.find('\n') 195 | info['EXPIRED'] = ctime(float(rcode[6:index])) 196 | index += 1 197 | 198 | if rcode[index:].startswith('*FLAGS:'): 199 | index += len('*FLAGS:') + 1 200 | info['FLAGS'] = ord(rcode[index - 1]) 201 | 202 | prev = None 203 | start = index 204 | for k in ['HARDDISK', 'IFMAC', 'IFIPV4', 'DOMAIN', 'FIXKEY', 'CODE']: 205 | index = rcode.find('*%s:' % k) 206 | if index > -1: 207 | if prev is not None: 208 | info[prev] = rcode[start:index] 209 | prev = k 210 | start = index + len(k) + 2 211 | info['CODE'] = rcode[start:] 212 | i = info['CODE'].find(';') 213 | if i > 0: 214 | info['DATA'] = info['CODE'][i+1:] 215 | info['CODE'] = info['CODE'][:i] 216 | return info 217 | 218 | 219 | def get_license_code(): 220 | return get_license_info()['CODE'] 221 | 222 | 223 | def get_user_data(): 224 | return get_license_info()['DATA'] 225 | 226 | 227 | def _match_features(patterns, s): 228 | for pat in patterns: 229 | if fnmatch(s, pat): 230 | return True 231 | 232 | 233 | def _gnu_get_libc_version(): 234 | try: 235 | prototype = CFUNCTYPE(c_char_p) 236 | ver = prototype(('gnu_get_libc_version', cdll.LoadLibrary('')))() 237 | return ver.decode().split('.') 238 | except Exception: 239 | pass 240 | 241 | 242 | def format_platform(platid=None): 243 | if platid: 244 | return os.path.normpath(platid) 245 | 246 | plat = platform.system().lower() 247 | mach = platform.machine().lower() 248 | 249 | for alias, platlist in plat_table: 250 | if _match_features(platlist, plat): 251 | plat = alias 252 | break 253 | 254 | if plat == 'linux': 255 | cname, cver = platform.libc_ver() 256 | if cname == 'musl': 257 | plat = 'musl' 258 | elif cname == 'libc': 259 | plat = 'android' 260 | elif cname == 'glibc': 261 | v = _gnu_get_libc_version() 262 | if v and len(v) >= 2 and (int(v[0]) * 100 + int(v[1])) < 214: 263 | plat = 'centos6' 264 | 265 | for alias, archlist in arch_table: 266 | if _match_features(archlist, mach): 267 | mach = alias 268 | break 269 | 270 | if plat == 'windows' and mach == 'x86_64': 271 | bitness = struct.calcsize('P'.encode()) * 8 272 | if bitness == 32: 273 | mach = 'x86' 274 | 275 | return os.path.join(plat, mach) 276 | 277 | 278 | # Load _pytransform library 279 | def _load_library(path=None, is_runtime=0, platid=None, suffix=''): 280 | path = os.path.dirname(__file__) if path is None \ 281 | else os.path.normpath(path) 282 | 283 | plat = platform.system().lower() 284 | name = '_pytransform' + suffix 285 | if plat == 'linux': 286 | filename = os.path.abspath(os.path.join(path, name + '.so')) 287 | elif plat == 'darwin': 288 | filename = os.path.join(path, name + '.dylib') 289 | elif plat == 'windows': 290 | filename = os.path.join(path, name + '.dll') 291 | elif plat == 'freebsd': 292 | filename = os.path.join(path, name + '.so') 293 | else: 294 | raise PytransformError('Platform %s not supported' % plat) 295 | 296 | if platid is not None and os.path.isfile(platid): 297 | filename = platid 298 | elif platid is not None or not os.path.exists(filename) or not is_runtime: 299 | libpath = platid if platid is not None and os.path.isabs(platid) else \ 300 | os.path.join(path, plat_path, format_platform(platid)) 301 | filename = os.path.join(libpath, os.path.basename(filename)) 302 | 303 | if not os.path.exists(filename): 304 | raise PytransformError('Could not find "%s"' % filename) 305 | 306 | try: 307 | m = cdll.LoadLibrary(filename) 308 | except Exception as e: 309 | if sys.flags.debug: 310 | print('Load %s failed:\n%s' % (filename, e)) 311 | raise 312 | 313 | # Removed from v4.6.1 314 | # if plat == 'linux': 315 | # m.set_option(-1, find_library('c').encode()) 316 | 317 | if not os.path.abspath('.') == os.path.abspath(path): 318 | m.set_option(1, path.encode() if sys.version_info[0] == 3 else path) 319 | 320 | # Required from Python3.6 321 | m.set_option(2, sys.byteorder.encode()) 322 | 323 | if sys.flags.debug: 324 | m.set_option(3, c_char_p(1)) 325 | m.set_option(4, c_char_p(not is_runtime)) 326 | 327 | # Disable advanced mode if required 328 | # m.set_option(5, c_char_p(1)) 329 | 330 | # Set suffix for private package 331 | if suffix: 332 | m.set_option(6, suffix.encode()) 333 | 334 | return m 335 | 336 | 337 | def pyarmor_init(path=None, is_runtime=0, platid=None, suffix=''): 338 | global _pytransform 339 | _pytransform = _load_library(path, is_runtime, platid, suffix) 340 | return init_pytransform() 341 | 342 | 343 | def pyarmor_runtime(path=None, suffix=''): 344 | pyarmor_init(path, is_runtime=1, suffix=suffix) 345 | init_runtime() 346 | 347 | # ---------------------------------------------------------- 348 | # End of pytransform 349 | # ---------------------------------------------------------- 350 | 351 | # 352 | # Not available from v5.6 353 | # 354 | 355 | 356 | def generate_capsule(licfile): 357 | prikey, pubkey, prolic = _generate_project_capsule() 358 | capkey, newkey = _generate_pytransform_key(licfile, pubkey) 359 | return prikey, pubkey, capkey, newkey, prolic 360 | 361 | 362 | @dllmethod 363 | def _generate_project_capsule(): 364 | prototype = PYFUNCTYPE(py_object) 365 | dlfunc = prototype(('generate_project_capsule', _pytransform)) 366 | return dlfunc() 367 | 368 | 369 | @dllmethod 370 | def _generate_pytransform_key(licfile, pubkey): 371 | prototype = PYFUNCTYPE(py_object, c_char_p, py_object) 372 | dlfunc = prototype(('generate_pytransform_key', _pytransform)) 373 | return dlfunc(licfile.encode() if sys.version_info[0] == 3 else licfile, 374 | pubkey) 375 | 376 | 377 | # 378 | # Deprecated functions from v5.1 379 | # 380 | @dllmethod 381 | def encrypt_project_files(proname, filelist, mode=0): 382 | prototype = PYFUNCTYPE(c_int, c_char_p, py_object, c_int) 383 | dlfunc = prototype(('encrypt_project_files', _pytransform)) 384 | return dlfunc(proname.encode(), filelist, mode) 385 | 386 | 387 | def generate_project_capsule(licfile): 388 | prikey, pubkey, prolic = _generate_project_capsule() 389 | capkey = _encode_capsule_key_file(licfile) 390 | return prikey, pubkey, capkey, prolic 391 | 392 | 393 | @dllmethod 394 | def _encode_capsule_key_file(licfile): 395 | prototype = PYFUNCTYPE(py_object, c_char_p, c_char_p) 396 | dlfunc = prototype(('encode_capsule_key_file', _pytransform)) 397 | return dlfunc(licfile.encode(), None) 398 | 399 | 400 | @dllmethod 401 | def encrypt_files(key, filelist, mode=0): 402 | t_key = c_char * 32 403 | prototype = PYFUNCTYPE(c_int, t_key, py_object, c_int) 404 | dlfunc = prototype(('encrypt_files', _pytransform)) 405 | return dlfunc(t_key(*key), filelist, mode) 406 | 407 | 408 | @dllmethod 409 | def generate_module_key(pubname, key): 410 | t_key = c_char * 32 411 | prototype = PYFUNCTYPE(py_object, c_char_p, t_key, c_char_p) 412 | dlfunc = prototype(('generate_module_key', _pytransform)) 413 | return dlfunc(pubname.encode(), t_key(*key), None) 414 | 415 | # 416 | # Compatible for PyArmor v3.0 417 | # 418 | @dllmethod 419 | def old_init_runtime(systrace=0, sysprofile=1, threadtrace=0, threadprofile=1): 420 | '''Only for old version, before PyArmor 3''' 421 | pyarmor_init(is_runtime=1) 422 | prototype = PYFUNCTYPE(c_int, c_int, c_int, c_int, c_int) 423 | _init_runtime = prototype(('init_runtime', _pytransform)) 424 | return _init_runtime(systrace, sysprofile, threadtrace, threadprofile) 425 | 426 | 427 | @dllmethod 428 | def import_module(modname, filename): 429 | '''Only for old version, before PyArmor 3''' 430 | prototype = PYFUNCTYPE(py_object, c_char_p, c_char_p) 431 | _import_module = prototype(('import_module', _pytransform)) 432 | return _import_module(modname.encode(), filename.encode()) 433 | 434 | 435 | @dllmethod 436 | def exec_file(filename): 437 | '''Only for old version, before PyArmor 3''' 438 | prototype = PYFUNCTYPE(c_int, c_char_p) 439 | _exec_file = prototype(('exec_file', _pytransform)) 440 | return _exec_file(filename.encode()) 441 | -------------------------------------------------------------------------------- /py38/pytransform/platforms/darwin/x86_64/_pytransform.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BeHalcyon/fisher_script/dcf6f09fde8a442d90c39ac96fdbb1360fe0879a/py38/pytransform/platforms/darwin/x86_64/_pytransform.dylib -------------------------------------------------------------------------------- /py38/pytransform/platforms/linux/aarch64/_pytransform.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BeHalcyon/fisher_script/dcf6f09fde8a442d90c39ac96fdbb1360fe0879a/py38/pytransform/platforms/linux/aarch64/_pytransform.so -------------------------------------------------------------------------------- /py38/pytransform/platforms/linux/x86_64/_pytransform.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BeHalcyon/fisher_script/dcf6f09fde8a442d90c39ac96fdbb1360fe0879a/py38/pytransform/platforms/linux/x86_64/_pytransform.so -------------------------------------------------------------------------------- /py38/pytransform/platforms/windows/x86_64/_pytransform.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BeHalcyon/fisher_script/dcf6f09fde8a442d90c39ac96fdbb1360fe0879a/py38/pytransform/platforms/windows/x86_64/_pytransform.dll -------------------------------------------------------------------------------- /py39/exchange_59_20.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python3 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称: exchange_59_20_1.py 5 | Author: Fisher 6 | 功能: 7 | Date: 2022-5-12 8 | cron: 0 59 9,13,17,21,23 * * * 9 | ''' 10 | 11 | from exchange_lib import * 12 | 13 | if __name__ == "__main__": 14 | 15 | args = parseArgs() 16 | 17 | ExchangeManagement( 18 | url="", 19 | headers={}, 20 | headers_user_agent_random_flag=False, 21 | user_agent="okhttp/3.12.1;jdmall;android;version/11.0.2;build/97565;", 22 | body_dict={}, 23 | batch_size=args.batch_size if args.batch_size > 0 else 7, 24 | activitiId_random_flag=False, 25 | other_batch_size=0, 26 | # second_ahead=0.31, 27 | second_ahead=0, 28 | sleep_time=0, 29 | thread_number=args.thread_number if args.thread_number > 0 else 40, 30 | append_flag=False, 31 | log_flag=False, 32 | sign_flag=True, 33 | day_or_week='week', 34 | post_flag=True, 35 | proxy_flag=args.proxy_flag if args.proxy_flag else False, 36 | coupon_type="59-20_1", 37 | cookie_type=args.cookie_type if args.cookie_type != 'None' else 'ws_cookies') \ 38 | .executeInDesktop( 39 | clock_list=[0, 10, 14, 18, 22], 40 | debug_flag=args.debug_flag if args.debug_flag else False 41 | ) -------------------------------------------------------------------------------- /py39/exchange_9.9.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python3 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称:exchange_9.9.py 5 | Author: yangyang 6 | 功能: 7 | Date: 2022-5-7 8 | cron: 10 59 9,15 * * * 9 | new Env("券后9.9"); 10 | ''' 11 | from exchange_lib import * 12 | 13 | if __name__ == "__main__": 14 | url = "https://api.m.jd.com/client.action?functionId=centerReceiveCoupon&appid=XPMSGC2019&monitorSource=&client=m&eu=5616666313239356&fv=4683736316461646" 15 | headers = { 16 | "accept": "application/json, text/plain, */*", 17 | "accept-language": "en-US,en;q=0.9", 18 | "accept-encoding": "gzip, deflate, br", 19 | "content-type": "application/x-www-form-urlencoded", 20 | "origin": "https://h5.m.jd.com", 21 | "x-request-with": "com.jingdong.app.mall", 22 | "referer": "https://h5.m.jd.com/", 23 | "sec-fetch-dest": "empty", 24 | "sec-fetch-mode": "cors", 25 | "sec-fetch-site": "same-site" 26 | } 27 | # extend = "A0F322DB0C038E1603CAC2127B1D86BC0F09FFD58755FE96E1687E0350887FBA79997E8E037402B0F6EF97C2D50C376F1B80FD03148C5F7D1054DBAE7D8F6D995F271D3665A05F94AB2F5C83B6D04B1B80251EF1D2F4633121F074F21AB9B37948B88A080E5C2891179D54F7ABB3756673D538D9372A24D540DDFB6C7C4541793A8C1E67C32FD58559501873FAD35D3FAF0788F5881EF1D96C826EA822F393642E93EF2864D4897D9C3FD1FD190BDBDAB8B1A95438847E5310BAC4F859166A9DBAE68C094DD31B5C5003C4C44373373F" 28 | 29 | extend = "A0F322DB0C038E1603CAC2127B1D86BC0F09FFD58755FE96E1687E0350887FBA79997E8E037402B0F6EF97C2D50C376F1B80FD03148C5F7D1054DBAE7D8F6D995F271D3665A05F94AB2F5C83B6D04B1B80251EF1D2F4633121F074F21AB9B3795DEACE40B717C2B866502C1577E6DC65E9B3BA97EBD16C414EB97B9758C203763A8C1E67C32FD58559501873FAD35D3FAF0788F5881EF1D96C826EA822F393642E93EF2864D4897D9C3FD1FD190BDBDA0D3E790119A83BE78D78AB958319ABAABAE68C094DD31B5C5003C4C44373373F" 30 | body_dict = { 31 | "extend": extend, 32 | "rcType": "1", "source": "couponCenter_app", "random": "7172621", "couponSource": "1", 33 | "extraData": "{\"log\":\"1664262320487~1zcCSCr3sAvMDFHQ1hvTjAxMQ==.dnVuW3xxcWpWf3NzaxEUAHVgDAUOdzM/MHZvbkN7a3ImXTB2PSY=.e8166796~5,1~52A8C75FE07D55CA0A9C1BCBC761465F9927C7A4~1jjtok1~C~SBNBXhEDaWQVFEZbXhELbhFXCB8OARoEeh9mHUAfRxseG10DHwIEHwd4HwIKHggXBgIFH0cTGRFXDh8ODhoEeB8BCRkCHQkCCRVCEGgfEVZHXREDAwgVFEFGEQkTBAUFDQAPCwUDDAQDCQELAwwQFRtBV1ERCRNBR0dNRhsVFEVQUhELF1VVTUZNTUNTFx8RQVFdEQNpDRUDAAUfBR0EAh8IHgxkGhBfWRELBh8RWkEbAxRUUwUABQYGCl9XXQgCVldRVlACVQILBg8BAAFQVgIDUREfG1xJGwwQeVpdRE0TUlhAWlEABhcfEUUXCQIPBA0LAAAGAQMFDQQfG1hSGwwQGARQAQYGVl9QCgBVARhWUlcDAgEAV10BAQRUV1JVGFYBDwMNCQVXDQoBVFBVBwAHWg1TA1QDCgBXCgsMUA5cAFRRAQcTGRFVSVAbAxQQGRFdRxcJEX5dVl5aVxV6XVIbER8bXFhPFAgXCgsCBgMRFRBKWkQQD2gLAA0fAAABZBUUQFoRCWoXfnoZChsVFFNbV0FeXFcRFRAAGxoQBAIdAxsFERUQAAEFAQURHxMABQIPBA8PBQMGAQAIBgYFFAYPAQUFBgUAAAMHBQgEDQ8UHhcCEWwZEVpWUxsDFFRTVVVXU0dHGx4bWFwQDxFGExkRUFAQAxtBARsCHQEXHxFaVGZPFAgXAwITGRFRXRADG0RTW1dcXAgEAg4ADwsHEBkRXlsXCWgIHgkVBm8ZEVFdWlQRAxAIDwAGBwUBAw0EBQEERwh7UFlrZmNQW0VDf31zXWhtdUplYXJKdFUEBBhkY317Y1sKYG9na3xQA3dmYmBCY2ttUV54XGBkcXZocn5Eb3h6CANcZnViYWd3fW91QQFvfkJ6XH9mVEZ1cG9+ZkhWGHdLBQpyXmdxfnRzRGNgeAV7SUp1fWxjW1NlRGNzYFxwdmpoUHNnRHp9d2ZHcWBsYXFnbwR3dFJ0dmFZanxiZwd/SgRgfWBwfn9qf0d7WmZ4Y3BYCHNRbGBzcFBRemd6BHIBCX51Smd0f3MBV2BsZ2NwTmNdeHtGd39LdAZwb3NjeHELdntycl9weE5/Z3Bif3BnZkBwWUpPegNkVHxIWWJ9fGdfX0wCfHZaXg16d3wHdHtRZHBifnpyRH1sdENeUGpncmpwW1h7fWd3fWZzd2t/WWBJHQsLCwAABwVSTUkZAk1HTHtHYgJzdWJwDWZmaAd+emN8ZGsCBVd2X153flJ4VmJhZX5zAnpuZWtvd3VnYWRjQkt7b0psWHNebHBSWXRkcFFrentjc292ZnN3d2Z4cXh4B2ZzdlhkbVhianYJYHBhUmZgdndxUnxaWnNwXnh0ZlZkZnRsVm99dGN7dXV8cmBUXXt7UXx4SwJBAUFXRksQFRtbQVIRCRMXTg==~19cnnnp\",\"sceneid\":\"couponNinePointNineHome\"}"} 34 | 35 | # 感冒灵 36 | extend = "43637CD87226EA2E335863F219ABC3D7F6C12FFEF67B4A334C3FD21871640F7283AB3B66E44F81A17C1A6A624A9DA4801B80FD03148C5F7D1054DBAE7D8F6D995F271D3665A05F94AB2F5C83B6D04B1BE54C50985C41FD2D58DBA76F2CD6DB02AC56646B328B4C44646B973087A7213FF3A98E7DBB08CFBC1DFCF12089B6A3533A8C1E67C32FD58559501873FAD35D3FED6926BB1743834D4361F61A275BD74B2E93EF2864D4897D9C3FD1FD190BDBDA8FE0F737B1945FC4B1D71C3FE08EF38392E65B68F750B18F516AF30F55398C7150AC93F8FAD90D456227C60734534054" 37 | body_dict = { 38 | "extend": extend, 39 | "rcType":"1","source":"couponCenter_app","random":"2908621","couponSource":"1","extraData":"{\"log\":\"1664298182254~1KDw59zPMGzMDF3bE5FRTAxMQ==.Rlp4cXdOVH9zc0VVejsQGDV3HCk9VB8HO0ZAeGlwW10wdztGEjA=.59d6dec8~5,1~9F31050F51E8246CEDE624F5182C8C173B9BEB47~0rr2xke~C~SRZNWhACbG4fGkVbVBAOYhVWDRoFZRQHZBV2fgkbAxYHAwMURRcVEFAOGgRuGwViFHV+dh4FFwcCCBtHEWUdF15AWhsNAxQVQEAaCxcIBAINBQsABgUHDQYCDwoMDBUeGkBWVxoLF01GQE1DEBQVRFZZEw8bVFJNQ0ZMQlIRFBNFXVwWA2wGFAIBAxQHGQgDGAgbB2UbEVlSEw8IHhZaRBACFVVVDgIBCgcNX1JWCQNXUVpUVA5UBQsDBAABAFZdAAddEBgbWUIaDRF/UV9AQRJVWEVRUAEHERQTQRsIBQ8BBgoOCwIAAwcMBhgbXVkaDREeD1IFCgdRX1UBAVQAHl1QUw8DBgBSVgAABVJcUFEUVwYPBgYIBFYLAQNQXFQAAAJRDFICUggIBFsLDAxVBV0BVVcKBRcVEFJJVRACFREfGl9DGwgWflhdX1tWE3FfVhcQGBtZU04VCREBCQYKAhYVFUFbRREJYwkEAR4HAARvFBVBXBoLbht/fRkPEBQVUl1cQ1pQVhYVFQsaGxECCR8HFwQWFRULAAQAAxodFwwEBQ8BBA4EAgAKAgwKBwIUAwQABAQADgIEDwYCCAEGDhUfEQkTaBUQXVZWEAIVVVVeV1NfRkAbGxBZXREJGkQXFRBXUBUIGkAAHQkfBRseFlpRbU4VCREIABcVEFZdFQgaRVJdXF5YBAANCQ8ECgYRHxpcXxsIbwgbAhQHbh8aU1lWVRYDFQMOAQcBAQkEDAEHDAVMCX5nAEsFf25LBmN6dnIDVl1ye2NDc010UA8FGWBmQHRTbmR2bWJGAG0DdXVgT1plYFIPRXFfRAN1WlZxeWZVYHF/YQplfUJ4X0tYc3VwT119YQwCe1F/BHR2Qn51cANRdHENdXN7XGt/TkBEcWUFCnh3fFZ3U25paQhwen9acWpyZktUfFRhZHhBa2N7QFlxcF0CUHRzWnR/VHp9fF1qfXZlf3V8XFJlcWwHR3dsCWBqS1t2cHNTfHIAT3N7aAIAfHBRWXFxVwF/UnBxZ1cDdmhAQFp9A2xdf3Z4c30IB2N+QWBWcnAMWmdKYWJnA1tGck5ZTnBvcwl6A0BScHF3f38JblliZHZrfWNwVGJ3DQFxT355d19wTXhgDXVxc3VxYmIAU3puf1Z8XHAMfVtLcX1mDUIaC1UEXFMLVghPTBUDSkdJcEZkW31/dGReYGJ/X3NucmFrb10NXWBYQWZ6CH1XZHpwUXwDYWt0cH5ja3UIZmQIXnVvdQNqZXZpXWlzb3pjCH5UbmJpdGB3e19lYk1WZG1yVWZ+SWxsZERsZVp9UnYCcWZ2a3BnfF8Ka2ACV05jZ3R4cV5yc31PA2RqSXR1d0NadnBPcmB7QHtnaEp9c3JFdVRycXlVcAhecHx2QWx1cnp7cF1wVHFVQ2t9UFhnbXB4X3N2AXN0UwMOTQhQX1pHWEEVHhpaQFQaCxcbTw==~0a6rhcq\",\"sceneid\":\"couponNinePointNineHome\"}"} 40 | 41 | args = parseArgs() 42 | 43 | ExchangeManagement( 44 | url=url, 45 | headers=headers, 46 | headers_user_agent_random_flag=False, 47 | user_agent="jdapp;android;10.5.2;;;appBuild/96428;ef/1;ep/%7B%22hdid%22%3A%22JM9F1ywUPwflvMIpYPok0tt5k9kW4ArJEU3lfLhxBqw%3D%22%2C%22ts%22%3A1655122900598%2C%22ridx%22%3A-1%2C%22cipher%22%3A%7B%22sv%22%3A%22EG%3D%3D%22%2C%22ad%22%3A%22EJvuZwZtYwYnCtqzDtrwDK%3D%3D%22%2C%22od%22%3A%22YtLwCzc0DQG3ZNOzEQS2Zq%3D%3D%22%2C%22ov%22%3A%22Ctq%3D%22%2C%22ud%22%3A%22EJvuZwZtYwYnCtqzDtrwDK%3D%3D%22%7D%2C%22ciphertype%22%3A5%2C%22version%22%3A%221.2.0%22%2C%22appname%22%3A%22com.jingdong.app.mall%22%7D;jdSupportDarkMode/0;Mozilla/5.0 (Linux; Android 9; MI 6 Build/PKQ1.190118.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/89.0.4389.72 MQQBrowser/6.2 TBS/046010 Mobile Safari/537.36", 48 | body_dict=body_dict, 49 | batch_size=args.batch_size if args.batch_size > 0 else 12, 50 | other_batch_size=0, 51 | second_ahead=0.16, 52 | sleep_time=0, 53 | thread_number=args.thread_number if args.thread_number > 0 else 35, 54 | append_flag=False, 55 | log_flag=False, 56 | sign_flag=False, 57 | day_or_week='day', 58 | post_flag=True, 59 | print_type="cmd", 60 | proxy_flag=args.proxy_flag if args.proxy_flag else False, 61 | coupon_type="9.9", 62 | cookie_type=args.cookie_type if args.cookie_type != 'None' else 'mine_coupons') \ 63 | .executeInDesktop( 64 | clock_list=[10], 65 | debug_flag=args.debug_flag if args.debug_flag else False 66 | ) 67 | -------------------------------------------------------------------------------- /py39/exchange_check_coupons.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称:exchange_check_coupons.py 5 | Author: yangyang 6 | 功能: 7 | Date: 2022-5-22 8 | cron: 0 23 14,20 * * * 9 | new Env("优惠券通知"); 10 | ''' 11 | from exchange_lib import * 12 | 13 | if __name__ == '__main__': 14 | 15 | args = parseArgs() 16 | 17 | ExchangeManagement(cookie_type=args.cookie_type if args.cookie_type != "None" else "mine") 18 | 19 | cookies = os.environ["JD_COOKIE"].split('&') if "JD_COOKIE" in os.environ else [] 20 | 21 | summary = "优惠券速览" 22 | content = "" 23 | for cookie in cookies: 24 | content += findCoupons(cookie) 25 | print(content) 26 | sendNotification(summary=summary, content=content) 27 | -------------------------------------------------------------------------------- /py39/exchange_check_redpacket.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称:exchange_check_coupons.py 5 | Author: yangyang 6 | 功能: 7 | Date: 2022-5-22 8 | cron: 0 23 14,20 * * * 9 | new Env("红包通知"); 10 | ''' 11 | from exchange_lib import * 12 | 13 | if __name__ == '__main__': 14 | 15 | args = parseArgs() 16 | 17 | ExchangeManagement(cookie_type=args.cookie_type if args.cookie_type != "None" else "mine") 18 | 19 | cookies = os.environ["JD_COOKIE"].split('&') if "JD_COOKIE" in os.environ else [] 20 | 21 | summary = "红包速览" 22 | content = "" 23 | for cookie in cookies: 24 | content += findRedPacket(cookie) 25 | print(content) 26 | sendNotification(summary=summary, content=content) 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /py39/exchange_evaluation.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | from exchange_lib import * 3 | try: 4 | import jieba.analyse 5 | except Exception: 6 | print("Error in importing jieba module, please run 'pip install jieba' in command line.") 7 | exit() 8 | 9 | jieba.setLogLevel(jieba.logging.INFO) 10 | 11 | def generateComment(pname): 12 | try: 13 | name = jieba.analyse.textrank(pname, topK=5, allowPOS='n')[0] 14 | except: 15 | name = "宝贝" 16 | 17 | datas = { 18 | "start": [ 19 | "考虑买这个$之前我是有担心过的,因为我不知道$的质量和品质怎么样,但是看了评论后我就放心了。", 20 | "买这个$之前我是有看过好几家店,最后看到这家店的评价不错就决定在这家店买 ", 21 | "看了好几家店,也对比了好几家店,最后发现还是这一家的$评价最好。", 22 | "看来看去最后还是选择了这家。", 23 | "之前在这家店也买过其他东西,感觉不错,这次又来啦。", 24 | "这家的$的真是太好用了,用了第一次就还想再用一次。", 25 | "其实一直都想入手一款$,但找不到合适的。", 26 | "做工看的出很优秀,手感也很好,和描述几乎一致。", 27 | "这个价格来说很具性价比,但是质量还是很不错的,装东西够用了,非常合适,质量也好," 28 | "没感觉到什么难闻的味,能收纳好多东西,结实,实用,方便,厚度和 颜色都是我想要的,最重要的是高度刚刚好" 29 | ], 30 | "mid": [ 31 | "收到货后我非常的开心,因为$的质量和品质真的非常的好!", 32 | "拆开包装后惊艳到我了,这就是我想要的$!", 33 | "快递超快!包装的很好!!很喜欢!!!", 34 | "包装的很精美!$的质量和品质非常不错!", 35 | "收到快递后迫不及待的拆了包装。$我真的是非常喜欢", 36 | "真是一次难忘的购物,这辈子没见过这么好用的东西!!", 37 | "收纳很漂亮很可爱,材质做工很好!无异味!大小尺寸齐全", 38 | "这个价位很满意了,拿回来一会儿就装好", 39 | "接头是那种很有韧性的胶、敲打的过程中不会裂开", 40 | "很有包容性、装好以后不会晃动、很稳,物流也快、五星好评" 41 | ], 42 | "end": [ 43 | "经过了这次愉快的购物,我决定如果下次我还要买$的话,我一定会再来这家店买的。", 44 | "不错不错!", 45 | "我会推荐想买$的朋友也来这家店里买", 46 | "真是一次愉快的购物!", 47 | "大大的好评!以后买$再来你们店!( ̄▽ ̄)", 48 | "大家可以买来试一试,真的是太爽了,一晚上都沉浸在爽之中", 49 | "这种物件,不但轻便,而且在自己拼装完成后有一种成就的喜悦,真是宿舍家居良品", 50 | "自己组装成功,跟价格相称,比较简易", 51 | "操作比较方便。到时候也好拆卸,没想到这么便宜竟然这么好。", 52 | "东西很不错,木头也不错。", 53 | "特别好,而且功能百搭。", 54 | "没有色差,大小合适,组装简单,质量很好" 55 | ] 56 | } 57 | return (random.choice(datas["start"]) + random.choice(datas["mid"]) + random.choice(datas["end"])).replace("$", name) 58 | 59 | 60 | def getOrderList(cookies, shop_name=''): 61 | url = 'https://wq.jd.com/bases/orderlist/list?order_type=8&start_page=1&page_size=100' 62 | headers = { 63 | "accept": "application/json", 64 | "accept-encoding": "gzip, deflate, br", 65 | "accept-language": "zh-CN,zh;q=0.9", 66 | "connection": "keep-alive", 67 | "content-type": "application/x-www-form-urlencoded", 68 | 'origin': 'https://comment.m.jd.com', 69 | "referer": "https://wqs.jd.com/order/orderlist_merge.shtml?jxsid=16355625882984298965&orderType=all&ptag=7155.1.11", 70 | 'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1' 71 | } 72 | result = {} 73 | for cookie in cookies: 74 | result[cookie] = [] 75 | headers['cookie'] = cookie 76 | req = requests.get(url, headers=headers).json() 77 | # print(req) 78 | if 'orderList' not in req: 79 | continue 80 | for order_list in req['orderList']: 81 | 82 | if shop_name in order_list['shopInfo']['shopName']: 83 | 84 | for j in order_list['buttonList']: 85 | if j['id'] == 'toComment': 86 | cname = j['name'] # 评价按钮名字 87 | if cname is None: 88 | continue 89 | 90 | oid = order_list['orderId'] 91 | shopId = order_list['shopInfo']['shopId'] 92 | for order_item in order_list['productList']: 93 | pid = order_item['skuId'] 94 | name = order_item['title'] 95 | result[cookie].append({ 96 | 'name': name, 97 | 'oid': oid, 98 | 'pid': pid, 99 | 'cname': cname, 100 | 'shopId': shopId, 101 | 'shopName': order_list['shopInfo']['shopName'], 102 | 'comment': generateComment(name) 103 | }) 104 | return result 105 | 106 | def commentOrders(comment_orders_dict, proxy_flag=False): 107 | url = "https://api.m.jd.com/api?appid=jd-cphdeveloper-m&functionId=sendEval&loginType=2&sceneval=2&g_login_type=1&g_ty=ajax&appCode=ms0ca95114" 108 | headers = { 109 | "accept": "application/json", 110 | "accept-encoding": "gzip, deflate, br", 111 | "accept-language": "zh-CN,zh;q=0.9", 112 | "connection": "keep-alive", 113 | "content-type": "application/x-www-form-urlencoded", 114 | 'origin': 'https://comment.m.jd.com', 115 | "referer": "https://comment.m.jd.com/", 116 | 'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1' 117 | } 118 | log_num = 0 119 | for value in comment_orders_dict.values(): 120 | log_num += len(value) 121 | logs = getLogs(num=log_num) 122 | log_num = 0 123 | order_id_set = set() 124 | for cookie, orders in comment_orders_dict.items(): 125 | headers['cookie'] = cookie 126 | for order in orders: 127 | body = { 128 | "productId": order['pid'], 129 | "orderId": order['oid'], 130 | "score": 5, 131 | "content": order['comment'], 132 | "commentTagStr": 1, 133 | "userclient": 29, 134 | "anonymous": 0, 135 | "syncsg": 0, 136 | "scence": 101100000 137 | } 138 | 139 | response = requests.post(url=url, headers=headers, data=generateBody(body, logs[log_num]), proxies=getProxies(proxy_flag)).json() 140 | 141 | if 'errMsg' in response and response['errMsg'] == 'success': 142 | printT(f"{getUserName(cookie)}: 评价成功!店铺:{order['shopName']}, 内容:{order['comment']}") 143 | else: 144 | printT(f"{getUserName(cookie)}: 评价失败!店铺:{order['shopName']}, 日志:{response}") 145 | 146 | if order['oid'] not in order_id_set: 147 | 148 | se_url = f'https://wq.jd.com/eval/SendDSR' 149 | se_data = { 150 | 'userclient': '29', 151 | 'orderId': order['oid'], 152 | 'otype': 5, 153 | 'DSR1': 5, 154 | 'DSR2': 5, 155 | 'DSR3': 5, 156 | 'DSR4': 5, 157 | 'g_login_type': '0', 158 | 'g_ty': 'ls' 159 | } 160 | se_req = requests.get(se_url, headers=headers, params=se_data, proxies=getProxies(proxy_flag)).json() 161 | if se_req['errMsg'] == 'success': 162 | order_id_set.add(order['oid']) 163 | printT(f"{getUserName(cookie)}: 评价服务成功!店铺:{order['shopName']}") 164 | else: 165 | printT(f"{getUserName(cookie)}: 评价服务失败!店铺:{order['shopName']}") 166 | 167 | log_num += 1 168 | time.sleep(random.randint(5, 10)) 169 | 170 | 171 | if __name__ == '__main__': 172 | 173 | args = parseArgs() 174 | 175 | ExchangeManagement(cookie_type=args.cookie_type if args.cookie_type != "None" else "mine") 176 | cookies = os.environ['JD_COOKIE'].split("&") 177 | os.environ['proxy_ip'] = args.proxy_ip if len(args.proxy_ip) else "127.0.0.1:7890" 178 | result = getOrderList(cookies, shop_name=args.shop_name) 179 | for key, value in result.items(): 180 | for item in value: 181 | print(getUserName(key), item) 182 | commentOrders(result, proxy_flag=args.proxy_flag if args.proxy_flag else False) 183 | -------------------------------------------------------------------------------- /py39/exchange_general_long_key.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python3 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称:exchange_general_long_key.py 5 | Author: Fisher 6 | 功能:适配定点抢长key类券,需在fisher_configure.json文件内创建对应对象并填写"discount"、“activityId”和"clock_list"参数;不需填写长key,会根据activityId和discount自动搜索 7 | Date: 2022-5-12 8 | cron: 0 59 9,13,19,23 * * * 9 | new Env("适配长key券"); 10 | ''' 11 | from exchange_lib import * 12 | 13 | if __name__ == "__main__": 14 | 15 | headers = { 16 | "Accept": "*/*", 17 | "Accept-Encoding": "gzip, deflate", 18 | "Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7", 19 | "Connection": "keep-alive", 20 | "Content-Type": "application/x-www-form-urlencoded", 21 | 'origin': 'https://pro.m.jd.com', 22 | "Referer": "https://prodev.m.jd.com/jdlite/active/3H885vA4sQj6ctYzzPVix4iiYN2P/index.html?sid=bf6ae253e73f472d5ec294810f46665w&un_area=7_502_35752_35860" 23 | } 24 | 25 | headers = { 26 | "Accept": "*/*", 27 | "Accept-Encoding": "gzip, deflate", 28 | "Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7", 29 | "Connection": "keep-alive", 30 | "Content-Type": "application/x-www-form-urlencoded", 31 | 'origin': 'https://pro.m.jd.com', 32 | "Referer": "https://prodev.m.jd.com/mall/active/3WWbQbmmcqceFHsJbat8Zv1GJaTG/index.html" 33 | } 34 | 35 | body_dict = { 36 | 'activityId': '4TFZNrP43yHwUV3QvJrEvcK53yjM', 37 | 'scene': '1', 38 | "args": "key=E5C4099AC12CA45D0E1392A0395132BB089A2C409B4CDA6B70FD5029A59C3E0B3C181682F3E1732FAC58DB24B9848D90_bingo,roleId=DFA527DAB656121EC55AAF58C1F10841784A28A4284BC0382CA98D709DCB6B71FC4A630392E6611D106F0995B2F5BE5A55014C97F678F311D1F5391B5C888BBE08FCC8F75C99007DAF32582F8576B48D1EE01B07D319ADEF923618980493E3176BD11D1CC689D361061FE59FCE4D3EB4322E0B215226E76B91C22862C087D3A5882D2C83A49CCACE72CB48AB8E518F834F41D4C17481F1F4CE80642B0D3A2B7C_bingo,strengthenKey=19F512DCD8EE34ABE9C4FB4A92C2F42A72D6B80C9B38F8FE98AE3D2BBDCD6808_bingo" 39 | # "args": "key=71A0B43A5801A76425DDBF4945A31FD0A482428781387C293E94FE5D03130B8290CB83F3DEC7A6BC983EBAD60BB41090_bingo,roleId=9BD67B901DB469651E99E6F7D3AD5D4C1AA34CF13B4798B7631A80C978D94B238519E7CFEACA3172B01DA4825405A9DF008A5736EE708F9F4CC1789FE2954CAB0263CD293EAF6D72A4391D16068BA147C40F89C0442154D15341E07CCEBBA886CAE551448E5C321B3502EFCEC85ABADD5B568D52236F53017161146D0CB29D26CD99AC01EED9FA85BCA728275411591E2941E0E19C557799258FB3E209E132D6_bingo,strengthenKey=19F512DCD8EE34ABE9C4FB4A92C2F42AE84B9E1109B76B738665CAD2CB9C6FC3_bingo" 40 | # "args": "key=3DDD4FEE153EDE4F35C6F88EE2E6B0E49BD9CE09F02D3C0AA15513971D7D389ED4783B3577241CE3AD9CF93B4916BF47_bingo,roleId=CBA252302CA43DD8492A5C2BB15E348D8DB7DBDFCD70E07A4B7351090783521AFE55E69D64CAE1EDBE989BACFC81D94CBB81AC1F577723DFF9EB26B402E07D8106A25909D15C0C2B436CFE2542B89FE27AF72604A4B815DC880C2C087938C579F2F2CD22FDC08402E7692AF5E3FFF0F25810D208F7217DF27A4AA244D3F75147B18AE19450BBDBC8E2CD3E613B25500A356AB6ADDF084C5A08C512A0F7B62435_bingo,strengthenKey=19F512DCD8EE34ABE9C4FB4A92C2F42ADA4942001794CD9B77862303197584D9_bingo" 41 | } 42 | url = 'https://api.m.jd.com/client.action?functionId=newBabelAwardCollection&client=wh5&clientVersion=1.0.0' 43 | 44 | args = parseArgs() 45 | 46 | if args.coupon_type == "11-10": 47 | body_dict["args"] = "key=A34B6A46F386EC70113B577994469C1B49D9B59EFF1FDECA912461CA55C67D1D24E41C2888131D20F7F344D85F818827_bingo,roleId=7B7EECE5B05B6737BA5C854DC24388B1ADE7E524DF1E4AD18D961FA660EE34357FC23002A660F27F3F6B88AC400804601D2B2CBED81FF4307C8711CFDD271B3AD8FAC5993180E24F47E96BFC553E852625B115C6DACA1DA819326786635BE1B606304759801B859BBB563EA50573A032D414FCF70559C38860E4176AD464BAF15A8B10CC96430795745A39240FDE5D058EB0A12BDC898EADF0967CBE44006DF0_bingo" 48 | elif args.coupon_type == "15-5": 49 | body_dict["args"] = "key=AF55BC22EF3EBC44F28919EE34B3835ABE5C573C117F01A6A3D8F8CF3C168A08138963DDFFE0C2AB8E9AF062CFAF191D_bingo,roleId=DFA527DAB656121EC55AAF58C1F10841B12A24EFFA45F776EF6BD09851D33D26BB067058CC0082933425C3E1E6DF953520E5E1F68BE7E6A21C5042664648B378401C1007A7FDF66AB9FE83FCA0A4748D1015514C5EEAD3C72332201BCF4D7BA267C52D74E04752DCF0B9F82FDF9A8DD6CB0F6E05C231D60CA2FEB273F40959F8F7A8BF660D80E1DC07697D25DC57FFA7AA63951EC6E7A51F8C49B3A049536FD5_bingo,strengthenKey=19F512DCD8EE34ABE9C4FB4A92C2F42AFCFDB2D343F06C660D24D9EA74C6869A_bingo" 50 | else: 51 | body_dict['args'] = "key=E5C4099AC12CA45D0E1392A0395132BB089A2C409B4CDA6B70FD5029A59C3E0B3C181682F3E1732FAC58DB24B9848D90_bingo,roleId=DFA527DAB656121EC55AAF58C1F10841784A28A4284BC0382CA98D709DCB6B71FC4A630392E6611D106F0995B2F5BE5A55014C97F678F311D1F5391B5C888BBE08FCC8F75C99007DAF32582F8576B48D1EE01B07D319ADEF923618980493E3176BD11D1CC689D361061FE59FCE4D3EB4322E0B215226E76B91C22862C087D3A5882D2C83A49CCACE72CB48AB8E518F834F41D4C17481F1F4CE80642B0D3A2B7C_bingo,strengthenKey=19F512DCD8EE34ABE9C4FB4A92C2F42A72D6B80C9B38F8FE98AE3D2BBDCD6808_bingo" 52 | 53 | 54 | ExchangeManagement( 55 | url=url, 56 | headers=headers, 57 | headers_user_agent_random_flag=True, 58 | user_agent="", 59 | body_dict=body_dict, 60 | activitiId_random_flag=False, 61 | batch_size=args.batch_size if args.batch_size > 0 else 30, 62 | other_batch_size=0, 63 | second_ahead=0, 64 | sleep_time=0, 65 | thread_number=args.thread_number if args.thread_number > 0 else 20, 66 | append_flag=False, 67 | log_flag=True, 68 | sign_flag=False, 69 | day_or_week='day', 70 | post_flag=True, 71 | proxy_flag=args.proxy_flag if args.proxy_flag else False, 72 | proxy_ip=args.proxy_ip if len(args.proxy_ip) else "", 73 | coupon_type=args.coupon_type if args.coupon_type != 'None' else '15-5', 74 | cookie_type=args.cookie_type if args.cookie_type != 'None' else 'mine_coupons') \ 75 | .executeInDesktop( 76 | debug_flag=args.debug_flag if args.debug_flag else False 77 | ) -------------------------------------------------------------------------------- /py39/exchange_general_short_key.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python3 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称:exchange_general_short_key.py 5 | Author: Fisher 6 | 功能:适配定点抢短key类券,需在fisher_configure.json文件内创建对应对象并填写"args"和"clock_list"参数 7 | Date: 2022-5-12 8 | cron: 0 59 9,13,19,23 * * * 9 | new Env("适配短key券"); 10 | ''' 11 | 12 | from exchange_lib import * 13 | 14 | import sys 15 | 16 | if __name__ == "__main__": 17 | 18 | headers = { 19 | "Accept": "*/*", 20 | "Accept-Encoding": "gzip, deflate", 21 | "Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7", 22 | "Connection": "keep-alive", 23 | "Content-Type": "application/x-www-form-urlencoded", 24 | 'origin': 'https://pro.m.jd.com', 25 | "Referer": "https://prodev.m.jd.com/jdlite/active/3H885vA4sQj6ctYzzPVix4iiYN2P/index.html?sid=bf6ae253e73f472d5ec294810f46665w&un_area=7_502_35752_35860", 26 | } 27 | 28 | body_dict = { 29 | # "activityId":"e9z6GPMVDF4fZ2X6NNwJfot4yxhS", 30 | "activityId": "6GPMX6Ne9zNt4yVDF4wJfofZ2xhS", 31 | "from":"H5node", 32 | "scene":"1", 33 | "args": "key=c1m3c0s0o6ae485e936c029467cb3391,roleId=83519576" 34 | } 35 | 36 | url = 'https://api.m.jd.com/client.action?functionId=lite_newBabelAwardCollection&client=wh5&clientVersion=1.0.0' 37 | 38 | args = parseArgs() 39 | 40 | ExchangeManagement( 41 | url=url, 42 | headers=headers, 43 | headers_user_agent_random_flag=True, 44 | user_agent="", 45 | body_dict=body_dict, 46 | activitiId_random_flag=False, 47 | discount="", 48 | batch_size=args.batch_size if args.batch_size > 0 else 10, 49 | other_batch_size=0, 50 | second_ahead=0, 51 | sleep_time=0.01, 52 | thread_number=args.thread_number if args.thread_number > 0 else 20, 53 | append_flag=False, 54 | log_flag=False, 55 | sign_flag=False, 56 | day_or_week='day', 57 | post_flag=True, 58 | proxy_flag=args.proxy_flag if args.proxy_flag else False, 59 | proxy_ip=args.proxy_ip if len(args.proxy_ip) else "", 60 | coupon_type=args.coupon_type if args.coupon_type != 'None' else 'general_coupons', 61 | cookie_type=args.cookie_type if args.cookie_type != 'None' else 'mine_coupons')\ 62 | .executeInDesktop( 63 | debug_flag=args.debug_flag if args.debug_flag else False, 64 | ) -------------------------------------------------------------------------------- /py39/exchange_plus.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python3 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称:exchange_plus.py 5 | Author: yangyang 6 | 功能: 7 | Date: 2022-5-12 8 | cron: 0 59 9,13,19,23 * * * 9 | new Env("plus权益-无验证券模板"); 10 | ''' 11 | 12 | from exchange_lib import * 13 | 14 | if __name__ == "__main__": 15 | 16 | headers = { 17 | "Host": "rsp.jd.com", 18 | "accept": "application/json, text/plain, */*", 19 | "user-agent": "jdapp;android;10.5.2;;;appBuild/96428;ef/1;ep/%7B%22hdid%22%3A%22JM9F1ywUPwflvMIpYPok0tt5k9kW4ArJEU3lfLhxBqw%3D%22%2C%22ts%22%3A1654535539316%2C%22ridx%22%3A-1%2C%22cipher%22%3A%7B%22sv%22%3A%22EG%3D%3D%22%2C%22ad%22%3A%22CzUmCzvsYzSnCtYzDNq0ZG%3D%3D%22%2C%22od%22%3A%22YtLwCzc0DQG3ZNOzEQS2Zq%3D%3D%22%2C%22ov%22%3A%22Ctq%3D%22%2C%22ud%22%3A%22ENY1DNGnCNC1DNC0EJY4BJHtDNvvC2Y1DNUzCm%3D%3D%22%7D%2C%22ciphertype%22%3A5%2C%22version%22%3A%221.2.0%22%2C%22appname%22%3A%22com.jingdong.app.mall%22%7D;jdSupportDarkMode/0;Mozilla/5.0 (Linux; Android 9; MI 6 Build/PKQ1.190118.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/89.0.4389.72 MQQBrowser/6.2 TBS/045946 Mobile Safari/537.36", 20 | "origin": "https://plus.m.jd.com", 21 | "x-requested-with": "com.jingdong.app.mall", 22 | "sec-fetch-site": "same-site", 23 | "sec-fetch-mode": "cors", 24 | "sec-fetch-dest": "empty", 25 | "referer": "https://plus.m.jd.com/", 26 | "accept-encoding": "gzip, deflate, br", 27 | "accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7" 28 | } 29 | # Coco 30 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=60946520270113&_={int(round(time.time()*1000))}' 31 | # 万达 32 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=60946520269991&_={int(round(time.time()*1000))}' 33 | # 肯德基 34 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=60947948441996&_={int(round(time.time()*1000))}' 35 | 36 | # 烧仙草 coco 37 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=71704511585025&_={int(round(time.time()*1000))}' 38 | 39 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=71704534652075&_={int(round(time.time() * 1000))}' 40 | 41 | 42 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=71705057879950&_={int(round(time.time() * 1000))}' 43 | 44 | # 体检 45 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=71705009647680&_={int(round(time.time() * 1000))}' 46 | 47 | # 烧仙草 48 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=71704988678033&_={int(round(time.time() * 1000))}' 49 | 50 | # 万达 51 | url = f'https://rsp.jd.com/resource/lifePrivilege/receive/v1?lt=m&an=plus.mobile&uniqueId=71704447587533&_={int(round(time.time() * 1000))}' 52 | 53 | args = parseArgs() 54 | 55 | ExchangeManagement( 56 | url=url, 57 | headers=headers, 58 | headers_user_agent_random_flag=True, 59 | user_agent="", 60 | body_dict={}, 61 | batch_size=args.batch_size if args.batch_size > 0 else 12, 62 | other_batch_size=0, 63 | second_ahead=0, 64 | sleep_time=0, 65 | thread_number=args.thread_number if args.thread_number > 0 else 20, 66 | log_flag=False, 67 | sign_flag=False, 68 | day_or_week='day', 69 | post_flag=False, 70 | proxy_flag=args.proxy_flag if args.proxy_flag else True, 71 | print_type="cmd", 72 | coupon_type="plus_quanyi", 73 | cookie_type=args.cookie_type if args.cookie_type != "None" else "mine_coupons").\ 74 | executeInDesktop( 75 | clock_list=[0, 10], 76 | debug_flag=args.debug_flag if args.debug_flag else True) -------------------------------------------------------------------------------- /py39/exchange_test_delay.py: -------------------------------------------------------------------------------- 1 | from exchange_lib import * 2 | 3 | 4 | def testRequestDelayThread(url, headers, body_dict, proxy_flag, thread_id, res_dict={}, post_flag=True): 5 | printT("Calculating request delay test...") 6 | 7 | start_time = time.time() 8 | try: 9 | if post_flag: 10 | res = requests.post(url=url, verify=False, headers=headers, 11 | data=body_dict, proxies=getProxies(proxy_flag), timeout=3) 12 | else: 13 | res = requests.get(url=url, verify=False, headers=headers, 14 | data=body_dict, proxies=getProxies(proxy_flag), timeout=3) 15 | # res_dict[thread_id] = time.time() - start_time 16 | res_dict[thread_id] = res.elapsed.total_seconds() 17 | # print(res.headers) 18 | print(res_dict[thread_id], time.time() - start_time) 19 | d = datetime.datetime.fromtimestamp(int(res.headers['X-API-Request-Id'].split('-')[-1]) / 1000) 20 | str1 = d.strftime("%Y-%m-%d %H:%M:%S.%f") 21 | 22 | 23 | # print(time.time() - start_time, res_dict[thread_id]) 24 | # printT(f"Current IP address and Port: {res.raw._connection.sock.socket.getsockname()}") 25 | except Exception: 26 | return 27 | 28 | 29 | def testRequestDelay(url, headers, body_dict, sleep_time=0.03, proxy_flag=False, post_flag=True): 30 | printT("Calculating request delay...") 31 | headers = json.loads(json.dumps(headers)) 32 | if "Cookie" in headers: headers['Cookie'] = "" 33 | if "cookie" in headers: headers['cookie'] = "" 34 | thread_number, threads, res_dict = 30, [], {} 35 | for i in range(thread_number): 36 | threads.append(threading.Thread(target=testRequestDelayThread, 37 | args=(url, headers, body_dict, proxy_flag, i, res_dict, post_flag, ))) 38 | for i in range(thread_number): 39 | threads[i].start() 40 | time.sleep(sleep_time) 41 | for i in range(thread_number): 42 | threads[i].join() 43 | res = sorted(res_dict.values()) 44 | res_dict = collections.Counter([int(100*x+1)/100.0 for x in res]) 45 | 46 | # import matplotlib.pyplot as plt 47 | # 48 | # params = { 49 | # 'figure.figsize': '8, 4' 50 | # } 51 | # plt.rcParams.update(params) 52 | # plt.bar(res_dict.keys(), res_dict.values(), width=0.01) 53 | # plt.show() 54 | 55 | printT(res_dict) 56 | res = [x[0] for x in res_dict.most_common(3)] 57 | if len(res): 58 | result = min(res) + 0.02 59 | printT(f"Request delay: {result}s.") 60 | return result 61 | else: 62 | printT("Warning: The proxy is not available! Set the delay to 0.12ms.") 63 | return 0.12 64 | 65 | 66 | if __name__ == "__main__": 67 | 68 | headers = { 69 | "Accept": "*/*", 70 | "Accept-Encoding": "gzip, deflate", 71 | "Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7", 72 | "Connection": "keep-alive", 73 | "Content-Type": "application/x-www-form-urlencoded", 74 | 'origin': 'https://pro.m.jd.com', 75 | "Referer": "https://prodev.m.jd.com/jdlite/active/3H885vA4sQj6ctYzzPVix4iiYN2P/index.html?sid=bf6ae253e73f472d5ec294810f46665w&un_area=7_502_35752_35860" 76 | } 77 | body_dict = { 78 | 'activityId': '3H885vA4sQj6ctYzzPVix4iiYN2P', 79 | 'scene': '1', 80 | 'args': 'key=6E3ED4217CA5BA50CC868072587749279A819E91EC8217F49BC1DB9DC674DA27CF93291755C086262CF2BD2DADDD8138_bingo,roleId=A921D0996A757D3D319487D17C0F25FE0F6830D8485A69E35623B13BFBA59D1E7C2386D90F3D9D3A6D752ADCDEAB0529AA56BDE4467494DC5590AEB5C7C950D03EA337E197D9AF250FA7148376C8A9C2C3FC8B2D9632A67F79B5A98776BF5B6C94F3F3F8F3770E265EF7D6CAD2E5F1B98EE03623B492E1C2B96EBC7500E20DAB9C2BBC9CBBA7AA027CBB17434C77651F9DE32AEAE13EA4C6B7660D4FD53E63FF_bingo,strengthenKey=3FE987FADD098B5D46BA38B21875A5EBD8C02F19572CB3C5CC0385902CD416A2FE3B5DC71CEBCF672000554484FB93E5_bingo' 81 | } 82 | url = 'https://api.m.jd.com/client.action?functionId=lite_newBabelAwardCollection&client=wh5&clientVersion=1.0.0' 83 | 84 | args = parseArgs() 85 | 86 | requests.packages.urllib3.disable_warnings() 87 | 88 | os.environ["PROXY_IP"] = args.proxy_ip if len(args.proxy_ip) else 'http://127.0.0.1:7890' 89 | 90 | if args.proxy_flag: 91 | printT(f"The proxy ip is set to {os.environ['PROXY_IP']}") 92 | 93 | testRequestDelay(url, headers, body_dict, 94 | sleep_time=0, 95 | proxy_flag=args.proxy_flag if args.proxy_flag else False, 96 | post_flag=True) 97 | -------------------------------------------------------------------------------- /py39/exchange_xiaomi.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | from exchange_lib import * 4 | 5 | cookie = '' 6 | 7 | headers = { 8 | "Host": "m.mi.com", 9 | "accept": "application/json, text/plain, */*", 10 | "content-type": "application/x-www-form-urlencoded", 11 | "origin": "https://m.mi.com", 12 | "x-requested-with": "com.tencent.mm", 13 | "sec-fetch-site": "same-origin", 14 | "sec-fetch-mode": "cors", 15 | "sec-fetch-dest": "empty", 16 | "referer": "https://m.mi.com/w/mishop_activity?_rt=weex&pageid=861&sign=e86407ce821e68e65aec6c7cdbab9dad&pdl=jianyu&g_device_id=xmlitedevice_urrjpnxhe9rfj00h", 17 | "accept-encoding": "gzip, deflate", 18 | "accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7" 19 | # "cookie": ".thumbcache_2959214a7e70e5f2bd017e23a2a3e462=KifJ0TJXA5D66fNHvMYtIakmi27D8KNo8Q2jNvDBF+GbRYXw6CUX+jHYIh2x+Ja3GZP+2Nsv3GTABOXDsVs3pw%3D%3D" 20 | } 21 | 22 | url = "https://m.mi.com/v1/activity/page_draw_query" 23 | 24 | body_dict = "activity_codes=0Tg3B8vHw8Xcrs57JfEmeA==" 25 | 26 | args = parseArgs() 27 | 28 | ExchangeManagement( 29 | url=url, 30 | headers=headers, 31 | headers_user_agent_random_flag=False, 32 | user_agent="Mozilla/5.0 (Linux; Android 9; MI 6 Build/PKQ1.190118.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/86.0.4240.99 XWEB/3263 MMWEBSDK/20210902 Mobile Safari/537.36 MMWEBID/2219 MicroMessenger/8.0.15.2020(0x28000F3D) Process/appbrand0 WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 miniProgram", 33 | body_dict=body_dict, 34 | batch_size=args.batch_size if args.batch_size > 0 else 12, 35 | other_batch_size=0, 36 | second_ahead=0, 37 | sleep_time=0, 38 | thread_number=args.thread_number if args.thread_number > 0 else 40, 39 | append_flag=False, 40 | log_flag=False, 41 | sign_flag=False, 42 | day_or_week='day', 43 | post_flag=True, 44 | print_type="cmd", 45 | proxy_flag=args.proxy_flag if args.proxy_flag else True, 46 | coupon_type="xiaomi", 47 | cookie_type=args.cookie_type if args.cookie_type != 'None' else 'xiaomi') \ 48 | .executeInDesktop( 49 | clock_list=[10], 50 | debug_flag=args.debug_flag if args.debug_flag else False 51 | ) 52 | -------------------------------------------------------------------------------- /py39/pytransform/__init__.py: -------------------------------------------------------------------------------- 1 | # These module alos are used by protection code, so that protection 2 | # code needn't import anything 3 | import os 4 | import platform 5 | import sys 6 | import struct 7 | 8 | # Because ctypes is new from Python 2.5, so pytransform doesn't work 9 | # before Python 2.5 10 | # 11 | from ctypes import cdll, c_char, c_char_p, c_int, c_void_p, \ 12 | pythonapi, py_object, PYFUNCTYPE, CFUNCTYPE 13 | from fnmatch import fnmatch 14 | 15 | # 16 | # Support Platforms 17 | # 18 | plat_path = 'platforms' 19 | 20 | plat_table = ( 21 | ('windows', ('windows', 'cygwin-*')), 22 | ('darwin', ('darwin', 'ios')), 23 | ('linux', ('linux*',)), 24 | ('freebsd', ('freebsd*', 'openbsd*')), 25 | ('poky', ('poky',)), 26 | ) 27 | 28 | arch_table = ( 29 | ('x86', ('i?86', )), 30 | ('x86_64', ('x64', 'x86_64', 'amd64', 'intel')), 31 | ('arm', ('armv5',)), 32 | ('armv6', ('armv6l',)), 33 | ('armv7', ('armv7l',)), 34 | ('ppc64', ('ppc64le',)), 35 | ('mips32', ('mips',)), 36 | ('aarch32', ('aarch32',)), 37 | ('aarch64', ('aarch64', 'arm64')) 38 | ) 39 | 40 | # 41 | # Hardware type 42 | # 43 | HT_HARDDISK, HT_IFMAC, HT_IPV4, HT_IPV6, HT_DOMAIN = range(5) 44 | 45 | # 46 | # Global 47 | # 48 | _pytransform = None 49 | 50 | 51 | class PytransformError(Exception): 52 | pass 53 | 54 | 55 | def dllmethod(func): 56 | def wrap(*args, **kwargs): 57 | return func(*args, **kwargs) 58 | return wrap 59 | 60 | 61 | @dllmethod 62 | def version_info(): 63 | prototype = PYFUNCTYPE(py_object) 64 | dlfunc = prototype(('version_info', _pytransform)) 65 | return dlfunc() 66 | 67 | 68 | @dllmethod 69 | def init_pytransform(): 70 | major, minor = sys.version_info[0:2] 71 | # Python2.5 no sys.maxsize but sys.maxint 72 | # bitness = 64 if sys.maxsize > 2**32 else 32 73 | prototype = PYFUNCTYPE(c_int, c_int, c_int, c_void_p) 74 | init_module = prototype(('init_module', _pytransform)) 75 | ret = init_module(major, minor, pythonapi._handle) 76 | if (ret & 0xF000) == 0x1000: 77 | raise PytransformError('Initialize python wrapper failed (%d)' 78 | % (ret & 0xFFF)) 79 | return ret 80 | 81 | 82 | @dllmethod 83 | def init_runtime(): 84 | prototype = PYFUNCTYPE(c_int, c_int, c_int, c_int, c_int) 85 | _init_runtime = prototype(('init_runtime', _pytransform)) 86 | return _init_runtime(0, 0, 0, 0) 87 | 88 | 89 | @dllmethod 90 | def encrypt_code_object(pubkey, co, flags, suffix=''): 91 | _pytransform.set_option(6, suffix.encode()) 92 | prototype = PYFUNCTYPE(py_object, py_object, py_object, c_int) 93 | dlfunc = prototype(('encrypt_code_object', _pytransform)) 94 | return dlfunc(pubkey, co, flags) 95 | 96 | 97 | @dllmethod 98 | def generate_license_file(filename, priname, rcode, start=-1, count=1): 99 | prototype = PYFUNCTYPE(c_int, c_char_p, c_char_p, c_char_p, c_int, c_int) 100 | dlfunc = prototype(('generate_project_license_files', _pytransform)) 101 | return dlfunc(filename.encode(), priname.encode(), rcode.encode(), 102 | start, count) if sys.version_info[0] == 3 \ 103 | else dlfunc(filename, priname, rcode, start, count) 104 | 105 | 106 | @dllmethod 107 | def generate_license_key(prikey, keysize, rcode): 108 | prototype = PYFUNCTYPE(py_object, c_char_p, c_int, c_char_p) 109 | dlfunc = prototype(('generate_license_key', _pytransform)) 110 | return dlfunc(prikey, keysize, rcode) if sys.version_info[0] == 2 \ 111 | else dlfunc(prikey, keysize, rcode.encode()) 112 | 113 | 114 | @dllmethod 115 | def get_registration_code(): 116 | prototype = PYFUNCTYPE(py_object) 117 | dlfunc = prototype(('get_registration_code', _pytransform)) 118 | return dlfunc() 119 | 120 | 121 | @dllmethod 122 | def get_expired_days(): 123 | prototype = PYFUNCTYPE(py_object) 124 | dlfunc = prototype(('get_expired_days', _pytransform)) 125 | return dlfunc() 126 | 127 | 128 | @dllmethod 129 | def clean_obj(obj, kind): 130 | prototype = PYFUNCTYPE(c_int, py_object, c_int) 131 | dlfunc = prototype(('clean_obj', _pytransform)) 132 | return dlfunc(obj, kind) 133 | 134 | 135 | def clean_str(*args): 136 | tdict = { 137 | 'str': 0, 138 | 'bytearray': 1, 139 | 'unicode': 2 140 | } 141 | for obj in args: 142 | k = tdict.get(type(obj).__name__) 143 | if k is None: 144 | raise RuntimeError('Can not clean object: %s' % obj) 145 | clean_obj(obj, k) 146 | 147 | 148 | def get_hd_info(hdtype, size=256): 149 | if hdtype not in range(HT_DOMAIN + 1): 150 | raise RuntimeError('Invalid parameter hdtype: %s' % hdtype) 151 | t_buf = c_char * size 152 | buf = t_buf() 153 | if (_pytransform.get_hd_info(hdtype, buf, size) == -1): 154 | raise PytransformError('Get hardware information failed') 155 | return buf.value.decode() 156 | 157 | 158 | def show_hd_info(): 159 | return _pytransform.show_hd_info() 160 | 161 | 162 | def assert_armored(*names): 163 | prototype = PYFUNCTYPE(py_object, py_object) 164 | dlfunc = prototype(('assert_armored', _pytransform)) 165 | 166 | def wrapper(func): 167 | def wrap_execute(*args, **kwargs): 168 | dlfunc(names) 169 | return func(*args, **kwargs) 170 | return wrap_execute 171 | return wrapper 172 | 173 | 174 | def get_license_info(): 175 | info = { 176 | 'ISSUER': None, 177 | 'EXPIRED': None, 178 | 'HARDDISK': None, 179 | 'IFMAC': None, 180 | 'IFIPV4': None, 181 | 'DOMAIN': None, 182 | 'DATA': None, 183 | 'CODE': None, 184 | } 185 | rcode = get_registration_code().decode() 186 | if rcode.startswith('*VERSION:'): 187 | index = rcode.find('\n') 188 | info['ISSUER'] = rcode[9:index].split('.')[0].replace('-sn-1.txt', '') 189 | rcode = rcode[index+1:] 190 | 191 | index = 0 192 | if rcode.startswith('*TIME:'): 193 | from time import ctime 194 | index = rcode.find('\n') 195 | info['EXPIRED'] = ctime(float(rcode[6:index])) 196 | index += 1 197 | 198 | if rcode[index:].startswith('*FLAGS:'): 199 | index += len('*FLAGS:') + 1 200 | info['FLAGS'] = ord(rcode[index - 1]) 201 | 202 | prev = None 203 | start = index 204 | for k in ['HARDDISK', 'IFMAC', 'IFIPV4', 'DOMAIN', 'FIXKEY', 'CODE']: 205 | index = rcode.find('*%s:' % k) 206 | if index > -1: 207 | if prev is not None: 208 | info[prev] = rcode[start:index] 209 | prev = k 210 | start = index + len(k) + 2 211 | info['CODE'] = rcode[start:] 212 | i = info['CODE'].find(';') 213 | if i > 0: 214 | info['DATA'] = info['CODE'][i+1:] 215 | info['CODE'] = info['CODE'][:i] 216 | return info 217 | 218 | 219 | def get_license_code(): 220 | return get_license_info()['CODE'] 221 | 222 | 223 | def get_user_data(): 224 | return get_license_info()['DATA'] 225 | 226 | 227 | def _match_features(patterns, s): 228 | for pat in patterns: 229 | if fnmatch(s, pat): 230 | return True 231 | 232 | 233 | def _gnu_get_libc_version(): 234 | try: 235 | prototype = CFUNCTYPE(c_char_p) 236 | ver = prototype(('gnu_get_libc_version', cdll.LoadLibrary('')))() 237 | return ver.decode().split('.') 238 | except Exception: 239 | pass 240 | 241 | 242 | def format_platform(platid=None): 243 | if platid: 244 | return os.path.normpath(platid) 245 | 246 | plat = platform.system().lower() 247 | mach = platform.machine().lower() 248 | 249 | for alias, platlist in plat_table: 250 | if _match_features(platlist, plat): 251 | plat = alias 252 | break 253 | 254 | if plat == 'linux': 255 | cname, cver = platform.libc_ver() 256 | if cname == 'musl': 257 | plat = 'musl' 258 | elif cname == 'libc': 259 | plat = 'android' 260 | elif cname == 'glibc': 261 | v = _gnu_get_libc_version() 262 | if v and len(v) >= 2 and (int(v[0]) * 100 + int(v[1])) < 214: 263 | plat = 'centos6' 264 | 265 | for alias, archlist in arch_table: 266 | if _match_features(archlist, mach): 267 | mach = alias 268 | break 269 | 270 | if plat == 'windows' and mach == 'x86_64': 271 | bitness = struct.calcsize('P'.encode()) * 8 272 | if bitness == 32: 273 | mach = 'x86' 274 | 275 | return os.path.join(plat, mach) 276 | 277 | 278 | # Load _pytransform library 279 | def _load_library(path=None, is_runtime=0, platid=None, suffix=''): 280 | path = os.path.dirname(__file__) if path is None \ 281 | else os.path.normpath(path) 282 | 283 | plat = platform.system().lower() 284 | name = '_pytransform' + suffix 285 | if plat == 'linux': 286 | filename = os.path.abspath(os.path.join(path, name + '.so')) 287 | elif plat == 'darwin': 288 | filename = os.path.join(path, name + '.dylib') 289 | elif plat == 'windows': 290 | filename = os.path.join(path, name + '.dll') 291 | elif plat == 'freebsd': 292 | filename = os.path.join(path, name + '.so') 293 | else: 294 | raise PytransformError('Platform %s not supported' % plat) 295 | 296 | if platid is not None and os.path.isfile(platid): 297 | filename = platid 298 | elif platid is not None or not os.path.exists(filename) or not is_runtime: 299 | libpath = platid if platid is not None and os.path.isabs(platid) else \ 300 | os.path.join(path, plat_path, format_platform(platid)) 301 | filename = os.path.join(libpath, os.path.basename(filename)) 302 | 303 | if not os.path.exists(filename): 304 | raise PytransformError('Could not find "%s"' % filename) 305 | 306 | try: 307 | m = cdll.LoadLibrary(filename) 308 | except Exception as e: 309 | if sys.flags.debug: 310 | print('Load %s failed:\n%s' % (filename, e)) 311 | raise 312 | 313 | # Removed from v4.6.1 314 | # if plat == 'linux': 315 | # m.set_option(-1, find_library('c').encode()) 316 | 317 | if not os.path.abspath('.') == os.path.abspath(path): 318 | m.set_option(1, path.encode() if sys.version_info[0] == 3 else path) 319 | 320 | # Required from Python3.6 321 | m.set_option(2, sys.byteorder.encode()) 322 | 323 | if sys.flags.debug: 324 | m.set_option(3, c_char_p(1)) 325 | m.set_option(4, c_char_p(not is_runtime)) 326 | 327 | # Disable advanced mode if required 328 | # m.set_option(5, c_char_p(1)) 329 | 330 | # Set suffix for private package 331 | if suffix: 332 | m.set_option(6, suffix.encode()) 333 | 334 | return m 335 | 336 | 337 | def pyarmor_init(path=None, is_runtime=0, platid=None, suffix=''): 338 | global _pytransform 339 | _pytransform = _load_library(path, is_runtime, platid, suffix) 340 | return init_pytransform() 341 | 342 | 343 | def pyarmor_runtime(path=None, suffix=''): 344 | pyarmor_init(path, is_runtime=1, suffix=suffix) 345 | init_runtime() 346 | 347 | # ---------------------------------------------------------- 348 | # End of pytransform 349 | # ---------------------------------------------------------- 350 | 351 | # 352 | # Not available from v5.6 353 | # 354 | 355 | 356 | def generate_capsule(licfile): 357 | prikey, pubkey, prolic = _generate_project_capsule() 358 | capkey, newkey = _generate_pytransform_key(licfile, pubkey) 359 | return prikey, pubkey, capkey, newkey, prolic 360 | 361 | 362 | @dllmethod 363 | def _generate_project_capsule(): 364 | prototype = PYFUNCTYPE(py_object) 365 | dlfunc = prototype(('generate_project_capsule', _pytransform)) 366 | return dlfunc() 367 | 368 | 369 | @dllmethod 370 | def _generate_pytransform_key(licfile, pubkey): 371 | prototype = PYFUNCTYPE(py_object, c_char_p, py_object) 372 | dlfunc = prototype(('generate_pytransform_key', _pytransform)) 373 | return dlfunc(licfile.encode() if sys.version_info[0] == 3 else licfile, 374 | pubkey) 375 | 376 | 377 | # 378 | # Deprecated functions from v5.1 379 | # 380 | @dllmethod 381 | def encrypt_project_files(proname, filelist, mode=0): 382 | prototype = PYFUNCTYPE(c_int, c_char_p, py_object, c_int) 383 | dlfunc = prototype(('encrypt_project_files', _pytransform)) 384 | return dlfunc(proname.encode(), filelist, mode) 385 | 386 | 387 | def generate_project_capsule(licfile): 388 | prikey, pubkey, prolic = _generate_project_capsule() 389 | capkey = _encode_capsule_key_file(licfile) 390 | return prikey, pubkey, capkey, prolic 391 | 392 | 393 | @dllmethod 394 | def _encode_capsule_key_file(licfile): 395 | prototype = PYFUNCTYPE(py_object, c_char_p, c_char_p) 396 | dlfunc = prototype(('encode_capsule_key_file', _pytransform)) 397 | return dlfunc(licfile.encode(), None) 398 | 399 | 400 | @dllmethod 401 | def encrypt_files(key, filelist, mode=0): 402 | t_key = c_char * 32 403 | prototype = PYFUNCTYPE(c_int, t_key, py_object, c_int) 404 | dlfunc = prototype(('encrypt_files', _pytransform)) 405 | return dlfunc(t_key(*key), filelist, mode) 406 | 407 | 408 | @dllmethod 409 | def generate_module_key(pubname, key): 410 | t_key = c_char * 32 411 | prototype = PYFUNCTYPE(py_object, c_char_p, t_key, c_char_p) 412 | dlfunc = prototype(('generate_module_key', _pytransform)) 413 | return dlfunc(pubname.encode(), t_key(*key), None) 414 | 415 | # 416 | # Compatible for PyArmor v3.0 417 | # 418 | @dllmethod 419 | def old_init_runtime(systrace=0, sysprofile=1, threadtrace=0, threadprofile=1): 420 | '''Only for old version, before PyArmor 3''' 421 | pyarmor_init(is_runtime=1) 422 | prototype = PYFUNCTYPE(c_int, c_int, c_int, c_int, c_int) 423 | _init_runtime = prototype(('init_runtime', _pytransform)) 424 | return _init_runtime(systrace, sysprofile, threadtrace, threadprofile) 425 | 426 | 427 | @dllmethod 428 | def import_module(modname, filename): 429 | '''Only for old version, before PyArmor 3''' 430 | prototype = PYFUNCTYPE(py_object, c_char_p, c_char_p) 431 | _import_module = prototype(('import_module', _pytransform)) 432 | return _import_module(modname.encode(), filename.encode()) 433 | 434 | 435 | @dllmethod 436 | def exec_file(filename): 437 | '''Only for old version, before PyArmor 3''' 438 | prototype = PYFUNCTYPE(c_int, c_char_p) 439 | _exec_file = prototype(('exec_file', _pytransform)) 440 | return _exec_file(filename.encode()) 441 | -------------------------------------------------------------------------------- /py39/pytransform/platforms/darwin/x86_64/_pytransform.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BeHalcyon/fisher_script/dcf6f09fde8a442d90c39ac96fdbb1360fe0879a/py39/pytransform/platforms/darwin/x86_64/_pytransform.dylib -------------------------------------------------------------------------------- /py39/pytransform/platforms/linux/aarch64/_pytransform.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BeHalcyon/fisher_script/dcf6f09fde8a442d90c39ac96fdbb1360fe0879a/py39/pytransform/platforms/linux/aarch64/_pytransform.so -------------------------------------------------------------------------------- /py39/pytransform/platforms/linux/x86_64/_pytransform.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BeHalcyon/fisher_script/dcf6f09fde8a442d90c39ac96fdbb1360fe0879a/py39/pytransform/platforms/linux/x86_64/_pytransform.so -------------------------------------------------------------------------------- /py39/pytransform/platforms/windows/x86_64/_pytransform.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BeHalcyon/fisher_script/dcf6f09fde8a442d90c39ac96fdbb1360fe0879a/py39/pytransform/platforms/windows/x86_64/_pytransform.dll --------------------------------------------------------------------------------