Beispiel #1
0
void get_privilege(long id)
{
	HANDLE h;
	ULONG status=NtOpenProcessToken(
		NtCurrentProcess()
		,0x20
		,&h);
	CHECKER(status)

	TOKEN_PRIVILEGES tp;
	tp.count = 1;
	tp.Privileges[0].Luid = NT::RtlConvertLongToLuid(id);
    tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;

	status = NtAdjustPrivilegesToken(
		h
		,false
		,&tp
		,0
		,0
		,0);
	CHECKER(status)

	ZwClose(h);
}
Beispiel #2
0
void showNoWrite(IO &io2,char *args)
{
	//ULONG status = NtInitializeRegistry(2);
	//CHECKER(status);
	unsigned int addr=0x8066eb34; //CmpNoWrite

	char *c=(char*)addr;
	
	BYTE Value;

	IO_STRUCT io;
	memset(&io, 0, sizeof(io));
	io.IoAddr = RdWrIoPort;
	io.pBuffer = (PVOID)(ULONG_PTR)addr;
	io.NumBytes = 1;
	io.Reserved4 = 1;
	io.Reserved6 = 1;
	ULONG status = ZwSystemDebugControl(DebugSysWriteIoSpace, &io, sizeof(io), NULL, 0,NULL);
	CHECKER(status)

	memset(&io, 0, sizeof(io));
	io.IoAddr = RdWrIoPort;
	io.pBuffer = &Value;
	io.NumBytes = 1;
	io.Reserved4 = 1;
	io.Reserved6 = 1;
	status = ZwSystemDebugControl(DebugSysReadIoSpace, &io, sizeof(io), NULL, 0,NULL);
	CHECKER(status);

	if (Value == 1)
	{
		io2.println("NoWrite set");
		/*Value = 0;

		memset(&io, 0, sizeof(io));
		io.IoAddr = RdWrIoPort;
		io.pBuffer = &Value;
		io.NumBytes = 1;
		io.Reserved4 = 1;
		io.Reserved6 = 1;
		status = ZwSystemDebugControl(DebugSysWriteIoSpace, &io, sizeof(io), NULL, 0,NULL);
		CHECKER(status);	

		memset(&io, 0, sizeof(io));
		io.IoAddr = RdWrIoPort;
		io.pBuffer = (PVOID)(ULONG_PTR)addr;
		io.NumBytes = 1;
		io.Reserved4 = 1;
		io.Reserved6 = 1;
		status = ZwSystemDebugControl(DebugSysReadIoSpace, &io, sizeof(io), NULL, 0, NULL);
		CHECKER(status);*/
	}
	else
		io2.println("NoWrite not set");	
}
Beispiel #3
0
void save_key_to(UnicodeString &key,UnicodeString &path)
{
	get_privilege(SE_BACKUP_PRIVILEGE);

	RegKey sam(key);
	sam.flush();

	OBJECT_ATTRIBUTES file;
	InitializeObjectAttributes(
		&file,
		&path.unicode_string(),
		OBJ_CASE_INSENSITIVE,
		NULL,
		NULL);
	HANDLE hFile;
	IO_STATUS_BLOCK ios;
	ULONG status = ZwCreateFile(
		&hFile
		,GENERIC_WRITE
		,&file
		,&ios
		,0
		,0
		,0
		,FILE_CREATE
		,0
		,0
		,0);
	CHECKER(status);

	sam.save_to(hFile);
	ZwClose(hFile);
}
Beispiel #4
0
void PySource::do_export() {

    PyEntityWithMetadata<base::ISource>::do_export("Source");

    class_<Source, bases<base::EntityWithMetadata<base::ISource>>>("Source")
        // Source
        .def("create_source", &Source::createSource)
        .def("_source_count", &Source::sourceCount)
        .def("_has_source_by_id", CHECKER(std::string, Source, hasSource))
        .def("_get_source_by_id", getSourceById)
        .def("_get_source_by_pos", getSourceByPos)
        .def("_delete_source_by_id", REMOVER(std::string, Source, deleteSource))
        // Inverse search
        .add_property("referring_data_arrays", &Source::referringDataArrays)
        .add_property("referring_tags", &Source::referringTags)
        .add_property("referring_multi_tags", &Source::referringMultiTags)
        // Other
        .def("__str__", &toStr<Source>)
        .def("__repr__", &toStr<Source>)
        ;

    to_python_converter<std::vector<Source>, vector_transmogrify<Source>>();
    to_python_converter<boost::optional<Source>, option_transmogrify<Source>>();
    option_transmogrify<Source>::register_from_python();
}
Beispiel #5
0
void PyMultiTag::do_export() {

    PyEntityWithSources<base::IMultiTag>::do_export("MultiTag");

    class_<MultiTag, bases<base::EntityWithSources<base::IMultiTag>>>("MultiTag")

        .add_property("positions",
                      GETTER(DataArray, MultiTag, positions),
                      REF_SETTER(DataArray, MultiTag, positions),
                      doc::multi_tag_positions)
        .add_property("extents",
                      getExtents,
                      setExtents,
                      doc::multi_tag_extents)
        .add_property("units",
                      GETTER(std::vector<std::string>, MultiTag, units),
                      setUnits,
                      doc::multi_tag_units)

        // References
        .def("_add_reference_by_id", REF_SETTER(std::string, MultiTag, addReference))
        .def("_has_reference_by_id", CHECKER(std::string, MultiTag, hasReference))
        .def("_reference_count", &MultiTag::referenceCount)
        .def("_get_reference_by_id", &getReferenceById)
        .def("_get_reference_by_pos", &getReferenceByPos)
        .def("_delete_reference_by_id", REMOVER(std::string, MultiTag, removeReference))

        // Features
        .def("create_feature", &createNewFeature, doc::multi_tag_create_feature)
        .def("_has_feature_by_id", CHECKER(std::string, MultiTag, hasFeature))
        .def("_feature_count", &MultiTag::featureCount)
        .def("_get_feature_by_id", &getFeatureById)
        .def("_get_feature_by_pos", &getFeatureByPos)
        .def("_delete_feature_by_id", REMOVER(std::string, MultiTag, deleteFeature))

        // Other
        .def("__str__", &toStr<MultiTag>)
        .def("__repr__", &toStr<MultiTag>)
        ;

    to_python_converter<std::vector<MultiTag>, vector_transmogrify<MultiTag>>();
    to_python_converter<boost::optional<MultiTag>, option_transmogrify<MultiTag>>();
}
Beispiel #6
0
void initReg(IO &io,char *args)
{
	ULONG status = NtInitializeRegistry(false);
	CHECKER(status);
}