diff options
| author | J08nY | 2020-03-03 13:32:14 +0100 |
|---|---|---|
| committer | J08nY | 2020-03-03 13:32:14 +0100 |
| commit | 9ed79b918009580a04649c7acdce63247d2314ed (patch) | |
| tree | 1f26c579818583cbdc763ee8aa6b7da33d3e8921 /pyecsca/sca/target | |
| parent | c5d813d80c5314b3609ee88a21bac625a9ae5d60 (diff) | |
| download | pyecsca-9ed79b918009580a04649c7acdce63247d2314ed.tar.gz pyecsca-9ed79b918009580a04649c7acdce63247d2314ed.tar.zst pyecsca-9ed79b918009580a04649c7acdce63247d2314ed.zip | |
Diffstat (limited to 'pyecsca/sca/target')
| -rw-r--r-- | pyecsca/sca/target/binary.py | 12 | ||||
| -rw-r--r-- | pyecsca/sca/target/chipwhisperer.py | 1 |
2 files changed, 8 insertions, 5 deletions
diff --git a/pyecsca/sca/target/binary.py b/pyecsca/sca/target/binary.py index 62d1102..9a469b6 100644 --- a/pyecsca/sca/target/binary.py +++ b/pyecsca/sca/target/binary.py @@ -1,6 +1,6 @@ import subprocess from subprocess import Popen -from typing import Optional +from typing import Optional, Union, List from public import public @@ -9,17 +9,21 @@ from .serial import SerialTarget @public class BinaryTarget(SerialTarget): - binary: str + binary: List[str] process: Optional[Popen] debug_output: bool - def __init__(self, binary: str, debug_output: bool = False, **kwargs): + def __init__(self, binary: Union[str, List[str]], debug_output: bool = False, **kwargs): super().__init__(**kwargs) + if not isinstance(binary, (str, list)): + raise TypeError + if isinstance(binary, str): + binary = [binary] self.binary = binary self.debug_output = debug_output def connect(self): - self.process = Popen([self.binary], stdin=subprocess.PIPE, stdout=subprocess.PIPE, + self.process = Popen(self.binary, stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True, bufsize=1) def write(self, data: bytes): diff --git a/pyecsca/sca/target/chipwhisperer.py b/pyecsca/sca/target/chipwhisperer.py index 0528618..1dcdbe3 100644 --- a/pyecsca/sca/target/chipwhisperer.py +++ b/pyecsca/sca/target/chipwhisperer.py @@ -1,4 +1,3 @@ -from binascii import unhexlify from typing import Optional from time import sleep |
