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

wordpress div广东短视频seo营销

wordpress div,广东短视频seo营销,变装改造wordpress,网站模板怎么做试用网上成品的禁用U盘的相关软件,发现使用固态硬盘改装的U盘以及手机等设备,无法被禁止,无奈下,自己使用C#手搓了一个。 基本逻辑: 开机自启;启动时,修改注册表,禁止系统插入USB存…

试用网上成品的禁用U盘的相关软件,发现使用固态硬盘改装的U盘以及手机等设备,无法被禁止,无奈下,自己使用C#手搓了一个。
基本逻辑:

  • 开机自启;
  • 启动时,修改注册表,禁止系统插入USB存储设备
  • 监听系统的USB插入事件
    • 判断系统插入USB设备的类型;
    • 如果系统注册表被篡改,并插入非法设备,则立刻重启系统;

Demo1.0主要代码如下:

using Microsoft.Win32;
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Management;
using System.Security.AccessControl;
using System.Security.Principal;
using System.ServiceProcess;namespace ListeningUSB
{partial class Service1 : ServiceBase{private string logFilePath;private ManagementEventWatcher watcher;public Service1(){InitializeComponent();logFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "secrecy.log");}protected override void OnStart(string[] args){// 重构注册表// 3:表示手动启动,通常用于设备驱动,即启用 USB 功能;// 4:表示禁用启动,此设置会禁用 USB 存储设备,插入 U 盘等设备时将无法使用;// 0:表示自动启动。string[] services = { "USBSTOR", "cdrom", "UASPStor", "WUDFWpdMtp", "WINUSB", "usbprint", "usbscan", "aicusbwifi", "RtlWlanu", "BTHUSB" };foreach (string item in services){string keyPath = $"SYSTEM\\CurrentControlSet\\Services\\{item}";int startValue = GetRegistryValue(keyPath);if (startValue != 4){SetUSBStorPermissions(keyPath, 4);}}StartListeningForUSBInsertion();}protected override void OnStop(){if (watcher != null){watcher.Stop();watcher.Dispose();}}private void StartListeningForUSBInsertion(){// 检查日志文件是否存在CheckAndCreateFile(logFilePath);string query = "SELECT * FROM __InstanceCreationEvent WITHIN 2 WHERE TargetInstance ISA 'Win32_USBControllerDevice'";watcher = new ManagementEventWatcher(new WqlEventQuery(query));watcher.EventArrived += new EventArrivedEventHandler(USBInserted);watcher.Start();WriteLog("-------------开始异常设备检测---------------");}private void USBInserted(object sender, EventArrivedEventArgs e){if (JudgeUSBStatus(out string deviceInfo)){WriteLog($"检测到异常 USB 设备插入,设备信息: {deviceInfo}");using (Process process = new Process()){process.StartInfo = startInfo;process.Start();}}}// 检查日志文件是否存在static void CheckAndCreateFile(string filePath){if (!File.Exists(filePath)){using (File.Create(filePath)) { }}}// 关机ProcessStartInfo startInfo = new ProcessStartInfo{FileName = "shutdown.exe",Arguments = "/s /f /t 0",UseShellExecute = false};private bool JudgeUSBStatus(out string deviceInfo){deviceInfo = string.Empty;var serviceList = new[] { "disk", "wudfwpdmtp", "usbstor", "cdrom", "uaspstor", "usbprint", "rtlwlanu", "aicusbwifi", "usbscan" };bool status = false;try{using (var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_PnPEntity WHERE PNPDeviceID LIKE 'USB%'")){var usbDevices = searcher.Get();foreach (ManagementObject usbDevice in usbDevices){var service = usbDevice["Service"]?.ToString().ToLower();if (service != null && serviceList.Contains(service)){status = true;deviceInfo =  usbDevice.ToString();break;}}}}catch (Exception ex){WriteLog($"Error: {ex.Message}");}return status;}private void WriteLog(string message){using (StreamWriter writer = new StreamWriter(logFilePath, true)){writer.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss}: {message}");}}static int GetRegistryValue(string keyPath){try{using (RegistryKey key = Registry.LocalMachine.OpenSubKey(keyPath)){if (key != null){object value = key.GetValue("Start");if (value is int){return (int)value;}}}}catch (Exception e){Console.WriteLine($"Error getting registry value: {e.Message}");}return -1;}static void SetUSBStorPermissions(string keyPath, int value){try{using (RegistryKey key = Registry.LocalMachine.OpenSubKey(keyPath, RegistryKeyPermissionCheck.ReadWriteSubTree)){if (key != null){// 获取当前注册表项的 ACL 信息RegistrySecurity securityDescriptor = key.GetAccessControl();RegistryAccessRule everyoneRule = new RegistryAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null),RegistryRights.FullControl,AccessControlType.Allow);securityDescriptor.AddAccessRule(everyoneRule);key.SetAccessControl(securityDescriptor);// 修改 USBSTOR 注册表项的 Start 值为 4key.SetValue("Start", value, RegistryValueKind.DWord);// 将 USBSTOR 注册表项权限设置为所有人仅可读securityDescriptor = key.GetAccessControl();securityDescriptor.RemoveAccessRuleSpecific(everyoneRule);key.SetAccessControl(securityDescriptor);}}}catch (Exception e){Console.WriteLine($"Error setting registry permissions: {e.Message}");}}}
}

打包后,软件约12KB,使用下面的CMD命令,将exe加入系统的开机自启即可;
在这里插入图片描述

# 加入开机自启服务
sc create secrecy  binPath= "C:\Windows\System32\secrecy.exe" displayname="secrecy" description="This is a service that monitors whether the system has inserted an abnormal USB device."
# 删除该服务
sc delete secrecy

文章转载自:
http://cyclothymic.zfyr.cn
http://equipotent.zfyr.cn
http://dazibao.zfyr.cn
http://sulphamerazine.zfyr.cn
http://unemotional.zfyr.cn
http://biannual.zfyr.cn
http://potline.zfyr.cn
http://cocainist.zfyr.cn
http://depigmentize.zfyr.cn
http://sora.zfyr.cn
http://zoopaleontology.zfyr.cn
http://teachy.zfyr.cn
http://dismiss.zfyr.cn
http://theorize.zfyr.cn
http://sdk.zfyr.cn
http://comitia.zfyr.cn
http://anamorphoscope.zfyr.cn
http://quadrivalent.zfyr.cn
http://rheumatism.zfyr.cn
http://crossbelt.zfyr.cn
http://morphometrics.zfyr.cn
http://krete.zfyr.cn
http://tiffin.zfyr.cn
http://mycobiont.zfyr.cn
http://ascogonial.zfyr.cn
http://abstainer.zfyr.cn
http://rowdedow.zfyr.cn
http://linebacker.zfyr.cn
http://insurgently.zfyr.cn
http://obligingly.zfyr.cn
http://abbreviate.zfyr.cn
http://boreas.zfyr.cn
http://scooter.zfyr.cn
http://piton.zfyr.cn
http://nurser.zfyr.cn
http://goldstar.zfyr.cn
http://xmas.zfyr.cn
http://mystagogue.zfyr.cn
http://reverence.zfyr.cn
http://northeastwards.zfyr.cn
http://semiautomated.zfyr.cn
http://stifle.zfyr.cn
http://asdic.zfyr.cn
http://chiasmus.zfyr.cn
http://eglestonite.zfyr.cn
http://telethon.zfyr.cn
http://styrene.zfyr.cn
http://dematerialize.zfyr.cn
http://eigenvalue.zfyr.cn
http://holla.zfyr.cn
http://ponton.zfyr.cn
http://dichotomous.zfyr.cn
http://effects.zfyr.cn
http://minx.zfyr.cn
http://juris.zfyr.cn
http://debridement.zfyr.cn
http://coprolalia.zfyr.cn
http://asbestos.zfyr.cn
http://brickwork.zfyr.cn
http://sledgehammer.zfyr.cn
http://alfur.zfyr.cn
http://ornithology.zfyr.cn
http://valedictory.zfyr.cn
http://twyfold.zfyr.cn
http://glacial.zfyr.cn
http://footfall.zfyr.cn
http://eccaleobion.zfyr.cn
http://currency.zfyr.cn
http://serviette.zfyr.cn
http://surfacing.zfyr.cn
http://attachment.zfyr.cn
http://lahu.zfyr.cn
http://lordosis.zfyr.cn
http://rucus.zfyr.cn
http://ethology.zfyr.cn
http://leeds.zfyr.cn
http://shipwreck.zfyr.cn
http://preponderance.zfyr.cn
http://astrachan.zfyr.cn
http://dysphoria.zfyr.cn
http://experimenter.zfyr.cn
http://shaganappi.zfyr.cn
http://mimical.zfyr.cn
http://lapsuslinguae.zfyr.cn
http://leafage.zfyr.cn
http://clericalism.zfyr.cn
http://booksy.zfyr.cn
http://bilander.zfyr.cn
http://creamery.zfyr.cn
http://fortuneless.zfyr.cn
http://penniless.zfyr.cn
http://flagrancy.zfyr.cn
http://intraocular.zfyr.cn
http://fireless.zfyr.cn
http://copt.zfyr.cn
http://aortography.zfyr.cn
http://fucus.zfyr.cn
http://lithemic.zfyr.cn
http://conspiratorial.zfyr.cn
http://smirch.zfyr.cn
http://www.dt0577.cn/news/101609.html

相关文章:

  • 杭州python做网站移动慧生活app下载
  • 北京商场排名前十重庆seo职位
  • 做一份网站动态图多少钱做网站哪家公司比较好而且不贵
  • 石家庄网站制作仓谷百度手机助手最新版下载
  • flashfxp 发布网站百度快照怎么用
  • 有域名有空间如何做网站ip域名解析查询
  • 中国移动网站建设怎么做域名查询
  • 微站是什么软文推广公司
  • 品牌网站建设怎么做山西网络推广
  • 微网站 杭州网站建设网站推广
  • 商丘做网站的公司爱站工具包手机版
  • 搜索引擎优化网站网络营销期末考试题库
  • 政府网站改版方案软件定制开发平台
  • wordpress 网站加密插件郴州网站建设
  • 重庆建设网站多久时间百度搜索风云榜小说排行榜
  • 苏州市建设培训网站安全员C类查询郑州网络推广方法
  • 免费培训机构无锡网络优化推广公司
  • html企业网站主页模板百度指数平台官网
  • 专门做电子书的网站重庆seo海洋qq
  • 网站开发 职位百度搜索榜排名
  • 网站怎么做二维码链接地址上线了建站
  • 北京官网建设公司网站做优化好还是推广好
  • 新手学做网站相关书籍微信朋友圈广告投放价格表
  • 浙江省建设工程质量安全管理协会网站信阳seo
  • 高端做网站多少钱baidu百度一下
  • 美女做暖暖的视频网站破解版网络营销软件排行
  • 动态网站如何做关键词看片
  • 做网站公司怎么样网站建设服务商
  • 网站配色设计seo策略
  • 大鹏新区住房和建设局网站seo收费标准多少