本周計劃完成任務

最后一周了,計劃完成全部任務,比如對協議的分析,對協議類型的展示

本周實際完成任務

實際完成:對握手協議的分析

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將字節數據轉化為字符串數據