TestOsIdentificationVpn.py

Go to the documentation of this file.
00001 ##
00002 # 
00003 # Test case: security.scanning.nesdetection.TestOsIdentificationVpn
00004 # 
00005 from testenv.core.TestCase import TestCase
00006 
00007 ##
00008 # 
00009 #       Scenario: Operating system identification
00010 #       
00011 #       This test opens a VPN connection to the target network and trys to identify the operating system of the target by sending requests with nmap.
00012 #       
00013 #       @ingroup test_case_all
00014 #       
00015 class TestOsIdentificationVpn(TestCase):
00016         
00017         ##
00018         # 
00019         #               This function is called by the __init__ function from the parent.
00020         #               Don't define your own __init__ here!
00021         #               
00022         def initTestCase(self):
00023 
00024                 #set description to identify test case in output
00025                 self.setDescription("OS identification with VPN")
00026 
00027 
00028         ##
00029         # 
00030         #               implementation of OS identification
00031         #               
00032         def test(self):
00033                 
00034                 #get target IP address from config
00035                 targetIp = self.getParameter("configuration.local.target.ip")
00036                 
00037                 #build nmap parameter list
00038                 args = ["-O", targetIp]
00039                 
00040                 #define VPN connection
00041                 testVpnStart = self.newTest("seg", "vpn start", None)
00042                 testVpnStop = self.newTest("seg", "vpn stop", None)
00043                 
00044                 #define test
00045                 test = self.newTest("nmap", "osscan", {'arguments' : args})
00046                 
00047                 #start VPN connection
00048                 testVpnStart.set("mode", "start")
00049                 testVpnStart.start()
00050                 testVpnStart.join()
00051                                 
00052                 #run nmap
00053                 test.start()
00054                 test.join()
00055                 
00056                 #shutdown VPN connection
00057                 testVpnStop.set("mode", "stop")
00058                 testVpnStop.start()
00059                 testVpnStop.join()
00060                 
00061                 #get test result
00062                 testResult = self.getResult("osscan")
00063                 hosts = testResult.getValue("hosts")
00064                 
00065                 #assert that no operating system could have been detected
00066                 for host in hosts:
00067                         assert host.getOs == ""
00068 
00069 

Generated on Mon Aug 11 17:28:31 2008 for TestEnv by  doxygen 1.5.5