第三周进展

发布时间 2023-12-10 18:13:25作者: ~$~

本周计划完成任务

最后一周了,计划完成全部任务,比如对协议的分析,对协议类型的展示

本周实际完成任务

实际完成:对握手协议的分析

local function dissectHandshake(buffer, pkt, tree)
    local handshakeType = buffer(5, 1):uint()

    pkt.cols.protocol:set("TLS-Handshake")
    if handshakeType == 0x01 then
        pkt.cols.info:set("Client Hello")
    elseif handshakeType == 0x02 then
        pkt.cols.info:set("Server Hello")
        local isCertificate = buffer(0x5c, 1):uint()
        if isCertificate == 0x0b then
            pkt.cols.info:append(" - Certificate")
        end

        -- 读取加密算法和临时密钥
        local cipherSuite = buffer(76, 2):uint()
        local keyExchange = buffer(15, 28):bytes()   -- 偏移调整
        local keyExchangeString = tostring(keyExchange)

        -- 打印加密算法和临时密钥到解析树中
        local treeItem = tree:add(my_protocol, buffer(), "Encryption Algorithm and Temporary Key")

        if cipherSuite == 0x003c then
            treeItem:add("RSA Authentication Algorithm:", "RSA Authentication Algorithm Used")
            treeItem:add("AES Encryption Algorithm:", "AES Encryption Algorithm Used")
            treeItem:add("SHA-256 Integrity Protection Algorithm:", "SHA-256 Integrity Protection Algorithm Used")
            treeItem:add("Key Exchange:", keyExchangeString)
        end
    elseif handshakeType == 0x10 then
        pkt.cols.info:set("Key Exchange")
        local isChangeCipherSpec = buffer(0x010b, 1):uint()
        if isChangeCipherSpec == 0x14 then
            pkt.cols.info:append(" - Change Cipher Spec")
        end
    end
end


未完成原因:对任务理解不到位,做了很多无用功。要加强提高自己的理解能力

本周遇到的问题

问题:从数据包中抓取不到大量的字节数据,抓取字节后,显示为乱码
解决:问gpt,抓取很多字节时,需要使用byte(),抓取之后,使用tostring将字节数据转化为字符串数据