def stop_capture(self): """ Stop capture process, deactivate tshark""" if not self._sniffer is None: kill_tshark = ssh.SSHSession(self._target_ip, self._user, self._pwd) rc = kill_tshark.exec_command("killall %s" % self._wireshark_name) self.kill_tshark = None
def initialize(self): if self._initialize: return 0 if self._sniffer is None: self._sniffer = ssh.SSHSession(self._target_ip, self._user, self._pwd) if not self._sniffer is None: self._sniffer.exec_command("cd / && cd root") self._initialize = True
def initialize(self): if self._initialize: return 0 if self._sniffer is None: self._sniffer = ssh.SSHSession(self._target_ip, self._user, self._pwd) if not self._sniffer is None: self._sniffer.exec_command("cd\\") self._sniffer.exec_command("cd\\Program Files\\WireShark") self._initialize = True
def start_capture(self, file_name="test.pcap", dir=""): """ Start capture, activate tshark @param[in] file_name file to save captured frames @param[in] dir directory of captures files """ if self._sniffer is None: self._sniffer = ssh.SSHSession(self._target_ip, self._user, self._pwd) command = self.start_capture_cmd % os.path.join( 'c:/capture/', os.path.split(file_name)[1]) rc = self._sniffer.exec_command(command) if rc != -1: raise globals.Error("%s failed !" % command)
def start_capture(self, file_name="test.pcap", dir="capture"): """ Start capture, activate tshark @param[in] file_name file to save captured frames @param[in] dir directory of captures files """ if self._sniffer is None: self._sniffer = ssh.SSHSession(self._target_ip, self._user, self._pwd) self._file_name = file_name self._dir = '/root/capture' command = self.start_capture_cmd % (self._dir, self._file_name) rc = self._sniffer.exec_command(command) if rc != -1: raise globals.Error("%s failed !" % command)
def __init__(self, target_ip, if_id="mon0", user=WIRESHARK_PC_SNIFFER_DEFAULT_USER, pwd=WIRESHARK_PC_SNIFFER_DEFAULT_PWD): self._target_ip = target_ip self._if = ssh.SSHSession(target_ip, user, pwd) self._sniffer = None # Assume the sniffer is active and capturing self._initialize = True self._user = user self._pwd = pwd self._wireshark_name = 'tshark' self.sniffer_if = 'mon%d' self.sniffr_interface = self.sniffer_if % 0 self.start_capture_cmd = "%s" % self._wireshark_name + " -i " + self.sniffr_interface + " -w %s/%s" self.sniffer_type = 'wireshark'
def _clean_logs(self): """ clean all previos logs & reboot otherwise the vcad will not continue logging""" from lib.instruments import power_control #switch = power_control.NetworkPowerControl('10.10.0.2') for uut in self.uuts: #uut = globals.setup.units.unit(uut_idx) if "SDK3." in uut.version: uut.cli.vca_clean_logs() globals.setup.instruments.power_control[ uut.pwr_cntrl.id].reboot(uut.pwr_cntrl.port) else: self._if = ssh.SSHSession(uut.ip, "root", "123") command = 'rm -rf ../vca/2013' rc = self._if.exec_command(command) self._if.status_ready() command = 'reboot' rc = self._if.exec_command(command) self._if.status_ready() rc = self._if.exit_status() """for idx, obj in enumerate(self._uut):
def __init__(self, ip, user='******', pwd='123'): self._if = ssh.SSHSession(ip, user, pwd)
def start_v2x_cli_external_host(target): return external_host = ssh.SSHSession(target, 'user', '1qazxsw2') external_host.exec_command("nohup ./v2x-cli &") external_host = None