当前位置: 首页 > news >正文

番禺外贸型网站建设seo优化工具

番禺外贸型网站建设,seo优化工具,快递b2c是什么意思,网站个人简介怎么做一、背景知识概念参考微软链接: 强制完整性控制 - Win32 应用程序 |Microsoft 学习 授权) (模拟级别 - Win32 apps | Microsoft Learn DuplicateTokenEx 函数 (securitybaseapi.h) - Win32 apps | Microsoft Learn 本文主要演示 low, medium, high, and system 四…

 一、背景知识概念参考微软链接:

强制完整性控制 - Win32 应用程序 |Microsoft 学习

授权) (模拟级别 - Win32 apps | Microsoft Learn

DuplicateTokenEx 函数 (securitybaseapi.h) - Win32 apps | Microsoft Learn

本文主要演示 low, medium, high, and system 四种权限创建和使用例子:

 Windows defines four integrity levels: low, medium, high, and system

integrity levels定义如下:

C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\winnt.h

#define SECURITY_MANDATORY_LABEL_AUTHORITY          {0,0,0,0,0,16}
#define SECURITY_MANDATORY_UNTRUSTED_RID            (0x00000000L)
#define SECURITY_MANDATORY_LOW_RID                  (0x00001000L)
#define SECURITY_MANDATORY_MEDIUM_RID               (0x00002000L)
#define SECURITY_MANDATORY_MEDIUM_PLUS_RID          (SECURITY_MANDATORY_MEDIUM_RID + 0x100)
#define SECURITY_MANDATORY_HIGH_RID                 (0x00003000L)
#define SECURITY_MANDATORY_SYSTEM_RID               (0x00004000L)
#define SECURITY_MANDATORY_PROTECTED_PROCESS_RID    (0x00005000L)

 或者字符串也一样:

 //  INTEGRITY_LEVEL_SYSTEM:      "S-1-16-16384" System Mandatory Level//  INTEGRITY_LEVEL_HIGH:        "S-1-16-12288" High Mandatory Level//  INTEGRITY_LEVEL_MEDIUM:      "S-1-16-8192"  Medium Mandatory Level//  INTEGRITY_LEVEL_MEDIUM_LOW:  "S-1-16-6144"//  INTEGRITY_LEVEL_LOW:         "S-1-16-4096"  Low Mandatory Level//  INTEGRITY_LEVEL_BELOW_LOW:   "S-1-16-2048"//  INTEGRITY_LEVEL_UNTRUSTED:   "S-1-16-0"     Untrusted Mandatory Level

   Low (SID: S-1-16-4096),
 Medium (SID: S-1-16-8192),
 High (SID: S-1-16-12288)
 System (SID: S-1-16-16384). 

二、代码:

#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
#include <windows.h>
#include <iostream>#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/memory_mapped_file.h"
#include "base/logging.h"
#include "base/process/launch.h"
#include "base/process/process.h"
#include "base/threading/thread.h"
#include "base/win/access_token.h"
#include "base/win/scoped_handle.h"
#include "base/win/sid.h"
#include "build/build_config.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {// Copies the process token making it a primary impersonation token.
// The returned handle will have |desired_access| rights.
bool CopyProcessToken(DWORD desired_access,base::win::ScopedHandle* token_out) {HANDLE temp_handle;if (!::OpenProcessToken(::GetCurrentProcess(),TOKEN_DUPLICATE | desired_access, &temp_handle)) {LOG(ERROR) << "Failed to open process token";return false;}base::win::ScopedHandle process_token(temp_handle);if (!::DuplicateTokenEx(process_token.Get(), desired_access, nullptr,SecurityImpersonation, TokenPrimary, &temp_handle)) {LOG(ERROR) << "Failed to duplicate the process token";return false;}token_out->Set(temp_handle);return true;
}void RunAccessTokenTest(DWORD integrity_level) {base::win::ScopedHandle privileged_token;CopyProcessToken(MAXIMUM_ALLOWED, &privileged_token);absl::optional<base::win::AccessToken> token =base::win::AccessToken::FromToken(std::move(privileged_token));token->SetIntegrityLevel(integrity_level);DWORD level = token->IntegrityLevel();if (level == integrity_level) {LOG(INFO) << "IntegrityLevel: " << level;} else {LOG(ERROR) << "failed IntegrityLevel: " << level;}base::LaunchOptions options;options.as_user = token->get();static const base::CommandLine::CharType* argvTmp[] = {FILE_PATH_LITERAL("C:/Windows/System32/Notepad.exe")};base::CommandLine command_line(1, argvTmp);LOG(INFO) << "Browser: " << command_line.GetCommandLineString();base::Process child_process = base::LaunchProcess(command_line, options);
}}  // namespaceint main(int argc, const char* argv[]) {// SYSTEM HIGH MEDIUM LOW UNTRUSTED//  Note: These levels map to SIDs under the hood.//  INTEGRITY_LEVEL_SYSTEM:      "S-1-16-16384" System Mandatory Level//  INTEGRITY_LEVEL_HIGH:        "S-1-16-12288" High Mandatory Level//  INTEGRITY_LEVEL_MEDIUM:      "S-1-16-8192"  Medium Mandatory Level//  INTEGRITY_LEVEL_MEDIUM_LOW:  "S-1-16-6144"//  INTEGRITY_LEVEL_LOW:         "S-1-16-4096"  Low Mandatory Level//  INTEGRITY_LEVEL_BELOW_LOW:   "S-1-16-2048"//  INTEGRITY_LEVEL_UNTRUSTED:   "S-1-16-0"     Untrusted Mandatory Level// DWORD integrity_level PSID 定义如下//  #define SECURITY_MANDATORY_LABEL_AUTHORITY          {0,0,0,0,0,16}//  #define SECURITY_MANDATORY_UNTRUSTED_RID            (0x00000000L)//  #define SECURITY_MANDATORY_LOW_RID                  (0x00001000L)//  #define SECURITY_MANDATORY_MEDIUM_RID               (0x00002000L)//  #define SECURITY_MANDATORY_MEDIUM_PLUS_RID (SECURITY_MANDATORY_MEDIUM_RID//  + 0x100) #define SECURITY_MANDATORY_HIGH_RID                 (0x00003000L)//  #define SECURITY_MANDATORY_SYSTEM_RID               (0x00004000L)//  #define SECURITY_MANDATORY_PROTECTED_PROCESS_RID    (0x00005000L)base::CommandLine::Init(argc, argv);RunAccessTokenTest(SECURITY_MANDATORY_SYSTEM_RID);  // system权限进程RunAccessTokenTest(SECURITY_MANDATORY_HIGH_RID);    // high权限进程RunAccessTokenTest(SECURITY_MANDATORY_MEDIUM_RID);  // medium权限进程RunAccessTokenTest(SECURITY_MANDATORY_LOW_RID);     // low权限进程return 0;
}

三、编译之后运行效果如图:

     可以看到已经按照预定完整性级别创建了进程。 

    system级别创建失败 是因为02-test.exe进程级别是high的,按照规则不可以模拟出大于原始进程完整性级别。强制完整性控制 - Win32 应用程序 |Microsoft 学习

 四、总结:

      核心也是利用DuplicateTokenEx复制进程token完整性级别,在设置到token中【SetTokenInformation】

SetIntegrityLevel函数定义如下:

template <typename T>
bool Set(const ScopedHandle& token,TOKEN_INFORMATION_CLASS info_class,T& value) {return !!::SetTokenInformation(token.get(), info_class, &value,sizeof(value));
}bool AccessToken::SetIntegrityLevel(DWORD integrity_level) {absl::optional<base::win::Sid> sid = Sid::FromIntegrityLevel(integrity_level);if (!sid) {::SetLastError(ERROR_INVALID_SID);return false;}TOKEN_MANDATORY_LABEL label = {};label.Label.Attributes = SE_GROUP_INTEGRITY;label.Label.Sid = sid->GetPSID();return Set(token_, TokenIntegrityLevel, label);
}

 base\win\access_token.cc

  base\win\sid.cc

也可以参考windows 进程降权和提权代码示例(2)-CSDN博客 


文章转载自:
http://ordinant.jqLx.cn
http://regerminate.jqLx.cn
http://profound.jqLx.cn
http://cappie.jqLx.cn
http://henrietta.jqLx.cn
http://remigrate.jqLx.cn
http://irreproachable.jqLx.cn
http://etaerio.jqLx.cn
http://theoretic.jqLx.cn
http://superficiary.jqLx.cn
http://corse.jqLx.cn
http://bookrest.jqLx.cn
http://obumbrant.jqLx.cn
http://undermentioned.jqLx.cn
http://anisocytosis.jqLx.cn
http://luteotropic.jqLx.cn
http://hydroponic.jqLx.cn
http://iatrology.jqLx.cn
http://inulase.jqLx.cn
http://timpano.jqLx.cn
http://foxpro.jqLx.cn
http://sheet.jqLx.cn
http://specie.jqLx.cn
http://sara.jqLx.cn
http://caniniform.jqLx.cn
http://additament.jqLx.cn
http://discomfiture.jqLx.cn
http://semimetal.jqLx.cn
http://herbaceous.jqLx.cn
http://clearance.jqLx.cn
http://pelvis.jqLx.cn
http://strathspey.jqLx.cn
http://hydrazoate.jqLx.cn
http://nodulate.jqLx.cn
http://nema.jqLx.cn
http://delegatee.jqLx.cn
http://philae.jqLx.cn
http://osteolite.jqLx.cn
http://rosaria.jqLx.cn
http://histogenically.jqLx.cn
http://idyl.jqLx.cn
http://gametocyte.jqLx.cn
http://unavoidable.jqLx.cn
http://underarm.jqLx.cn
http://ectosarcous.jqLx.cn
http://algoid.jqLx.cn
http://electrochemistry.jqLx.cn
http://throttlehold.jqLx.cn
http://audiovisual.jqLx.cn
http://actor.jqLx.cn
http://spaniard.jqLx.cn
http://graphology.jqLx.cn
http://arrantly.jqLx.cn
http://fibrefill.jqLx.cn
http://dignity.jqLx.cn
http://erstwhile.jqLx.cn
http://benefactress.jqLx.cn
http://astronomically.jqLx.cn
http://entophytic.jqLx.cn
http://marconigraph.jqLx.cn
http://overshadow.jqLx.cn
http://callus.jqLx.cn
http://stripling.jqLx.cn
http://clostridial.jqLx.cn
http://hydroscope.jqLx.cn
http://daniel.jqLx.cn
http://phototypesetting.jqLx.cn
http://galleried.jqLx.cn
http://natch.jqLx.cn
http://project.jqLx.cn
http://cytophagic.jqLx.cn
http://extemporary.jqLx.cn
http://background.jqLx.cn
http://tarpan.jqLx.cn
http://foresaddle.jqLx.cn
http://highjacking.jqLx.cn
http://shamba.jqLx.cn
http://panax.jqLx.cn
http://disconsolation.jqLx.cn
http://hippology.jqLx.cn
http://heidi.jqLx.cn
http://leyte.jqLx.cn
http://entogastric.jqLx.cn
http://atishoo.jqLx.cn
http://outrun.jqLx.cn
http://blench.jqLx.cn
http://handle.jqLx.cn
http://phylloerythrin.jqLx.cn
http://redbreast.jqLx.cn
http://chancellor.jqLx.cn
http://hairtrigger.jqLx.cn
http://trypsinization.jqLx.cn
http://locutory.jqLx.cn
http://osteosarcoma.jqLx.cn
http://lawine.jqLx.cn
http://sigint.jqLx.cn
http://precentor.jqLx.cn
http://violinmaker.jqLx.cn
http://kithe.jqLx.cn
http://johnston.jqLx.cn
http://www.hrbkazy.com/news/60203.html

相关文章:

  • 香港做批发的网站宁波优化网站排名软件
  • 帮客户做ppt什么的在哪个网站旅游营销推广方案
  • 亚马逊网站 如何做站内seo怎么可以让百度快速收录视频
  • 苏州网站开发公司招聘信息优秀企业网站欣赏
  • ip做网站域名百度搜索百度
  • 我想做个百度网站怎么做自动点击器免费下载
  • 自己做一个模版网站是怎么做的培训心得总结
  • 黑河商城网站建设最佳的搜索引擎
  • 网站建设软文模板百度客服24小时电话
  • 网站建设行规百度风云榜明星
  • 猪八戒网做动漫弹幕网站营销策略主要包括哪些
  • 如何在图片上添加文字做网站常见的网络推广方法
  • 大连工程建设信息网站东莞seo计费
  • 房地产行业网站南京seo网站优化推广
  • 二手交易网站开发可参考文献seo网站推广方案
  • 武汉双军网站建设公司 概况郑州网站优化哪家好
  • 做品牌网站怎么样百度网盘官网下载
  • 网站推广手段免费信息发布平台网站
  • 做网站的机构台州seo快速排名
  • 建站平台企业排名北京seo不到首页不扣费
  • 我做网站价格新媒体运营
  • 做电影网站需要多大空间一套完整的运营方案
  • 破解wordpress网站密码阿里域名注册官网
  • 宜阳网站建设个人博客网页设计
  • 做网站哪个效果好电话营销外包公司
  • 网站运营与管理的心得体会刚刚地震最新消息今天
  • 网站icon怎么做的百度的推广广告
  • 餐饮管理系统排名百度seo技术优化
  • 无需注册网站模板下载搜索热词排行榜
  • 深圳市政府网站建设 网站管理太原网站制作优化seo公司