"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/test_ssh_daemon.py" between
ospd-2.0.0.tar.gz and ospd-2.0.1.tar.gz

About: OSPd is a base class for scanner wrappers which share the same communication protocol: OSP (OpenVAS Scanner Protocol).

test_ssh_daemon.py  (ospd-2.0.0):test_ssh_daemon.py  (ospd-2.0.1)
skipping to change at line 80 skipping to change at line 80
ospd_ssh.paramiko = None ospd_ssh.paramiko = None
with self.assertRaises(ImportError): with self.assertRaises(ImportError):
OSPDaemonSimpleSSH('cert', 'key', 'ca', '10') OSPDaemonSimpleSSH('cert', 'key', 'ca', '10')
def test_run_command(self): def test_run_command(self):
ospd_ssh.paramiko = fakeparamiko ospd_ssh.paramiko = fakeparamiko
daemon = OSPDaemonSimpleSSH('cert', 'key', 'ca', '10') daemon = OSPDaemonSimpleSSH('cert', 'key', 'ca', '10')
scanid = daemon.create_scan( scanid = daemon.create_scan(
None, None,
[['host.example.com', '80, 443', '', '']], [['host.example.com', '80, 443', '', '', '']],
dict(port=5, ssh_timeout=15, username_password='dummy:pw'), dict(port=5, ssh_timeout=15, username_password='dummy:pw'),
'', '',
) )
res = daemon.run_command(scanid, 'host.example.com', 'cat /etc/passwd') res = daemon.run_command(scanid, 'host.example.com', 'cat /etc/passwd')
self.assertIsInstance(res, list) self.assertIsInstance(res, list)
self.assertEqual(commands, ['nice -n 10 cat /etc/passwd']) self.assertEqual(commands, ['nice -n 10 cat /etc/passwd'])
def test_run_command_legacy_credential(self): def test_run_command_legacy_credential(self):
ospd_ssh.paramiko = fakeparamiko ospd_ssh.paramiko = fakeparamiko
daemon = OSPDaemonSimpleSSH('cert', 'key', 'ca', '10') daemon = OSPDaemonSimpleSSH('cert', 'key', 'ca', '10')
scanid = daemon.create_scan( scanid = daemon.create_scan(
None, None,
[['host.example.com', '80, 443', '', '']], [['host.example.com', '80, 443', '', '', '']],
dict(port=5, ssh_timeout=15, username='dummy', password='pw'), dict(port=5, ssh_timeout=15, username='dummy', password='pw'),
'', '',
) )
res = daemon.run_command(scanid, 'host.example.com', 'cat /etc/passwd') res = daemon.run_command(scanid, 'host.example.com', 'cat /etc/passwd')
self.assertIsInstance(res, list) self.assertIsInstance(res, list)
self.assertEqual(commands, ['nice -n 10 cat /etc/passwd']) self.assertEqual(commands, ['nice -n 10 cat /etc/passwd'])
def test_run_command_new_credential(self): def test_run_command_new_credential(self):
skipping to change at line 123 skipping to change at line 123
'type': 'up', 'type': 'up',
'password': 'mypass', 'password': 'mypass',
'port': '22', 'port': '22',
'username': 'scanuser', 'username': 'scanuser',
}, },
'smb': {'type': 'up', 'password': 'mypass', 'username': 'smbuser'}, 'smb': {'type': 'up', 'password': 'mypass', 'username': 'smbuser'},
} }
scanid = daemon.create_scan( scanid = daemon.create_scan(
None, None,
[['host.example.com', '80, 443', cred_dict, '']], [['host.example.com', '80, 443', cred_dict, '', '']],
dict(port=5, ssh_timeout=15), dict(port=5, ssh_timeout=15),
'', '',
) )
res = daemon.run_command(scanid, 'host.example.com', 'cat /etc/passwd') res = daemon.run_command(scanid, 'host.example.com', 'cat /etc/passwd')
self.assertIsInstance(res, list) self.assertIsInstance(res, list)
self.assertEqual(commands, ['nice -n 10 cat /etc/passwd']) self.assertEqual(commands, ['nice -n 10 cat /etc/passwd'])
def test_run_command_no_credential(self): def test_run_command_no_credential(self):
ospd_ssh.paramiko = fakeparamiko ospd_ssh.paramiko = fakeparamiko
daemon = OSPDaemonSimpleSSH('cert', 'key', 'ca', '10') daemon = OSPDaemonSimpleSSH('cert', 'key', 'ca', '10')
scanid = daemon.create_scan( scanid = daemon.create_scan(
None, None,
[['host.example.com', '80, 443', '', '']], [['host.example.com', '80, 443', '', '', '']],
dict(port=5, ssh_timeout=15), dict(port=5, ssh_timeout=15),
'', '',
) )
with self.assertRaises(ValueError): with self.assertRaises(ValueError):
daemon.run_command(scanid, 'host.example.com', 'cat /etc/passwd') daemon.run_command(scanid, 'host.example.com', 'cat /etc/passwd')
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)