此 Python 脚本使用由 Tshark 导出的值组成的文本文件。此导出列严格由每个 CANBUS 有效负载组成,它是 5 字节十六进制值。 (10 个字符)此程序将 CANBUS 十六进制值转换为 KPH 或 MPH。
这是我用来从 CanID589.pcap 中提取此信息的命令,该命令本身是从 Wireshark 导出的对 CANBUS ID 589(指速度)的剖析。还有 32 种其他不同类型的 CANBUS ID,但我们目前不需要关心这些值。
┌──(kali㉿Z3r0)-[/media/sf_Shared_Kali/NCL Doc/scanningrecon] └─$ tshark -r CanID589.pcap -T fields -e data.data > Data_speed.txt
(-r) 读取现有的 pcap 文件,而 (-T fields) 指示 Tshark 输出特定字段(而不是完整的数据包详细信息、摘要或原始数据)。这是一种自定义输出的方法,仅提取所需的信息,而不是转储所有数据包数据。 -e 选项用于指定要从数据包中提取哪些字段。在这种情况下,data.data表示每个数据包的数据字节。 “data.data”是指十六进制形式的 CANBUS 帧的实际内容(有效负载)。我必须尝试不同的值,直到将正确的数据导出到文本文件。
这里是与 CAN 协议相关的不同字段的列表。
- can.id:CAN 标识符字段(CAN ID)
- can.dlc:数据长度代码(存在多少数据字节)
- can.data:负载数据
- can.errorframe:CAN错误帧
- data.data:原始字节数据(这是该脚本使用的)
这也可以针对每个数据包单独完成,但我有 352 个不同的 Can.ID =“589”(速度)数据包来迭代
def format_hex_value(hex_value): # Tshark exported specific packets to column data.data unformatted. return ' '.join(hex_value[i:i+2] for i in range(0, len(hex_value), 2)) def calculate_speed_from_hex_value(hex_value): # 5 byte check if len(hex_value) <p>如果有人有任何问题、意见、补充或建设性批评,请随时与我联系。谢谢你</p>
以上是CAN总线速度转换器的详细内容。更多信息请关注PHP中文网其他相关文章!

Python是解释型语言,但也包含编译过程。1)Python代码先编译成字节码。2)字节码由Python虚拟机解释执行。3)这种混合机制使Python既灵活又高效,但执行速度不如完全编译型语言。

useeAforloopWheniteratingOveraseQuenceOrforAspecificnumberoftimes; useAwhiLeLoopWhenconTinuingUntilAcIntiment.ForloopSareIdeAlforkNownsences,而WhileLeleLeleLeleLoopSituationSituationSituationsItuationSuationSituationswithUndEtermentersitations。

pythonloopscanleadtoerrorslikeinfiniteloops,modifyingListsDuringteritation,逐个偏置,零indexingissues,andnestedloopineflinefficiencies

forloopsareadvantageousforknowniterations and sequests,供应模拟性和可读性;而LileLoopSareIdealFordyNamicConcitionSandunknowniterations,提供ControloperRoverTermination.1)forloopsareperfectForeTectForeTerToratingOrtratingRiteratingOrtratingRitterlistlistslists,callings conspass,calplace,cal,ofstrings ofstrings,orstrings,orstrings,orstrings ofcces

pythonisehybridmodelofcompilationand interpretation:1)thepythoninterspretercompilesourcececodeintoplatform- interpententbybytecode.2)thepytythonvirtualmachine(pvm)thenexecuteCutestestestesteSteSteSteSteSteSthisByTecode,BelancingEaseofuseWithPerformance。

pythonisbothinterpretedAndCompiled.1)它的compiledTobyTecodeForportabilityAcrosplatforms.2)bytecodeisthenInterpreted,允许fordingfordforderynamictynamictymictymictymictyandrapiddefupment,尽管Ititmaybeslowerthananeflowerthanancompiledcompiledlanguages。

在您的知识之际,而foroopsareideal insinAdvance中,而WhileLoopSareBetterForsituations则youneedtoloopuntilaconditionismet

ForboopSareSusedwhenthentheneMberofiterationsiskNownInAdvance,而WhileLoopSareSareDestrationsDepportonAcondition.1)ForloopSareIdealForiteratingOverSequencesLikelistSorarrays.2)whileLeleLooleSuitableApeableableableableableableforscenarioscenarioswhereTheLeTheLeTheLeTeLoopContinusunuesuntilaspecificiccificcificCondond


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

WebStorm Mac版
好用的JavaScript开发工具

EditPlus 中文破解版
体积小,语法高亮,不支持代码提示功能

SecLists
SecLists是最终安全测试人员的伙伴。它是一个包含各种类型列表的集合,这些列表在安全评估过程中经常使用,都在一个地方。SecLists通过方便地提供安全测试人员可能需要的所有列表,帮助提高安全测试的效率和生产力。列表类型包括用户名、密码、URL、模糊测试有效载荷、敏感数据模式、Web shell等等。测试人员只需将此存储库拉到新的测试机上,他就可以访问到所需的每种类型的列表。

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

Atom编辑器mac版下载
最流行的的开源编辑器