def zorp(): try: s = MasterSession() s.setService(Service("s1", None)) NATPolicy( 'test', GeneralNAT([ (InetDomain('10.0.0.0/8'), InetDomain('20.0.0.0/8')), (InetDomain('11.0.0.0/8'), InetDomain('192.168.0.0/24')), ])) nat = getNATPolicy('test') testcase(nat, s, (None, SockAddrInet('10.0.0.1', 8888)), NAT_DNAT, SockAddrInet('20.0.0.1', 8888)) testcase(nat, s, (None, SockAddrInet('11.0.0.0', 8888)), NAT_DNAT, SockAddrInet('192.168.0.0', 8888)) testcase(nat, s, (None, SockAddrInet('11.0.1.1', 8888)), NAT_DNAT, SockAddrInet('192.168.0.1', 8888)) testcase(nat, s, (None, SockAddrInet('11.255.255.255', 8888)), NAT_DNAT, SockAddrInet('192.168.0.255', 8888)) except Exception, e: print_exc() quit(1) return 1
def init(names, virtual_name, is_master): try: log("session_id", "core.error", 1, "test_format='%s'", "test_value") log("session_id", "core.error", 1, "test_format='%s'", ("test_value",)) log("session_id", "core.error", 1, "test_format='%s'" % "test_value") log("session_id", "core.error", 1, "test_format='%s'" % ("test_value",)) except Exception, e: print_exc() quit(1) return 1
def zorp(): try: s = MasterSession() s.setService(Service("s1", None)) NATPolicy('test', GeneralNAT( [(InetDomain('10.0.0.0/8'), InetDomain('20.0.0.0/8')), (InetDomain('11.0.0.0/8'), InetDomain('192.168.0.0/24')), ])) nat = getNATPolicy('test') testcase(nat, s, (None, SockAddrInet('10.0.0.1', 8888)), NAT_DNAT, SockAddrInet('20.0.0.1', 8888)) testcase(nat, s, (None, SockAddrInet('11.0.0.0', 8888)), NAT_DNAT, SockAddrInet('192.168.0.0', 8888)) testcase(nat, s, (None, SockAddrInet('11.0.1.1', 8888)), NAT_DNAT, SockAddrInet('192.168.0.1', 8888)) testcase(nat, s, (None, SockAddrInet('11.255.255.255', 8888)), NAT_DNAT, SockAddrInet('192.168.0.255', 8888)) except Exception, e: print_exc() quit(1) return 1
def init(name): try: a = MatcherPolicy("a", SubstringMatcher(pattern="a")) b = MatcherPolicy("b", SubstringMatcher(pattern="b")) c = MatcherPolicy("c", SubstringMatcher(pattern="c")) a_or_b = MatcherPolicy("a_or_b", CombineMatcher(expr=[Z_OR, "a", "b"])) a_or_b_or_c = MatcherPolicy("a_or_b_or_c", CombineMatcher(expr=[Z_OR, "a", "b", "c"])) not_a_or_b_and_c = MatcherPolicy( "not_a_or_b_and_c", CombineMatcher( expr=[Z_AND, c, CombineMatcher(expr=[Z_NOT, a_or_b])])) stacked_matcher = MatcherPolicy( "stacked", CombineMatcher((Z_AND, c, (Z_NOT, a_or_b)))) test(a, "alma", TRUE) test(a, "korte", FALSE) test(a_or_b, "alma", TRUE) test(a_or_b, "birskorte", TRUE) test(a_or_b, "birsalma", TRUE) test(a_or_b, "korte", FALSE) test(not_a_or_b_and_c, "korte", FALSE) # c missing test(not_a_or_b_and_c, "cseresznye", TRUE) test(not_a_or_b_and_c, "almaecet", FALSE) # a or b is true test(not_a_or_b_and_c, "borecet", FALSE) # a or b is true test(stacked_matcher, "korte", FALSE) # c missing test(stacked_matcher, "cseresznye", TRUE) test(stacked_matcher, "almaecet", FALSE) # a or b is true test(stacked_matcher, "borecet", FALSE) # a or b is true test(a_or_b_or_c, "korte", FALSE) test(a_or_b_or_c, "cseresznye", TRUE) test(a_or_b_or_c, "almaecet", TRUE) test(a_or_b_or_c, "borecet", TRUE) except Exception, e: print_exc() quit(1) return 1
def zorp(): try: s = MasterSession() s.setService(Service("s1", None)) nat = NATPolicy('test', GeneralNAT( [(InetSubnet('0.0.0.0/32'), InetSubnet('10.0.0.0/8'), InetSubnet('20.0.0.0/8')), (InetSubnet('0.0.0.0/32'), InetSubnet('11.0.0.0/8'), InetSubnet('192.168.0.0/24')), (Inet6Subnet('::/128'), Inet6Subnet('1200::/8'), Inet6Subnet('2300::/8')), ])) testcase(nat, s, (None, SockAddrInet('10.0.0.1', 8888)), NAT_DNAT, SockAddrInet('20.0.0.1', 8888)) testcase(nat, s, (None, SockAddrInet('11.0.0.0', 8888)), NAT_DNAT, SockAddrInet('192.168.0.0', 8888)) testcase(nat, s, (None, SockAddrInet('11.0.1.1', 8888)), NAT_DNAT, SockAddrInet('192.168.0.1', 8888)) testcase(nat, s, (None, SockAddrInet('11.255.255.255', 8888)), NAT_DNAT, SockAddrInet('192.168.0.255', 8888)) testcase(nat, s, (None, SockAddrInet6('1234::', 8888)), NAT_DNAT, SockAddrInet6('2334::', 8888)) except Exception, e: print_exc() quit(1) return 1
def init(name): try: a = MatcherPolicy("a", SubstringMatcher(pattern="a")) b = MatcherPolicy("b", SubstringMatcher(pattern="b")) c = MatcherPolicy("c", SubstringMatcher(pattern="c")) a_or_b = MatcherPolicy("a_or_b", CombineMatcher(expr=[Z_OR, "a", "b"])) a_or_b_or_c = MatcherPolicy("a_or_b_or_c", CombineMatcher(expr=[Z_OR, "a", "b", "c"])) not_a_or_b_and_c = MatcherPolicy("not_a_or_b_and_c", CombineMatcher( expr=[Z_AND, c, CombineMatcher(expr=[Z_NOT, a_or_b])] )) stacked_matcher = MatcherPolicy("stacked", CombineMatcher((Z_AND, c, (Z_NOT, a_or_b)) )) test(a, "alma", TRUE) test(a, "korte", FALSE) test(a_or_b, "alma", TRUE) test(a_or_b, "birskorte", TRUE) test(a_or_b, "birsalma", TRUE) test(a_or_b, "korte", FALSE) test(not_a_or_b_and_c, "korte", FALSE) # c missing test(not_a_or_b_and_c, "cseresznye", TRUE) test(not_a_or_b_and_c, "almaecet", FALSE) # a or b is true test(not_a_or_b_and_c, "borecet", FALSE) # a or b is true test(stacked_matcher, "korte", FALSE) # c missing test(stacked_matcher, "cseresznye", TRUE) test(stacked_matcher, "almaecet", FALSE) # a or b is true test(stacked_matcher, "borecet", FALSE) # a or b is true test(a_or_b_or_c, "korte", FALSE) test(a_or_b_or_c, "cseresznye", TRUE) test(a_or_b_or_c, "almaecet", TRUE) test(a_or_b_or_c, "borecet", TRUE) except Exception, e: print_exc() quit(1) return 1
test(a, "alma", TRUE) test(a, "korte", FALSE) test(a_or_b, "alma", TRUE) test(a_or_b, "birskorte", TRUE) test(a_or_b, "birsalma", TRUE) test(a_or_b, "korte", FALSE) test(not_a_or_b_and_c, "korte", FALSE) # c missing test(not_a_or_b_and_c, "cseresznye", TRUE) test(not_a_or_b_and_c, "almaecet", FALSE) # a or b is true test(not_a_or_b_and_c, "borecet", FALSE) # a or b is true test(stacked_matcher, "korte", FALSE) # c missing test(stacked_matcher, "cseresznye", TRUE) test(stacked_matcher, "almaecet", FALSE) # a or b is true test(stacked_matcher, "borecet", FALSE) # a or b is true test(a_or_b_or_c, "korte", FALSE) test(a_or_b_or_c, "cseresznye", TRUE) test(a_or_b_or_c, "almaecet", TRUE) test(a_or_b_or_c, "borecet", TRUE) except Exception, e: print_exc() quit(1) return 1 quit(0) return 1
def zorp(): try: Service('test', PlugProxy) # keyword argument is present that is processed by the C code Listener(SockAddrInet('0.0.0.0', 1999), 'test', transparent=TRUE) Listener(DBSockAddr(SockAddrInet('0.0.0.0', 1999)), 'test', transparent=TRUE) Listener(DBIface('eth0', 1999), 'test', transparent=TRUE) Receiver(SockAddrInet('0.0.0.0', 1999), 'test', transparent=TRUE) Receiver(DBSockAddr(SockAddrInet('0.0.0.0', 1999)), 'test', transparent=TRUE) Receiver(DBIface('eth0', 1999), 'test', transparent=TRUE) Dispatcher(DBSockAddr(SockAddrInet('0.0.0.0', 1999), protocol=ZD_PROTO_TCP), 'test', transparent=TRUE) Dispatcher(DBIface('eth0', 1999, protocol=ZD_PROTO_TCP), 'test', transparent=TRUE) Dispatcher(DBIfaceGroup(100, 1999, protocol=ZD_PROTO_TCP), 'test', transparent=TRUE) #Dispatcher(DBIfaceGroup('ifgroup', 1999, protocol=ZD_PROTO_TCP), 'test', transparent=TRUE) ZoneListener(SockAddrInet('0.0.0.0', 1999), {'all': 'test'}, transparent=TRUE) ZoneListener(DBSockAddr(SockAddrInet('0.0.0.0', 1999)), {'all': 'test'}, transparent=TRUE) ZoneListener(DBIface('eth0', 1999), {'all': 'test'}, transparent=TRUE) ZoneReceiver(SockAddrInet('0.0.0.0', 1999), {'all': 'test'}, transparent=TRUE) ZoneReceiver(DBSockAddr(SockAddrInet('0.0.0.0', 1999)), {'all': 'test'}, transparent=TRUE) ZoneReceiver(DBIface('eth0', 1999), {'all': 'test'}, transparent=TRUE) ZoneDispatcher(DBSockAddr(SockAddrInet('0.0.0.0', 1999), protocol=ZD_PROTO_TCP), {'all': 'test'}, transparent=TRUE) ZoneDispatcher(DBIface('eth0', 1999, protocol=ZD_PROTO_TCP), {'all': 'test'}, transparent=TRUE) ZoneDispatcher(DBIfaceGroup(100, 1999, protocol=ZD_PROTO_TCP), {'all': 'test'}, transparent=TRUE) #ZoneDispatcher(DBIfaceGroup('ifgroup', 1999, protocol=ZD_PROTO_TCP), {'all': 'test'}, transparent=TRUE) CSZoneListener(SockAddrInet('0.0.0.0', 1999), {('all', 'all'): 'test'}, transparent=TRUE) CSZoneListener(DBSockAddr(SockAddrInet('0.0.0.0', 1999)), {('all', 'all'): 'test'}, transparent=TRUE) CSZoneListener(DBIface('eth0', 1999), {('all', 'all'): 'test'}, transparent=TRUE) CSZoneReceiver(SockAddrInet('0.0.0.0', 1999), {('all', 'all'): 'test'}, transparent=TRUE) CSZoneReceiver(DBSockAddr(SockAddrInet('0.0.0.0', 1999)), {('all', 'all'): 'test'}, transparent=TRUE) CSZoneReceiver(DBIface('eth0', 1999), {('all', 'all'): 'test'}, transparent=TRUE) CSZoneDispatcher(DBSockAddr(SockAddrInet('0.0.0.0', 1999), protocol=ZD_PROTO_TCP), {('all', 'all'): 'test'}, transparent=TRUE) CSZoneDispatcher(DBIface('eth0', 1999, protocol=ZD_PROTO_TCP), {('all', 'all'): 'test'}, transparent=TRUE) CSZoneDispatcher(DBIfaceGroup(100, 1999, protocol=ZD_PROTO_TCP), {('all', 'all'): 'test'}, transparent=TRUE) #CSZoneDispatcher(DBIfaceGroup('ifgroup', 1999, protocol=ZD_PROTO_TCP), {('all', 'all'): 'test'}, transparent=TRUE) # no keyword arguments Listener(SockAddrInet('0.0.0.0', 1999), 'test') Listener(DBSockAddr(SockAddrInet('0.0.0.0', 1999)), 'test') Listener(DBIface('eth0', 1999), 'test') Receiver(SockAddrInet('0.0.0.0', 1999), 'test') Receiver(DBSockAddr(SockAddrInet('0.0.0.0', 1999)), 'test') Receiver(DBIface('eth0', 1999), 'test') Dispatcher(DBSockAddr(SockAddrInet('0.0.0.0', 1999), protocol=ZD_PROTO_TCP), 'test') Dispatcher(DBIface('eth0', 1999, protocol=ZD_PROTO_TCP), 'test') ZoneListener(SockAddrInet('0.0.0.0', 1999), {'all': 'test'}) ZoneListener(DBSockAddr(SockAddrInet('0.0.0.0', 1999)), {'all': 'test'}) ZoneListener(DBIface('eth0', 1999), {'all': 'test'}) ZoneReceiver(SockAddrInet('0.0.0.0', 1999), {'all': 'test'}) ZoneReceiver(DBSockAddr(SockAddrInet('0.0.0.0', 1999)), {'all': 'test'}) ZoneReceiver(DBIface('eth0', 1999), {'all': 'test'}) ZoneDispatcher(DBSockAddr(SockAddrInet('0.0.0.0', 1999), protocol=ZD_PROTO_TCP), {'all': 'test'}) ZoneDispatcher(DBIface('eth0', 1999, protocol=ZD_PROTO_TCP), {'all': 'test'}) CSZoneListener(SockAddrInet('0.0.0.0', 1999), {('all', 'all'): 'test'}) CSZoneListener(DBSockAddr(SockAddrInet('0.0.0.0', 1999)), {('all', 'all'): 'test'}) CSZoneListener(DBIface('eth0', 1999), {('all', 'all'): 'test'}) CSZoneReceiver(SockAddrInet('0.0.0.0', 1999), {('all', 'all'): 'test'}) CSZoneReceiver(DBSockAddr(SockAddrInet('0.0.0.0', 1999)), {('all', 'all'): 'test'}) CSZoneReceiver(DBIface('eth0', 1999), {('all', 'all'): 'test'}) CSZoneDispatcher(DBSockAddr(SockAddrInet('0.0.0.0', 1999), protocol=ZD_PROTO_TCP), {('all', 'all'): 'test'}) CSZoneDispatcher(DBIface('eth0', 1999, protocol=ZD_PROTO_TCP), {('all', 'all'): 'test'}) except Exception, e: print_exc() quit(1) return 1
def zorp(): try: s = MasterSession() s.setService(Service("s1", None)) NATPolicy( 'test', GeneralNAT([ (InetDomain('10.0.0.0/8'), InetDomain('20.0.0.0/8')), (InetDomain('11.0.0.0/8'), InetDomain('192.168.0.0/24')), ])) nat = getNATPolicy('test') testcase(nat, s, (None, SockAddrInet('10.0.0.1', 8888)), NAT_DNAT, SockAddrInet('20.0.0.1', 8888)) testcase(nat, s, (None, SockAddrInet('11.0.0.0', 8888)), NAT_DNAT, SockAddrInet('192.168.0.0', 8888)) testcase(nat, s, (None, SockAddrInet('11.0.1.1', 8888)), NAT_DNAT, SockAddrInet('192.168.0.1', 8888)) testcase(nat, s, (None, SockAddrInet('11.255.255.255', 8888)), NAT_DNAT, SockAddrInet('192.168.0.255', 8888)) except Exception, e: print_exc() quit(1) return 1 quit(0) return 1
def init(name): try: t1 = InetZone("test1", "192.168.0.0/24", inbound_services=["s1"], outbound_services=["s2"]) t2 = InetZone("test2", "192.168.0.32/27") t3 = InetZone("test3", "192.168.0.0/26") t4 = InetZone("test4", "192.168.0.64/27") t5 = InetZone("test5", "192.168.0.96/27") t6 = InetZone("test6", "192.168.0.0/25") t7 = InetZone("test7", "192.168.0.0/16") t8 = InetZone("test8", "192.168.1.1/32", admin_parent="test1") t9 = InetZone("test9", "192.168.1.2/32", admin_parent="test8") t10 = InetZone("test10", "192.168.1.3/32", admin_parent="test9", umbrella=1) t11 = InetZone("test11", "192.168.1.4/32", admin_parent="test9") t12 = InetZone("test12", "192.168.1.5/32", inbound_services=['*']) t13 = InetZone("test13", "192.168.1.6/32", outbound_services=['*']) t14 = InetZone("test14", "192.168.0.184", outbound_services=['*']) test('192.168.0.1', root_zone.findZone(SockAddrInet('192.168.0.1', 10)), t3) test('192.168.0.33', root_zone.findZone(SockAddrInet('192.168.0.33', 10)), t2) test('192.168.0.65', root_zone.findZone(SockAddrInet('192.168.0.65', 10)), t4) test('192.168.0.97', root_zone.findZone(SockAddrInet('192.168.0.97', 10)), t5) test('192.168.0.129', root_zone.findZone(SockAddrInet('192.168.0.129', 10)), t1) test('192.168.1.129', root_zone.findZone(SockAddrInet('192.168.1.129', 10)), t7) test('192.168.0.184', root_zone.findZone(SockAddrInet('192.168.0.184', 10)), t14) inet = InetZone("internet", "0.0.0.0/0", inbound_services=["s2"], outbound_services=["s1"]) test('1.1.1.1', root_zone.findZone(SockAddrInet('1.1.1.1', 10)), inet) #for i in range(1,100): # test('masstest1', root_zone.findZone(SockAddrInet(inet_ntoa(htonl(i)), 10)), inet) #for i in range(1,100): # test('masstest2', root_zone.findZone(SockAddrInet('192.168.1.129', 10)), t7) s = MasterSession() s.setService(Service("s1", None)) s.setServer(SockAddrInet('192.168.1.2', 9999)) #print time() #for i in range(1, 100000): # if s.isServerPermitted() != Z_ACCEPT: # raise 'problema' #print time() test('service s1#1', t1.isInboundServicePermitted(s), Z_ACCEPT) test('service s1#2', t1.isOutboundServicePermitted(s), Z_REJECT) test('service s1#3', inet.isInboundServicePermitted(s), Z_REJECT) test('service s1#4', inet.isOutboundServicePermitted(s), Z_ACCEPT) ### test('service s1#5', t10.isOutboundServicePermitted(s), Z_REJECT) test('service s1#6', t10.isInboundServicePermitted(s), Z_REJECT) test('service s1#7', t11.isOutboundServicePermitted(s), Z_REJECT) test('service s1#8', t11.isInboundServicePermitted(s), Z_ACCEPT) test('service s1#9', t12.isInboundServicePermitted(s), Z_ACCEPT) test('service s1#10', t12.isOutboundServicePermitted(s), Z_REJECT) test('service s1#11', t13.isOutboundServicePermitted(s), Z_ACCEPT) test('service s1#12', t13.isInboundServicePermitted(s), Z_REJECT) s.service = Service("s2", None) test('service s2#1', t1.isInboundServicePermitted(s), Z_REJECT) test('service s2#2', t1.isOutboundServicePermitted(s), Z_ACCEPT) test('service s2#3', inet.isInboundServicePermitted(s), Z_ACCEPT) test('service s2#4', inet.isOutboundServicePermitted(s), Z_REJECT) ### test('service s2#5', t10.isInboundServicePermitted(s), Z_REJECT) test('service s2#6', t10.isOutboundServicePermitted(s), Z_REJECT) test('service s2#7', t11.isOutboundServicePermitted(s), Z_ACCEPT) test('service s2#8', t11.isInboundServicePermitted(s), Z_REJECT) test('service s2#9', t12.isInboundServicePermitted(s), Z_ACCEPT) test('service s2#10', t12.isOutboundServicePermitted(s), Z_REJECT) test('service s2#11', t13.isOutboundServicePermitted(s), Z_ACCEPT) test('service s2#12', t13.isInboundServicePermitted(s), Z_REJECT) except Exception, e: print_exc() quit(1) return 1
def init(names, virtual_name, is_master): try: t1 = Zone("test1", "192.168.0.0/24", inbound_services=["s1"], outbound_services=["s2"]) t2 = Zone("test2", "192.168.0.32/27") t3 = Zone("test3", "192.168.0.0/26") t4 = Zone("test4", "192.168.0.64/27") t5 = Zone("test5", "192.168.0.96/27") t6 = Zone("test6", "192.168.0.0/25") t7 = Zone("test7", "192.168.0.0/16") t8 = Zone("test8", "192.168.1.1/32", admin_parent="test1") t9 = Zone("test9", "192.168.1.2/32", admin_parent="test8") t10 = Zone("test10", "192.168.1.3/32", admin_parent="test9", umbrella=1) t11 = Zone("test11", "192.168.1.4/32", admin_parent="test9") t12 = Zone("test12", "192.168.1.5/32", inbound_services=['*']) t13 = Zone("test13", "192.168.1.6/32", outbound_services=['*']) t14 = Zone("test14", "192.168.0.184", outbound_services=['*']) t15 = Zone("test15", "dead:beef:baad:c0ff:ee00:1122:3344:5566/127", outbound_services=['*']) test('192.168.0.1', Zone.lookup(SockAddrInet('192.168.0.1', 10)), t3) test('192.168.0.33', Zone.lookup(SockAddrInet('192.168.0.33', 10)), t2) test('192.168.0.65', Zone.lookup(SockAddrInet('192.168.0.65', 10)), t4) test('192.168.0.97', Zone.lookup(SockAddrInet('192.168.0.97', 10)), t5) test('192.168.0.129', Zone.lookup(SockAddrInet('192.168.0.129', 10)), t1) test('192.168.1.129', Zone.lookup(SockAddrInet('192.168.1.129', 10)), t7) test('192.168.0.184', Zone.lookup(SockAddrInet('192.168.0.184', 10)), t14) test('dead:beef:baad:c0ff:ee00:1122:3344:5566', Zone.lookup(SockAddrInet6('dead:beef:baad:c0ff:ee00:1122:3344:5566', 10)), t15) test('dead:beef:baad:c0ff:ee00:1122:3344:5566', Zone.lookup(SockAddrInet6('dead:beef:baad:c0ff:ee00:1122:3344:5567', 10)), t15) inet = Zone("internet", "0.0.0.0/0", inbound_services=["s2"], outbound_services=["s1"]) test('1.1.1.1', Zone.lookup(SockAddrInet('1.1.1.1', 10)), inet) s = MasterSession() s.setService(Service("s1", None)) s.setServer(SockAddrInet('192.168.1.2', 9999)) test('service s1#1', t1.isInboundServicePermitted(s.service), ZV_ACCEPT) test('service s1#2', t1.isOutboundServicePermitted(s.service), ZV_REJECT) test('service s1#3', inet.isInboundServicePermitted(s.service), ZV_REJECT) test('service s1#4', inet.isOutboundServicePermitted(s.service), ZV_ACCEPT) ### test('service s1#5', t10.isOutboundServicePermitted(s.service), ZV_REJECT) test('service s1#6', t10.isInboundServicePermitted(s.service), ZV_REJECT) test('service s1#7', t11.isOutboundServicePermitted(s.service), ZV_REJECT) test('service s1#8', t11.isInboundServicePermitted(s.service), ZV_ACCEPT) test('service s1#9', t12.isInboundServicePermitted(s.service), ZV_ACCEPT) test('service s1#10', t12.isOutboundServicePermitted(s.service), ZV_REJECT) test('service s1#11', t13.isOutboundServicePermitted(s.service), ZV_ACCEPT) test('service s1#12', t13.isInboundServicePermitted(s.service), ZV_REJECT) s.service = Service("s2", None) test('service s2#1', t1.isInboundServicePermitted(s.service), ZV_REJECT) test('service s2#2', t1.isOutboundServicePermitted(s.service), ZV_ACCEPT) test('service s2#3', inet.isInboundServicePermitted(s.service), ZV_ACCEPT) test('service s2#4', inet.isOutboundServicePermitted(s.service), ZV_REJECT) ### test('service s2#5', t10.isInboundServicePermitted(s.service), ZV_REJECT) test('service s2#6', t10.isOutboundServicePermitted(s.service), ZV_REJECT) test('service s2#7', t11.isOutboundServicePermitted(s.service), ZV_ACCEPT) test('service s2#8', t11.isInboundServicePermitted(s.service), ZV_REJECT) test('service s2#9', t12.isInboundServicePermitted(s.service), ZV_ACCEPT) test('service s2#10', t12.isOutboundServicePermitted(s.service), ZV_REJECT) test('service s2#11', t13.isOutboundServicePermitted(s.service), ZV_ACCEPT) test('service s2#12', t13.isInboundServicePermitted(s.service), ZV_REJECT) except Exception, e: print_exc() quit(1) return 1
def zorp(): try: Service('test', PlugProxy) # keyword argument is present that is processed by the C code Listener(SockAddrInet('0.0.0.0', 1999), 'test', transparent=TRUE) Listener(DBSockAddr(SockAddrInet('0.0.0.0', 1999)), 'test', transparent=TRUE) Listener(DBIface('eth0', 1999), 'test', transparent=TRUE) Receiver(SockAddrInet('0.0.0.0', 1999), 'test', transparent=TRUE) Receiver(DBSockAddr(SockAddrInet('0.0.0.0', 1999)), 'test', transparent=TRUE) Receiver(DBIface('eth0', 1999), 'test', transparent=TRUE) Dispatcher(DBSockAddr(SockAddrInet('0.0.0.0', 1999), protocol=ZD_PROTO_TCP), 'test', transparent=TRUE) Dispatcher(DBIface('eth0', 1999, protocol=ZD_PROTO_TCP), 'test', transparent=TRUE) Dispatcher(DBIfaceGroup(100, 1999, protocol=ZD_PROTO_TCP), 'test', transparent=TRUE) #Dispatcher(DBIfaceGroup('ifgroup', 1999, protocol=ZD_PROTO_TCP), 'test', transparent=TRUE) ZoneListener(SockAddrInet('0.0.0.0', 1999), {'all': 'test'}, transparent=TRUE) ZoneListener(DBSockAddr(SockAddrInet('0.0.0.0', 1999)), {'all': 'test'}, transparent=TRUE) ZoneListener(DBIface('eth0', 1999), {'all': 'test'}, transparent=TRUE) ZoneReceiver(SockAddrInet('0.0.0.0', 1999), {'all': 'test'}, transparent=TRUE) ZoneReceiver(DBSockAddr(SockAddrInet('0.0.0.0', 1999)), {'all': 'test'}, transparent=TRUE) ZoneReceiver(DBIface('eth0', 1999), {'all': 'test'}, transparent=TRUE) ZoneDispatcher(DBSockAddr(SockAddrInet('0.0.0.0', 1999), protocol=ZD_PROTO_TCP), {'all': 'test'}, transparent=TRUE) ZoneDispatcher(DBIface('eth0', 1999, protocol=ZD_PROTO_TCP), {'all': 'test'}, transparent=TRUE) ZoneDispatcher(DBIfaceGroup(100, 1999, protocol=ZD_PROTO_TCP), {'all': 'test'}, transparent=TRUE) #ZoneDispatcher(DBIfaceGroup('ifgroup', 1999, protocol=ZD_PROTO_TCP), {'all': 'test'}, transparent=TRUE) CSZoneListener(SockAddrInet('0.0.0.0', 1999), {('all', 'all'): 'test'}, transparent=TRUE) CSZoneListener(DBSockAddr(SockAddrInet('0.0.0.0', 1999)), {('all', 'all'): 'test'}, transparent=TRUE) CSZoneListener(DBIface('eth0', 1999), {('all', 'all'): 'test'}, transparent=TRUE) CSZoneReceiver(SockAddrInet('0.0.0.0', 1999), {('all', 'all'): 'test'}, transparent=TRUE) CSZoneReceiver(DBSockAddr(SockAddrInet('0.0.0.0', 1999)), {('all', 'all'): 'test'}, transparent=TRUE) CSZoneReceiver(DBIface('eth0', 1999), {('all', 'all'): 'test'}, transparent=TRUE) CSZoneDispatcher(DBSockAddr(SockAddrInet('0.0.0.0', 1999), protocol=ZD_PROTO_TCP), {('all', 'all'): 'test'}, transparent=TRUE) CSZoneDispatcher(DBIface('eth0', 1999, protocol=ZD_PROTO_TCP), {('all', 'all'): 'test'}, transparent=TRUE) CSZoneDispatcher(DBIfaceGroup(100, 1999, protocol=ZD_PROTO_TCP), {('all', 'all'): 'test'}, transparent=TRUE) #CSZoneDispatcher(DBIfaceGroup('ifgroup', 1999, protocol=ZD_PROTO_TCP), {('all', 'all'): 'test'}, transparent=TRUE) # no keyword arguments Listener(SockAddrInet('0.0.0.0', 1999), 'test') Listener(DBSockAddr(SockAddrInet('0.0.0.0', 1999)), 'test') Listener(DBIface('eth0', 1999), 'test') Receiver(SockAddrInet('0.0.0.0', 1999), 'test') Receiver(DBSockAddr(SockAddrInet('0.0.0.0', 1999)), 'test') Receiver(DBIface('eth0', 1999), 'test') Dispatcher( DBSockAddr(SockAddrInet('0.0.0.0', 1999), protocol=ZD_PROTO_TCP), 'test') Dispatcher(DBIface('eth0', 1999, protocol=ZD_PROTO_TCP), 'test') ZoneListener(SockAddrInet('0.0.0.0', 1999), {'all': 'test'}) ZoneListener(DBSockAddr(SockAddrInet('0.0.0.0', 1999)), {'all': 'test'}) ZoneListener(DBIface('eth0', 1999), {'all': 'test'}) ZoneReceiver(SockAddrInet('0.0.0.0', 1999), {'all': 'test'}) ZoneReceiver(DBSockAddr(SockAddrInet('0.0.0.0', 1999)), {'all': 'test'}) ZoneReceiver(DBIface('eth0', 1999), {'all': 'test'}) ZoneDispatcher( DBSockAddr(SockAddrInet('0.0.0.0', 1999), protocol=ZD_PROTO_TCP), {'all': 'test'}) ZoneDispatcher(DBIface('eth0', 1999, protocol=ZD_PROTO_TCP), {'all': 'test'}) CSZoneListener(SockAddrInet('0.0.0.0', 1999), {('all', 'all'): 'test'}) CSZoneListener(DBSockAddr(SockAddrInet('0.0.0.0', 1999)), {('all', 'all'): 'test'}) CSZoneListener(DBIface('eth0', 1999), {('all', 'all'): 'test'}) CSZoneReceiver(SockAddrInet('0.0.0.0', 1999), {('all', 'all'): 'test'}) CSZoneReceiver(DBSockAddr(SockAddrInet('0.0.0.0', 1999)), {('all', 'all'): 'test'}) CSZoneReceiver(DBIface('eth0', 1999), {('all', 'all'): 'test'}) CSZoneDispatcher( DBSockAddr(SockAddrInet('0.0.0.0', 1999), protocol=ZD_PROTO_TCP), {('all', 'all'): 'test'}) CSZoneDispatcher(DBIface('eth0', 1999, protocol=ZD_PROTO_TCP), {('all', 'all'): 'test'}) except Exception, e: print_exc() quit(1) return 1