@@ 118-139 (lines=22) @@ | ||
115 | self.assertIsInstance(res, list) |
|
116 | self.assertEqual(commands, ['nice -n 10 cat /etc/passwd']) |
|
117 | ||
118 | def test_run_command_legacy_credential(self): |
|
119 | ospd_ssh.paramiko = fakeparamiko |
|
120 | ||
121 | daemon = DummyWrapper(niceness=10) |
|
122 | scanid = daemon.create_scan( |
|
123 | None, |
|
124 | { |
|
125 | 'target': 'host.example.com', |
|
126 | 'ports': '80, 443', |
|
127 | 'credentials': {}, |
|
128 | 'exclude_hosts': '', |
|
129 | 'finished_hosts': '', |
|
130 | 'options': {}, |
|
131 | }, |
|
132 | dict(port=5, ssh_timeout=15, username='dummy', password='pw'), |
|
133 | '', |
|
134 | ) |
|
135 | daemon.start_queued_scans() |
|
136 | res = daemon.run_command(scanid, 'host.example.com', 'cat /etc/passwd') |
|
137 | ||
138 | self.assertIsInstance(res, list) |
|
139 | self.assertEqual(commands, ['nice -n 10 cat /etc/passwd']) |
|
140 | ||
141 | def test_run_command_new_credential(self): |
|
142 | ospd_ssh.paramiko = fakeparamiko |
|
@@ 95-116 (lines=22) @@ | ||
92 | with self.assertRaises(ImportError): |
|
93 | OSPDaemonSimpleSSH() |
|
94 | ||
95 | def test_run_command(self): |
|
96 | ospd_ssh.paramiko = fakeparamiko |
|
97 | ||
98 | daemon = DummyWrapper(niceness=10) |
|
99 | scanid = daemon.create_scan( |
|
100 | None, |
|
101 | { |
|
102 | 'target': 'host.example.com', |
|
103 | 'ports': '80, 443', |
|
104 | 'credentials': {}, |
|
105 | 'exclude_hosts': '', |
|
106 | 'finished_hosts': '', |
|
107 | 'options': {}, |
|
108 | }, |
|
109 | dict(port=5, ssh_timeout=15, username_password='dummy:pw'), |
|
110 | '', |
|
111 | ) |
|
112 | daemon.start_queued_scans() |
|
113 | res = daemon.run_command(scanid, 'host.example.com', 'cat /etc/passwd') |
|
114 | ||
115 | self.assertIsInstance(res, list) |
|
116 | self.assertEqual(commands, ['nice -n 10 cat /etc/passwd']) |
|
117 | ||
118 | def test_run_command_legacy_credential(self): |
|
119 | ospd_ssh.paramiko = fakeparamiko |