| 19 | | telnet = new TelnetConnection(host, port); |
| 20 | | telnet.Login(user, password, 4000); |
| 21 | | telnet.WriteLine("cd C:\\scapy-2.1.0"); |
| 22 | | telnet.WriteLine("python"); |
| 23 | | String result = telnet.Read(">>>"); |
| 24 | | telnet.WriteLine("from scapy.all import *"); |
| 25 | | result = telnet.Read(">>>"); |
| 26 | | telnet.WriteLine("from scapy.layers.l2 import Dot1Q"); |
| 27 | | result = telnet.Read(">>>"); |
| 28 | | telnet.WriteLine("from scapy.layers.inet import IP"); |
| 29 | | result = telnet.Read(">>>"); |
| 30 | | telnet.WriteLine("from scapy.layers.ppp import *"); |
| 31 | | result = telnet.Read(">>>"); |
| 32 | | telnet.WriteLine("from scapy.layers.l2 import *"); |
| 33 | | result = telnet.Read(">>>"); |
| 34 | | telnet.WriteLine("import sys, os"); |
| 35 | | result = telnet.Read(">>>"); |
| 36 | | setTestAgainstObject(result); |
| | 25 | super.init(); |
| | 26 | |
| | 27 | Prompt[] pyPrompts = new Prompt[1]; |
| | 28 | |
| | 29 | pyPrompts[0] = new Prompt(); |
| | 30 | pyPrompts[0].setPrompt(">>>"); |
| | 31 | pyPrompts[0].setCommandEnd(true); |
| | 32 | |
| | 33 | station = StationsFactory.createStation(getHost(), CliFactory.OPERATING_SYSTEM_WINDOWS, "telnet", getUser(), getPassword(), null); |
| | 34 | station.init(); |
| | 35 | cliApplication = station.getCliSession(false); |
| | 36 | |
| 39 | | public void handleCliCommand(String title, String command) throws Exception { |
| 40 | | report.startLevel(title, Reporter.CurrentPlace); |
| 41 | | telnet.WriteLine(command); |
| 42 | | String result = telnet.Read(">>>"); |
| 43 | | setTestAgainstObject(result); |
| 44 | | analyze(new TextNotFound("error")); |
| 45 | | report.stopLevel(); |
| | 39 | public void handleCliCommand(String command) throws Exception { |
| | 40 | cliApplication.handleCliCommand(command, new CliCommand(command)); |
| | 41 | cliApplication.analyze(new TextNotFound("Error")); |
| 48 | | public void handleCliCommand(String title, String[] commands) throws Exception { |
| 49 | | report.startLevel(title, Reporter.CurrentPlace); |
| 50 | | for (String command : commands) { |
| 51 | | telnet.WriteLine(command); |
| 52 | | String result = (telnet.Read(">>>")); |
| 53 | | setTestAgainstObject(result); |
| 54 | | analyze(new TextNotFound("error")); |
| 55 | | } |
| 56 | | report.stopLevel(); |
| | 44 | public void handleCliCommandWithoutWait(String title, String command) throws Exception { |
| | 45 | // report.startLevel(title, Reporter.CurrentPlace); |
| | 46 | // telnet.WriteLine(command); |
| | 47 | // Thread.sleep(200); |
| | 48 | // String result = telnet.Read(""); |
| | 49 | // setTestAgainstObject(result); |
| | 50 | // report.stopLevel(); |