Skip to content

Commit

Permalink
Use typing.List for devtools/pcapparser (#1530)
Browse files Browse the repository at this point in the history
  • Loading branch information
rytilahti authored Sep 20, 2022
1 parent 1129167 commit 3cb6ae1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions miio/devtools/pcapparser.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
"""Parse PCAP files for miio traffic."""
from collections import Counter, defaultdict
from ipaddress import ip_address
from typing import List

import click

from miio import Message


def read_payloads_from_file(file, tokens: list[str]):
def read_payloads_from_file(file, tokens: List[str]):
"""Read the given pcap file and yield src, dst, and result."""
try:
import dpkt
Expand Down Expand Up @@ -77,7 +78,7 @@ def read_payloads_from_file(file, tokens: list[str]):
@click.command()
@click.argument("file", type=click.File("rb"))
@click.argument("token", nargs=-1)
def parse_pcap(file, token: list[str]):
def parse_pcap(file, token: List[str]):
"""Read PCAP file and output decrypted miio communication."""
for src_addr, dst_addr, payload in read_payloads_from_file(file, token):
print(f"{src_addr:<15} -> {dst_addr:<15} {payload}") # noqa: T201

0 comments on commit 3cb6ae1

Please sign in to comment.