X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2Fnepi%2Fresources%2Flinux%2Ftcpdump.py;h=5f4def9c3f45a29d797e230483878cd564d22c23;hb=e55924b6886bd7382a28e1ae235c4810f852e163;hp=06357de4870b9d609f0118df6863878a11f16682;hpb=5bf45c1e55bf9637611c3d2dfa9c8de0504269a4;p=nepi.git diff --git a/src/nepi/resources/linux/tcpdump.py b/src/nepi/resources/linux/tcpdump.py index 06357de4..5f4def9c 100644 --- a/src/nepi/resources/linux/tcpdump.py +++ b/src/nepi/resources/linux/tcpdump.py @@ -3,9 +3,8 @@ # Copyright (C) 2013 INRIA # # This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation; # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -26,7 +25,7 @@ import os @clsinit_copy class LinuxTcpdump(LinuxApplication): - _rtype = "LinuxTcpdump" + _rtype = "linux::Tcpdump" @classmethod def _register_attributes(cls): @@ -35,25 +34,25 @@ class LinuxTcpdump(LinuxApplication): "Prints each packet (minus its link level header) in ASCII.", type = Types.Bool, default = False, - flags = Flags.ExecReadOnly) + flags = Flags.Design) b = Attribute("b", "Sets tcpdump -b option. " "Prints the AS number in BGP packets in ASDOT notation. ", type = Types.Bool, default = False, - flags = Flags.ExecReadOnly) + flags = Flags.Design) B = Attribute("B", "Sets tcpdump -B option. " "Sets the operaing system capture buffer size in untils of " "KiB (1024 bytes).", - flags = Flags.ExecReadOnly) + flags = Flags.Design) c = Attribute("c", "Sets tcpdump -c option. " "Exists after receiving count packets.", - flags = Flags.ExecReadOnly) + flags = Flags.Design) C = Attribute("C", "Sets tcpdump -C option. " @@ -63,7 +62,7 @@ class LinuxTcpdump(LinuxApplication): "Savefiles after the first savefile will have the name specified " "with the -w with a number after it, starting at 1 and continuing " "upward. ", - flags = Flags.ExecReadOnly) + flags = Flags.Design) d = Attribute("d", "Sets tcpdump -d option. " @@ -71,14 +70,14 @@ class LinuxTcpdump(LinuxApplication): "to standard output and stop.", type = Types.Bool, default = False, - flags = Flags.ExecReadOnly) + flags = Flags.Design) dd = Attribute("dd", "Sets tcpdump -dd option. " "Dump packet-matching code as a C program fragment. ", type = Types.Bool, default = False, - flags = Flags.ExecReadOnly) + flags = Flags.Design) ddd = Attribute("ddd", "Sets tcpdump -ddd option. " @@ -86,7 +85,7 @@ class LinuxTcpdump(LinuxApplication): "(preceded with a count).", type = Types.Bool, default = False, - flags = Flags.ExecReadOnly) + flags = Flags.Design) D = Attribute("D", "Sets tcpdump -D option. " @@ -94,19 +93,19 @@ class LinuxTcpdump(LinuxApplication): "and on which tcpdump can capture packets. ", type = Types.Bool, default = False, - flags = Flags.ExecReadOnly) + flags = Flags.Design) e = Attribute("e", "Sets tcpdump -e option. " "Print the link-level header on each dump line.", type = Types.Bool, default = False, - flags = Flags.ExecReadOnly) + flags = Flags.Design) F = Attribute("F", "Sets tcpdump -F option. " "Use file as input for the filter expression.", - flags = Flags.ExecReadOnly) + flags = Flags.Design) G = Attribute("G", "Sets tcpdump -G option. " @@ -114,14 +113,14 @@ class LinuxTcpdump(LinuxApplication): "option every rotate_seconds seconds. ", type = Types.Bool, default = False, - flags = Flags.ExecReadOnly) + flags = Flags.Design) i = Attribute("i", "Sets tcpdump -i option. " "Listen on interface. If unspecified, tcpdump searches the " "system interface list for the lowest numbered, configured " "up interface (excluding loopback). ", - flags = Flags.ExecReadOnly) + flags = Flags.Design) I = Attribute("I", "Sets tcpdump -I option. " @@ -130,7 +129,7 @@ class LinuxTcpdump(LinuxApplication): "operating systems. ", type = Types.Bool, default = False, - flags = Flags.ExecReadOnly) + flags = Flags.Design) j = Attribute("j", "Sets tcpdump -j option. " @@ -138,21 +137,21 @@ class LinuxTcpdump(LinuxApplication): "The names to use for the time stamp types are given in " "pcap-tstamp-type(7); not all the types listed there will " "necessarily be valid for any given interface.", - flags = Flags.ExecReadOnly) + flags = Flags.Design) K = Attribute("K", "Sets tcpdump -K option. " "Don't attempt to verify IP, TCP, or UDP checksums. ", type = Types.Bool, default = False, - flags = Flags.ExecReadOnly) + flags = Flags.Design) l = Attribute("l", "Sets tcpdump -l option. " "Make stdout line buffered. ", type = Types.Bool, default = False, - flags = Flags.ExecReadOnly) + flags = Flags.Design) U = Attribute("U", "Sets tcpdump -U option. " @@ -161,7 +160,7 @@ class LinuxTcpdump(LinuxApplication): "at the end of each packet. ", type = Types.Bool, default = False, - flags = Flags.ExecReadOnly) + flags = Flags.Design) n = Attribute("n", "Sets tcpdump -n option. " @@ -169,7 +168,7 @@ class LinuxTcpdump(LinuxApplication): "etc.) to names.", type = Types.Bool, default = False, - flags = Flags.ExecReadOnly) + flags = Flags.Design) N = Attribute("N", "Sets tcpdump -N option. " @@ -178,20 +177,20 @@ class LinuxTcpdump(LinuxApplication): "instead of ``nic.ddn.mil''.", type = Types.Bool, default = False, - flags = Flags.ExecReadOnly) + flags = Flags.Design) S = Attribute("S", "Sets tcpdump -S option. " "Print absolute, rather than relative, TCP sequence numbers.", type = Types.Bool, default = False, - flags = Flags.ExecReadOnly) + flags = Flags.Design) s = Attribute("s", "Sets tcpdump -s option. " "Snarf snaplen bytes of data from each packet rather than " "the default of 65535 bytes. ", - flags = Flags.ExecReadOnly) + flags = Flags.Design) T = Attribute("T", "Sets tcpdump -T option. " @@ -203,21 +202,21 @@ class LinuxTcpdump(LinuxApplication): "protocol), snmp (Simple Network Management Protocol), tftp " "(Trivial File Transfer Protocol), vat (Visual Audio Tool), " "and wb (distributed White Board).", - flags = Flags.ExecReadOnly) + flags = Flags.Design) t = Attribute("t", "Sets tcpdump -t option. " "Don't print a timestamp on each dump line.", type = Types.Bool, default = False, - flags = Flags.ExecReadOnly) + flags = Flags.Design) tt = Attribute("tt", "Sets tcpdump -tt option. " "Print an unformatted timestamp on each dump line. ", type = Types.Bool, default = False, - flags = Flags.ExecReadOnly) + flags = Flags.Design) ttt = Attribute("ttt", "Sets tcpdump -ttt option. " @@ -225,7 +224,7 @@ class LinuxTcpdump(LinuxApplication): "and previous line on each dump line.", type = Types.Bool, default = False, - flags = Flags.ExecReadOnly) + flags = Flags.Design) tttt = Attribute("tttt", "Sets tcpdump -tttt option. " @@ -233,7 +232,7 @@ class LinuxTcpdump(LinuxApplication): "each dump line. ", type = Types.Bool, default = False, - flags = Flags.ExecReadOnly) + flags = Flags.Design) ttttt = Attribute("ttttt", "Sets tcpdump -ttttt option. " @@ -241,7 +240,7 @@ class LinuxTcpdump(LinuxApplication): "first line on each dump line.", type = Types.Bool, default = False, - flags = Flags.ExecReadOnly) + flags = Flags.Design) v = Attribute("v", "Sets tcpdump -v option. " @@ -249,21 +248,21 @@ class LinuxTcpdump(LinuxApplication): "verbose output. ", type = Types.Bool, default = False, - flags = Flags.ExecReadOnly) + flags = Flags.Design) vv = Attribute("vv", "Sets tcpdump -vv option. " "Even more verbose output. ", type = Types.Bool, default = False, - flags = Flags.ExecReadOnly) + flags = Flags.Design) vvv = Attribute("vvv", "Sets tcpdump -vv option. " "Even more verbose output. ", type = Types.Bool, default = False, - flags = Flags.ExecReadOnly) + flags = Flags.Design) w = Attribute("w", "Sets tcpdump -w option. " @@ -271,11 +270,11 @@ class LinuxTcpdump(LinuxApplication): "and printing them out.", type = Types.Bool, default = False, - flags = Flags.ExecReadOnly) + flags = Flags.Design) expression = Attribute("expression", "selects which packets will be dumped.", - flags = Flags.ExecReadOnly) + flags = Flags.Design) cls._register_attribute(A) cls._register_attribute(b) @@ -316,14 +315,17 @@ class LinuxTcpdump(LinuxApplication): self._home = "tcpdump-%s" % self.guid self._sudo_kill = True - def deploy(self): + def do_deploy(self): if not self.get("command"): self.set("command", self._start_command) + if not self.get("env"): + self.set("env", "PATH=$PATH:/usr/sbin/") + if not self.get("depends"): self.set("depends", "tcpdump") - super(LinuxTcpdump, self).deploy() + super(LinuxTcpdump, self).do_deploy() @property def _start_command(self):