diff --git a/scripts/packet-analysis/Manifest.toml b/scripts/packet-analysis/Manifest.toml index 0f21100..471967f 100644 --- a/scripts/packet-analysis/Manifest.toml +++ b/scripts/packet-analysis/Manifest.toml @@ -1,68 +1,51 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.10.0" +julia_version = "1.12.0" manifest_format = "2.0" -project_hash = "2d299f8e3abb5302e3c8ed5120acc4d9928016b1" +project_hash = "eb09ad96f566b90998c9665d6eb0aaba02e61d92" + +[[deps.AVCLANPipe]] +deps = ["Dates", "LibSerialPort", "PcapTools", "UnixTimes"] +path = "." +uuid = "bfacebfd-1bd5-49e7-81bd-5edd8f4074de" +version = "0.1.0" [[deps.ArgTools]] uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" -version = "1.1.1" +version = "1.1.2" [[deps.Artifacts]] uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" +version = "1.11.0" [[deps.Base64]] uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" - -[[deps.Compat]] -deps = ["UUIDs"] -git-tree-sha1 = "886826d76ea9e72b35fcd000e535588f7b60f21d" -uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" -version = "4.10.1" - - [deps.Compat.extensions] - CompatLinearAlgebraExt = "LinearAlgebra" - - [deps.Compat.weakdeps] - Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" - LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +version = "1.11.0" [[deps.Dates]] deps = ["Printf"] uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" +version = "1.11.0" [[deps.Downloads]] deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"] uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6" version = "1.6.0" -[[deps.ExprTools]] -git-tree-sha1 = "27415f162e6028e81c72b82ef756bf321213b6ec" -uuid = "e2ba6199-217a-4e67-a87a-7c52f15ade04" -version = "0.1.10" - [[deps.FileWatching]] uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" - -[[deps.InlineStrings]] -deps = ["Parsers"] -git-tree-sha1 = "9cc2baf75c6d09f9da536ddf58eb2f29dedaf461" -uuid = "842dd82b-1e85-43dc-bf29-5d0ee9dffc48" -version = "1.4.0" - -[[deps.InteractiveUtils]] -deps = ["Markdown"] -uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" +version = "1.11.0" [[deps.JLLWrappers]] deps = ["Artifacts", "Preferences"] -git-tree-sha1 = "7e5d6779a1e09a36db2a7b6cff50942a0a7d0fca" +git-tree-sha1 = "0533e564aae234aff59ab625543145446d8b6ec2" uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210" -version = "1.5.0" +version = "1.7.1" -[[deps.LazyArtifacts]] -deps = ["Artifacts", "Pkg"] -uuid = "4af54fe1-eca0-43a8-85a7-787d91b784e3" +[[deps.JuliaSyntaxHighlighting]] +deps = ["StyledStrings"] +uuid = "ac6e5ff7-fb65-4e79-a425-ec3bc9c03011" +version = "1.12.0" [[deps.LibCURL]] deps = ["LibCURL_jll", "MozillaCACerts_jll"] @@ -70,23 +53,24 @@ uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" version = "0.6.4" [[deps.LibCURL_jll]] -deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] +deps = ["Artifacts", "LibSSH2_jll", "Libdl", "OpenSSL_jll", "Zlib_jll", "nghttp2_jll"] uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" -version = "8.4.0+0" +version = "8.11.1+1" [[deps.LibGit2]] -deps = ["Base64", "LibGit2_jll", "NetworkOptions", "Printf", "SHA"] +deps = ["LibGit2_jll", "NetworkOptions", "Printf", "SHA"] uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" +version = "1.11.0" [[deps.LibGit2_jll]] -deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll"] +deps = ["Artifacts", "LibSSH2_jll", "Libdl", "OpenSSL_jll"] uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5" -version = "1.6.4+0" +version = "1.9.0+0" [[deps.LibSSH2_jll]] -deps = ["Artifacts", "Libdl", "MbedTLS_jll"] +deps = ["Artifacts", "Libdl", "OpenSSL_jll"] uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" -version = "1.11.0+1" +version = "1.11.3+1" [[deps.LibSerialPort]] deps = ["Libdl", "libserialport_jll"] @@ -96,41 +80,33 @@ version = "0.5.2" [[deps.Libdl]] uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" +version = "1.11.0" [[deps.Logging]] uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" +version = "1.11.0" [[deps.Markdown]] -deps = ["Base64"] +deps = ["Base64", "JuliaSyntaxHighlighting", "StyledStrings"] uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" - -[[deps.MbedTLS_jll]] -deps = ["Artifacts", "Libdl"] -uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" -version = "2.28.2+1" +version = "1.11.0" [[deps.Mmap]] uuid = "a63ad114-7e13-5084-954f-fe012c677804" - -[[deps.Mocking]] -deps = ["Compat", "ExprTools"] -git-tree-sha1 = "4cc0c5a83933648b615c36c2b956d94fda70641e" -uuid = "78c3b35d-d492-501b-9361-3d52fe80e533" -version = "0.7.7" +version = "1.11.0" [[deps.MozillaCACerts_jll]] uuid = "14a3606d-f60d-562e-9121-12d972cd8159" -version = "2023.1.10" +version = "2025.5.20" [[deps.NetworkOptions]] uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" -version = "1.2.0" +version = "1.3.0" -[[deps.Parsers]] -deps = ["Dates", "PrecompileTools", "UUIDs"] -git-tree-sha1 = "8489905bcdbcfac64d1daa51ca07c0d8f0283821" -uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" -version = "2.8.1" +[[deps.OpenSSL_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95" +version = "3.5.1+0" [[deps.PcapTools]] deps = ["Dates", "Mmap", "UnixTimes", "UnsafeArrays"] @@ -139,100 +115,85 @@ uuid = "222fe7e8-3f39-464a-bf97-d9bbb753f246" version = "1.1.1" [[deps.Pkg]] -deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] +deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "Random", "SHA", "TOML", "Tar", "UUIDs", "p7zip_jll"] uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" -version = "1.10.0" +version = "1.12.0" -[[deps.PrecompileTools]] -deps = ["Preferences"] -git-tree-sha1 = "03b4c25b43cb84cee5c90aa9b5ea0a78fd848d2f" -uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a" -version = "1.2.0" + [deps.Pkg.extensions] + REPLExt = "REPL" + + [deps.Pkg.weakdeps] + REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" [[deps.Preferences]] deps = ["TOML"] -git-tree-sha1 = "00805cd429dcb4870060ff49ef443486c262e38e" +git-tree-sha1 = "0f27480397253da18fe2c12a4ba4eb9eb208bf3d" uuid = "21216c6a-2e73-6563-6e65-726566657250" -version = "1.4.1" +version = "1.5.0" [[deps.Printf]] deps = ["Unicode"] uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" - -[[deps.REPL]] -deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] -uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" +version = "1.11.0" [[deps.Random]] deps = ["SHA"] uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" +version = "1.11.0" [[deps.SHA]] uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" version = "0.7.0" -[[deps.Scratch]] -deps = ["Dates"] -git-tree-sha1 = "3bac05bc7e74a75fd9cba4295cde4045d9fe2386" -uuid = "6c6a2e73-6563-6170-7368-637461726353" -version = "1.2.1" - -[[deps.Serialization]] -uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" - -[[deps.Sockets]] -uuid = "6462fe0b-24de-5631-8697-dd941f90decc" +[[deps.StyledStrings]] +uuid = "f489334b-da3d-4c2e-b8f0-e476e12c162b" +version = "1.11.0" [[deps.TOML]] deps = ["Dates"] uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" version = "1.0.3" -[[deps.TZJData]] -deps = ["Artifacts"] -git-tree-sha1 = "d39314cdbaf5b90a047db33858626f8d1cc973e1" -uuid = "dc5dba14-91b3-4cab-a142-028a31da12f7" -version = "1.0.0+2023c" - [[deps.Tar]] deps = ["ArgTools", "SHA"] uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" version = "1.10.0" -[[deps.TimeZones]] -deps = ["Artifacts", "Dates", "Downloads", "InlineStrings", "LazyArtifacts", "Mocking", "Printf", "Scratch", "TZJData", "Unicode", "p7zip_jll"] -git-tree-sha1 = "89e64d61ef3cd9e80f7fc12b7d13db2d75a23c03" -uuid = "f269a46b-ccf7-5d73-abea-4c690281aa53" -version = "1.13.0" - - [deps.TimeZones.extensions] - TimeZonesRecipesBaseExt = "RecipesBase" - - [deps.TimeZones.weakdeps] - RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" - [[deps.UUIDs]] deps = ["Random", "SHA"] uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" +version = "1.11.0" [[deps.Unicode]] uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" +version = "1.11.0" [[deps.UnixTimes]] -deps = ["Dates", "TimeZones"] -git-tree-sha1 = "406de9a6ee22f2030477ed7a50455aef3038bd4b" +deps = ["Dates"] +git-tree-sha1 = "1add5a01e8b2f45371d96583595ab2bf734a49e3" uuid = "ab1a18e7-b408-4913-896c-624bb82ed7f4" -version = "1.3.0" +version = "1.7.2" + + [deps.UnixTimes.extensions] + UnixTimesMakieExt = ["Makie", "Observables"] + UnixTimesStructTypesExt = "StructTypes" + UnixTimesTimeZonesExt = "TimeZones" + + [deps.UnixTimes.weakdeps] + Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" + Observables = "510215fc-4207-5dde-b226-833fc4488ee2" + StructTypes = "856f2bd8-1eba-4b0a-8007-ebc267875bd4" + TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53" [[deps.UnsafeArrays]] -git-tree-sha1 = "e7f1c67ba99ac6df440de191fa4d5cbfcbdddcd1" +git-tree-sha1 = "efcbb6828697ffffc245a9de7300552535abe005" uuid = "c4a57d5a-5b31-53a6-b365-19f8c011fbd6" -version = "1.0.5" +version = "1.0.8" [[deps.Zlib_jll]] deps = ["Libdl"] uuid = "83775a58-1f1d-513f-b197-d71354ab007a" -version = "1.2.13+1" +version = "1.3.1+2" [[deps.libserialport_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] @@ -243,9 +204,9 @@ version = "0.1.3+0" [[deps.nghttp2_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" -version = "1.52.0+1" +version = "1.64.0+1" [[deps.p7zip_jll]] deps = ["Artifacts", "Libdl"] uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0" -version = "17.4.0+2" +version = "17.5.0+2" diff --git a/scripts/packet-analysis/avclan_plugin.lua b/scripts/packet-analysis/avclan_plugin.lua index 35c4802..468010e 100644 --- a/scripts/packet-analysis/avclan_plugin.lua +++ b/scripts/packet-analysis/avclan_plugin.lua @@ -20,7 +20,7 @@ local iebusproto = Proto("iebus", "IEBus protocol") -local f_broadcast = ProtoField.bool("iebus.broadcast", "Broadcast", base.NONE, { [2] = "false", [1] = "true" }) +local f_broadcast = ProtoField.bool("iebus.broadcast", "Broadcast", base.NONE, { [1] = "false", [2] = "true" }) local f_controller_addr = ProtoField.uint16("iebus.controller", "Controller address", base.HEX, nil, 0x0FFF) local f_peripheral_addr = ProtoField.uint16("iebus.peripheral", "Peripheral address", base.HEX, nil, 0x0FFF) local f_control = ProtoField.uint8("iebus.control", "Control field", base.HEX) @@ -75,7 +75,7 @@ function iebusproto.dissector(buffer, pinfo, tree) local subtree = tree:add(iebusproto, buffer(), "IEBus frame") - subtree:add_le(f_broadcast, buffer(0,1)) + subtree:add(f_broadcast, buffer(0,1)) pinfo.cols.src = buffer(1,2):bytes():tohex():sub(2,-1) pinfo.cols.dst = buffer(3,2):bytes():tohex():sub(2,-1) diff --git a/scripts/packet-analysis/dev/PcapTools/src/buffer_reader.jl b/scripts/packet-analysis/dev/PcapTools/src/buffer_reader.jl index 25211f8..48fc737 100644 --- a/scripts/packet-analysis/dev/PcapTools/src/buffer_reader.jl +++ b/scripts/packet-analysis/dev/PcapTools/src/buffer_reader.jl @@ -43,7 +43,7 @@ function Base.close(x::PcapBufferReader) end Base.length(x::PcapBufferReader) = length(x.data) -Base.position(x::PcapBufferReader) = x.offset; nothing +Base.position(x::PcapBufferReader) = x.offset Base.seek(x::PcapBufferReader, pos) = x.offset = pos; nothing function Base.mark(x::PcapBufferReader) diff --git a/scripts/packet-analysis/src/AVCLANPipe.jl b/scripts/packet-analysis/src/AVCLANPipe.jl index dcabb95..5c2ea6b 100644 --- a/scripts/packet-analysis/src/AVCLANPipe.jl +++ b/scripts/packet-analysis/src/AVCLANPipe.jl @@ -18,6 +18,19 @@ AVCLANframe() = AVCLANframe(false, 0x0000, 0x0000, 0xf, 0x0, ntuple(x -> 0x0, 32 function Base.tryparse(::Type{AVCLANframe}, str::String) vals = split(str) + length(vals) < 6 && return nothing + + local t + try + t = Time(first(vals), "HH:MM:SS.s") + catch e + end + if !(@isdefined(t)) + t = nothing + else + popfirst!(vals) + end + broadcast = tryparse(Bool, vals[1]) isnothing(broadcast) && return nothing @@ -39,28 +52,37 @@ function Base.tryparse(::Type{AVCLANframe}, str::String) _data = tryparse.(UInt8, vals[6:end]) data = ntuple(i -> checkindex(Bool, axes(_data, 1), i) ? _data[i] : 0x0, 32) - return AVCLANframe(broadcast, controller_addr, peripheral_addr, control, len, data) + return t, AVCLANframe(broadcast, controller_addr, peripheral_addr, control, len, data) end function tobytes(frame::AVCLANframe) data = Vector{UInt8}(undef, 0) push!(data, frame.broadcast) append!(data, reverse(reinterpret(reshape, UInt8, [frame.controller_addr])), - reverse(reinterpret(reshape, UInt8, [frame.peripheral_addr])), - reinterpret(reshape, UInt8, [frame.control]), - reinterpret(reshape, UInt8, [frame.length]), - frame.data[1:frame.length]) + reverse(reinterpret(reshape, UInt8, [frame.peripheral_addr])), + reinterpret(reshape, UInt8, [frame.control]), + reinterpret(reshape, UInt8, [frame.length]), + frame.data[1:frame.length]) return data end function avclan_text_to_pcap(textlog::String, pcap_fn::String) - pcapstream = PcapStreamWriter(pcap_fn; snaplen=64, linktype = 162) + pcapstream = PcapStreamWriter(pcap_fn; snaplen=64, linktype=162) t = UnixTime(now()) for line in eachline(textlog) - frame = tryparse(AVCLANframe, line) - t += Microsecond(rand(1:15)) + tstamp_frame = tryparse(AVCLANframe, line) + if !isnothing(tstamp_frame) + tstamp, frame = tstamp_frame + else + continue + end + if !isnothing(tstamp) + t = UnixTime(DateTime(today(), tstamp)) + else + t += Microsecond(rand(1:15)) + end if !isnothing(frame) write(pcapstream, t, tobytes(frame)) end diff --git a/scripts/packet-analysis/src/pipepackets.jl b/scripts/packet-analysis/src/pipepackets.jl index 66c7d53..d76e6e3 100644 --- a/scripts/packet-analysis/src/pipepackets.jl +++ b/scripts/packet-analysis/src/pipepackets.jl @@ -2,7 +2,7 @@ include("AVCLANPipe.jl") using .AVCLANPipe, PcapTools, Dates, UnixTimes, LibSerialPort -serial_port="/dev/ttyUSB0" +serial_port="/dev/ttyUSB1" baud=1200000 pcapstream = PcapStreamWriter(stdout; snaplen=64, linktype=162)