From c0c413196a912f7d36ab04cb8f5561b5fc18e83c Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 15 Sep 2018 12:08:06 +0800 Subject: [PATCH] frontend: remove artiq_pcap. Closes #1152 --- artiq/frontend/artiq_pcap.py | 57 ------------------------------------ setup.py | 1 - 2 files changed, 58 deletions(-) delete mode 100755 artiq/frontend/artiq_pcap.py diff --git a/artiq/frontend/artiq_pcap.py b/artiq/frontend/artiq_pcap.py deleted file mode 100755 index 59f124734..000000000 --- a/artiq/frontend/artiq_pcap.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python3 - -# This script makes the following assumptions: -# * tcpdump has CAP_NET_RAW capabilities set -# use # setcap cap_net_raw+eip /usr/sbin/tcpdump - -import os -import argparse -import subprocess - -from artiq.tools import verbosity_args, init_logger, logger, SSHClient - - -def get_argparser(): - parser = argparse.ArgumentParser(description="ARTIQ core device " - "packet capture tool") - - verbosity_args(parser) - - parser.add_argument("-H", "--host", metavar="HOST", - type=str, default="lab.m-labs.hk", - help="SSH host where the development board is located") - parser.add_argument("-D", "--device", metavar="DEVICE", - type=str, default="kc705.lab.m-labs.hk", - help="address or domain corresponding to the development board") - parser.add_argument("-f", "--file", metavar="PCAP_FILE", - type=str, default="coredevice.pcap", - help="Location to retrieve the pcap file into") - - parser.add_argument("command", metavar="COMMAND", - type=str, default=[], nargs=argparse.REMAINDER, - help="command to execute while capturing") - - return parser - - -def main(): - args = get_argparser().parse_args() - init_logger(args) - - client = SSHClient(args.host) - - sftp = client.get_sftp() - tcpdump = client.spawn_command( - "/usr/sbin/tcpdump host {device} -w {tmp}/trace.pcap", get_pty=True, - device=args.device) - - try: - subprocess.check_call(args.command) - except subprocess.CalledProcessError: - logger.error("Command failed") - - tcpdump.close() - sftp.get("{tmp}/trace.pcap".format(tmp=client.tmp), - args.file + ".new") - os.rename(args.file + ".new", args.file) - logger.info("Pcap file {file} retrieved".format(file=args.file)) diff --git a/setup.py b/setup.py index a10ec254b..70187c8b2 100755 --- a/setup.py +++ b/setup.py @@ -25,7 +25,6 @@ console_scripts = [ "artiq_coremgmt = artiq.frontend.artiq_coremgmt:main", "artiq_ctlmgr = artiq.frontend.artiq_ctlmgr:main", "artiq_devtool = artiq.frontend.artiq_devtool:main", - "artiq_pcap = artiq.frontend.artiq_pcap:main", "artiq_influxdb = artiq.frontend.artiq_influxdb:main", "artiq_master = artiq.frontend.artiq_master:main", "artiq_mkfs = artiq.frontend.artiq_mkfs:main",