예제 #1
0
def main():
    v = AnyURI("http://www.example.com/index1.html")
    v.condition = "Equals"

    u = URI()
    u.value = v
    u.type_ = URI.TYPE_URL

    print(Observables(u).to_xml())
def main():
    v = AnyURI("http://www.example.com/index1.html")
    v.condition = "Equals"

    u = URI()
    u.value = v
    u.type_ = URI.TYPE_URL

    print(Observables(u).to_xml())
예제 #3
0
def main():
    NS = cybox.utils.Namespace("http://example.com/", "example")
    cybox.utils.set_id_namespace(NS)

    v = AnyURI("http://www.example.com/index1.html")
    v.condition = "Equals"

    u = URI()
    u.value = v
    u.type_ = URI.TYPE_URL

    print Observables(u).to_xml()
예제 #4
0
파일: se_01.py 프로젝트: 2xyo/python-cybox
def main():
    print '<?xml version="1.0" encoding="UTF-8"?>'

    v = AnyURI("www.sample1.com/index.html")
    v.condition = "Equals"

    u = URI()
    u.value = v
    u.type_ = URI.TYPE_URL

    o = Observables(u)
    print o.to_xml()
예제 #5
0
def main():
    NS = cybox.utils.Namespace("http://example.com/", "example")
    cybox.utils.set_id_namespace(NS)

    v = AnyURI("http://www.example.com/index1.html")
    v.condition = "Equals"

    u = URI()
    u.value = v
    u.type_ = URI.TYPE_URL

    print Observables(u).to_xml()
예제 #6
0
    def from_dict(uri_dict):
        uri = URI()
        if "type" in uri_dict:
            uri.type_ = uri_dict["type"]
        if "value" in uri_dict:
            uri.value = AnyURI.from_dict(uri_dict["value"])

        return uri
예제 #7
0
    def test_round_trip(self):
        uri_str = "http://www.example.com"
        t = URI.TYPE_URL

        uri = URI(AnyURI(uri_str), t)
        uri2 = cybox.test.round_trip(uri)

        self.assertEqual(uri.to_dict(), uri2.to_dict())

        self.assertEqual(uri_str, str(uri2))
        self.assertEqual(t, uri2.type_)
예제 #8
0
    def from_dict(uri_dict):
        if uri_dict is None:
            return None

        uri = URI()
        ObjectProperties.from_dict(uri_dict, uri)

        uri.type_ = uri_dict.get('type')
        uri.value = AnyURI.from_dict(uri_dict.get('value'))

        return uri
예제 #9
0
    def from_obj(uri_obj):
        if not uri_obj:
            return None

        uri = URI()
        ObjectProperties.from_obj(uri_obj, uri)

        uri.type_ = uri_obj.get_type()
        uri.value = AnyURI.from_obj(uri_obj.get_Value())

        return uri
예제 #10
0
 def from_obj(uri_obj):
     uri = URI()
     uri.type_ = uri_obj.get_type()
     uri.value = AnyURI.from_obj(uri_obj.get_Value())
     return uri