mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-28 12:48:26 +08:00
frontend: remove artiq_pcap. Closes #1152
This commit is contained in:
parent
eaeab0c9bd
commit
7565d816e4
@ -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))
|
1
setup.py
1
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",
|
||||
|
Loading…
Reference in New Issue
Block a user