Exemplo n.º 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())
Exemplo n.º 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()
Exemplo n.º 4
0
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()
Exemplo n.º 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()
Exemplo n.º 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
Exemplo n.º 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_)
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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