得物小程序逆向+qt可视化(不含sku)

声明
本文章中所有内容仅供学习交流使用,不用于其他任何目的,抓包内容、敏感网址、数据接口等均已做脱敏处理,严禁用于商业用途和非法用途,否则由此产生的一切后果均与作者无关!wx a15018601872              
本文章未经许可禁止转载,禁止任何修改后二次传播,擅自使用本文讲解的技术而导致的任何意外,作者均不负责,若有侵权,请联系作者立即删除!q 2766958292

前言:

重新研究227几天,我发现淘系事件真的太恶心了。一直在调整事件执行顺序。最终把s89 s90 s46 s5给搞了。非淘不检测这几个。中途不知道触发了什么事件把s46加上去,s5没上去导致非淘都过不去。淘系我手动测了一下过了几次。轨迹太恶心了。还有那个ai轨迹研究不明白。怎么收集轨迹没搞懂,最后生成的文件轨迹更差了。有懂的告诉我一下,大家相互交流一下。

接着就是得物,太恶心了风控。我就失败了一次,直接被风控了。进都进不去。ck,st检测很严格。还有code,必须有生成auth token,没有资源跑不起来。我就随便测了几个风控不严格得接口。

1.逆向过程

data,sign就不说了。一个env aes 加密几天没看我也忘了为了交个课程结课作业完成了个大概就没管了。很容易就找到了,sign时md5。

2.收集指纹

为了增加代码行数,方便大作业演示直接全丢给内存跑就行了,丢给缓存吃力不讨好。直接用window环境就行了。

3.code授权

42开源了一个code frida自动授权的。有需要的自己去找我就当宣传一下了。

4.完整代码如下

from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
import numpy as np
from PyQt5.QtWebEngineWidgets import *
import os
import json
import random
import execjs
import requests
from openpyxl import Workbook
import pandas  as pd
from pyecharts.charts import Map,Page
from openpyxl.utils.dataframe import dataframe_to_rows


class Ui_MainWindow(QMainWindow):

    def __init__(self):
        super(QtWidgets.QMainWindow,self).__init__()
        self.pageNo=None
        self.setupUi(self)
        self.retranslateUi(self)


    def on_lineEdit_textChanged(self, text):
        try:
            # 这里处理输入框内容的变化
            self.pageNo=text
        except Exception as e:
            print("发生异常:", e)
            sys.exit(1)  # 或者其他错误处理方式

    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 600)

        self.centralWidget = QWidget(MainWindow)
        self.centralWidget.setObjectName("centralWidget")
        MainWindow.setCentralWidget(self.centralWidget)

        # 使用网格布局
        self.gridLayout = QGridLayout(self.centralWidget)

        # 创建输入框并添加到布局中
        self.lineEdit = QLineEdit()
        self.lineEdit.setPlaceholderText("输入爬取页数")
        # textChanged事件连接到相应的槽
        self.lineEdit.textChanged.connect(self.on_lineEdit_textChanged)
        self.gridLayout.addWidget(self.lineEdit, 1, 0, 1, 2)  # 行,列,行占比,列占比

        # 创建爬取数据按钮并添加到布局中
        self.pushButtonCrawl = QPushButton()
        self.pushButtonCrawl.setText("爬取数据")
        # clicked事件连接到相应的槽
        self.pushButtonCrawl.clicked.connect(self.spider)
        self.gridLayout.addWidget(self.pushButtonCrawl, 0, 0)

        # 创建打开列表按钮并添加到布局中
        self.pushButtonOpenList = QPushButton()
        self.pushButtonOpenList.setText("打开列表")
        # clicked事件分别连接到两个不同的槽
        self.pushButtonOpenList.clicked.connect(self.openfile)
        self.pushButtonOpenList.clicked.connect(self.creat_table_show)
        self.gridLayout.addWidget(self.pushButtonOpenList, 0, 1)

        # 创建表格控件并添加到布局中
        self.tableWidget = QTableWidget()
        self.tableWidget.setColumnCount(0)
        self.tableWidget.setRowCount(0)
        self.tableWidget.setStyleSheet("selection-background-color:pink")
        self.tableWidget.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.gridLayout.addWidget(self.tableWidget, 2, 0, 1, 2)  # 表格控件在第三行,横跨两列

    # 必要时添加所需的方法,如 on_lineEdit_textChanged, spider, openfile, creat_table_show


    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "窗口名字(自定义)"))


    def openfile(self):

        ###获取路径===================================================================

        openfile_name = QFileDialog.getOpenFileName(self,'选择文件','','Excel files(*.xlsx , *.xls)')

        #print(openfile_name)
        global path_openfile_name


        ###获取路径====================================================================

        path_openfile_name = openfile_name[0]


    def creat_table_show(self):
        ###===========读取表格,转换表格,===========================================
        if len(path_openfile_name) > 0:
            input_table = pd.read_excel(path_openfile_name)
            print(input_table)
        #print(input_table)
            input_table_rows = input_table.shape[0]
            input_table_colunms = input_table.shape[1]
        #print(input_table_rows)
        #print(input_table_colunms)
            input_table_header = input_table.columns.values.tolist()
        #print(input_table_header)

        ###===========读取表格,转换表格,============================================
        ###======================给tablewidget设置行列表头============================

            self.tableWidget.setColumnCount(input_table_colunms)
            self.tableWidget.setRowCount(input_table_rows)
            self.tableWidget.setHorizontalHeaderLabels( ['商品id', '封面路径', '标题', '价格', '开售时间', '属性id值', '价格类型', '商品类型',
                       '类别id',
                       '活动期间价格', '授权价格', '售卖数量', '产品单元id', '最优价格'])

        ###======================给tablewidget设置行列表头============================

        ###================遍历表格每个元素,同时添加到tablewidget中========================
            for i in range(input_table_rows):
                input_table_rows_values = input_table.iloc[[i]]
                #print(input_table_rows_values)
                input_table_rows_values_array = np.array(input_table_rows_values)
                input_table_rows_values_list = input_table_rows_values_array.tolist()[0]
            #print(input_table_rows_values_list)
                for j in range(input_table_colunms):
                    input_table_items_list = input_table_rows_values_list[j]
                #print(input_table_items_list)
                # print(type(input_table_items_list))

        ###==============将遍历的元素添加到tablewidget中并显示=======================

                    input_table_items = str(input_table_items_list)
                    newItem = QTableWidgetItem(input_table_items)
                    newItem.setTextAlignment(Qt.AlignHCenter|Qt.AlignVCenter)
                    self.tableWidget.setItem(i, j, newItem)

        ###================遍历表格每个元素,同时添加到tablewidget中========================
        else:
            self.centralWidget.show()

    def spider(self):
        # 创建一个工作簿
        print("开始爬取")
        tab_headers = ['商品id', '封面路径', '标题', '价格', '开售时间', '属性id值', '价格类型', '商品类型',
                       '类别id',
                       '活动期间价格', '授权价格', '售卖数量', '产品单元id', '最优价格']
        wb = Workbook()
        # 选择活动工作表
        ws = wb.active
        # ws.append(tab_headers)
        store_data = []
        for count in range(int(self.pageNo)):
            # 设置表头
            headers = {}
            envs = [放入自己的指纹]
            env = random.choice(envs)
            headers['User-Agent'] = env['dua']
            mode = env['dmo']  # 手机型号
            cp = execjs.compile(open('./得物.js', 'r', encoding='utf8').read())
            data = cp.call('getSk', env)['data']
            json_data = {
                'data': data,
            }
            response = requests.post('###/webSk', headers=headers, json=json_data)
            sk = response.text
            ltk = cp.call('getLtK', env, mode)
            headers['ltk'] = ltk
            headers['SK'] = sk
            # 第一次是21 然后变20
            # lastId '' 第二次开始 '1' '2'
            if count == 0:
                limit = 21
            else:
                limit = 20
            lastId = count+1
            json_data = cp.call('getSign', limit, lastId)
            response = requests.post('#/v1/h5/index/fire/index', headers=headers, json=json_data)
            hotList = json.loads(response.text)['data']['hotList']
            for hot in hotList:
                typeId = hot['typeId']
                if 'product' in hot:
                    sku = hot["product"]["spuId"]
                    logoUrl = hot["product"]["logoUrl"]
                    title = hot["product"]["title"]
                    price = hot["product"]["price"] / 100
                    if 'sellDate' in hot["product"]:
                        sellDate = hot["product"]["sellDate"]
                    else:
                        sellDate = '未知'
                    propertyValueId = hot["product"]["propertyValueId"]
                    priceType = hot["product"]["priceType"]
                    goodsType = hot["product"]["goodsType"]
                    categoryId = hot["product"]["categoryId"]
                    activityPrice = hot["product"]["activityPrice"] / 100
                    authPrice = hot["product"]["authPrice"] / 100
                    soldCountText = hot["product"]["soldCountText"]
                    cspuId = hot["product"]["cspuId"]
                    if "newOptimalPrice" in hot["product"]:
                        newOptimalPrice = hot["product"]["newOptimalPrice"] / 100
                    else:
                        newOptimalPrice = '未知'
                    store_data.append([sku, logoUrl, title, price, sellDate, propertyValueId, priceType, goodsType,
                                       categoryId, activityPrice, authPrice, soldCountText, cspuId, newOptimalPrice])
        df = pd.DataFrame(store_data, columns=tab_headers)

            # 现在,我们将 DataFrame 中的数据逐行追加到工作表中
        for row in dataframe_to_rows(df, index=False, header=False):
                print(row)
                if row:  # 这将跳过空行
                    ws.append(row)
            # 保存工作簿
        wb.save('./得物.xlsx')

        page = Page(layout=Page.DraggablePageLayout)
        # 先生成render.html文件
        page.render()

        print("爬取完成")
        QMessageBox.about(self, 'ok', '数据已爬取完成')


if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())

5.运行结果

有点垃圾将就着用了。

窗体展示
​​​

 

wx a15018601872   
q 2766958292
仅用于学习交流👉侵权+wx

  • 5
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值