TestIcmpQueryVpn.py

Go to the documentation of this file.
00001 ##
00002 # 
00003 # Test case: security.scanning.TestIcmpQueryVpn
00004 # 
00005 from testenv.core.TestCase import TestCase
00006 from testenv.core.TestResult import TestResult
00007 
00008 ##
00009 # 
00010 #       Scenario: ICMP query
00011 #       
00012 #       This test opens a VPN connection to the target network and afterwards does ICMP queries to gather information about the network's topology.
00013 #       
00014 #       @ingroup test_case_all
00015 #       
00016 class TestIcmpQueryVpn(TestCase):
00017         
00018         ##
00019         # 
00020         #               This function is called by the __init__ function from the parent.
00021         #               Don't define your own __init__ here!
00022         #               
00023         def initTestCase(self):
00024 
00025                 #set description to identify test case in output
00026                 self.setDescription("ICMP query with VPN")
00027 
00028 
00029         ##
00030         # 
00031         #               implementation of an ICMP query
00032         #               
00033         def test(self):
00034                 
00035                 #get target IP address from config
00036                 targetIp = self.getParameter("configuration.local.target.ip")
00037                 
00038                 #icmpquery parameter lists
00039                 #1. ICMP timestamp request
00040                 args1 = ["-t", targetIp]
00041                 #2. ICMP address mask request
00042                 args2 = ["-m", targetIp]
00043                 
00044                 #define VPN connection
00045                 testVpnStart = self.newTest("seg", "vpn start", None)
00046                 testVpnStop = self.newTest("seg", "vpn stop", None)
00047                 
00048                 #define ICMP timestamp request
00049                 test1 = self.newTest("icmpquery", "timestamp", {'arguments' : args1})
00050                 #define ICMP address mask request
00051                 test2 = self.newTest("icmpquery", "addressmask", {'arguments' : args2})
00052                 
00053                 #start VPN connection
00054                 testVpnStart.set("mode", "start")
00055                 testVpnStart.start()
00056                 testVpnStart.join()
00057                                 
00058                 #run first query
00059                 test1.start()
00060                 test1.join()
00061                 
00062                 #run second query
00063                 test2.start()
00064                 test2.join()
00065                 
00066                 #shutdown VPN connection
00067                 testVpnStop.set("mode", "stop")
00068                 testVpnStop.start()
00069                 testVpnStop.join()
00070                 
00071                 #get output of tests (no output expected)
00072                 testResult = self.getResult("timestamp")
00073                 output = testResult.getValue("output")
00074                 assert output == "", "no response to timestamp ICMP query"
00075                 
00076                 testResult = self.getResult("addressmask")
00077                 output = testResult.getValue("output")
00078                 assert output == "", "no response to addressmask ICMP query"
00079 
00080 

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