关于工具:攻击包装器是用于运行和评估DPA竞赛(http://www.dpacontest.org/home/index.html)攻击的工具。它被设计成可以在任何类似Unix的操作系统上运行,比如Linux、Mac等,以及Windows。使用这个工具,您可以使用几乎任何编程语言(C、C++、Python、Perl.)或使用Matlab来开发您的攻击。
在这里,您可以找到一个下载链接和有关它的更多信息:http://www.dpacontest.org/tools/tools.php
当我试图评估数据时(可以在这里找到traces.php),攻击包装工具只是创建空文件然后挂起。
我的命令:
attack_wrapper -d DPA_contestv4_2_k00/DPA_contestv4_2/ -x dpav4_2_index.txt -e v4_2 -t -o results_k0 -f fifo结果:
D - Output filename = results_k0 (truncate if exists)
D - FIFO mode
D - Base name for FIFOs = fifo
D - Compatibility mode (v2) = disabled
D - Traces will be read from directory DPA_contestv4_2_k00/DPA_contestv4_2/
D - Using index file dpav4_2_index.txt
D - We will check if traces are available
D - Offsets/Shuffles are not provided to the attack
D - Samples are transfered as floats
I - Reading index file (v4_2)...
D - Total number of traces in the index file = 80000
D - Total number of traces available = 5000
D - Total number of keys in the index file = 16
D - Total number of keys available = 1
D - Key #00 (8249ceb658c71d41d7b734449629ab97): 5000 traces available
D - Key #01 (ef38c2af582a7e6b14255d139e9dbefc): not available
D - Key #02 (79db64df1e68124f6a57372b10e20e63): not available
D - Key #03 (efe61497dacc689fd9828465d3ff812b): not available
D - Key #04 (6a4daad5346e6eb385e1d278d1305089): not available
D - Key #05 (c0f38792d0d49c9f9ab97073f92c54b7): not available
D - Key #06 (389f496d23017d998c90ae1972aeaa0f): not available
D - Key #07 (2f345fbf2cd45942f3d91752cbe43ae7): not available
D - Key #08 (f3522c01495323615bcca67de0075395): not available
D - Key #09 (d4a9c9846bbc91da654eca24f08b9176): not available
D - Key #10 (c32807b275242ebf0f53d4639369980d): not available
D - Key #11 (80ceed788ce14c553ae0329995a5bebe): not available
D - Key #12 (0538cad22e6ca8405e14b4f3c5703c92): not available
D - Key #13 (512bfe6e6c4d2c62afa5f900fcc9cb11): not available
D - Key #14 (5384facaaefd16f38f1359ace6a29037): not available
D - Key #15 (b3e0a2b88e2dcf4bf765f2aad1538588): not available
D - Key # = 0
D - # of traces = 5000
I - Preparing the results file...
I - FIFO Wrapper -> Attack: fifo_from_wrapper
I - FIFO Attack -> Wrapper: fifo_to_wrapper
I - Sending # of iterations (5000)然后什么也没发生(没完没了)。
我在Windows 7,Ubuntu16.04,Ubuntu17.10模式下尝试过,但是结果是一样的。
我怎样才能修正它来评估数据呢?
更新:
当我在“发送.”之后发动攻击。提示出现在
./attack_by_CPA/py_attack_by_CPA/attack.py fifo_from_wrapper fifo_to_wrapper我有错误:
Traceback (most recent call last):
File "./attack_by_CPA/py_attack_by_CPA/attack.py", line 514, in <module>
attack.launchAttack()
File "./attack_by_CPA/py_attack_by_CPA/attack.py", line 377, in launchAttack
this.samples = np.array([struct.unpack('f', fifoIn.read(4))[0] for _ in range(NUM_SAMPLES)])
File "./attack_by_CPA/py_attack_by_CPA/attack.py", line 377, in <listcomp>
this.samples = np.array([struct.unpack('f', fifoIn.read(4))[0] for _ in range(NUM_SAMPLES)])
struct.error: unpack requires a buffer of 4 bytesfifo_from_wrapper和fifo_to_wrapper只是空文件:
prw------- 1 acan acan 0 апр 14 10:50 fifo_from_wrapper|
prw------- 1 acan acan 0 апр 14 10:41 fifo_to_wrapper|打开这些文件的部分代码:
def launchAttack(this):
# Open the FIFOs
fifoIn = open(this.fifoInName, 'rb')
fifoOut = open(this.fifoOutName, 'wb')
# Read the number of traces
numTraces = struct.unpack('i', fifoIn.read(4))[0]发布于 2018-04-11 23:28:05
你是在“发送.”之后手动启动你的攻击程序吗?提示出现了吗?如果是的话,你能把攻击程序中与从包装器的流文件中读取/写入相关的部分张贴出来吗?
来自DPA竞赛网站的“工具”页面:
如果包装程序使用FIFO模式(如果使用-f或-fifo启动,或者在Windows上启动),包装器将创建两个特殊文件(两个fifo或管道)来与攻击进行通信。攻击必须手动启动,并且必须打开这两个文件:(在Unix: xxx_from_wrapper上以只读模式,xxx_to_wrapper在写模式下;在Windows:.\pipe\xxx_from_wrapper上,在只读模式下;在.\pipe\xxx_to_wrapper上,在只写模式下)。接下来,要从包装器读取数据,攻击只需从文件xxx_from_wrapper (或.\pipe\xxx_from_wrapper )读取,然后将数据发送到包装器,攻击只需写入文件xxx_to_wrapper (或Windows上的.\pipe\xxx_to_wrapper )。xxx用包装器命令行上的最后一个参数替换。
https://stackoverflow.com/questions/49366235
复制相似问题