C#语言实例源码系列-伪装文件

news2024/10/6 12:27:45
专栏分享
  • 点击跳转=>Unity3D特效百例
  • 点击跳转=>案例项目实战源码
  • 点击跳转=>游戏脚本-辅助自动化
  • 点击跳转=>Android控件全解手册

👉关于作者

众所周知,人生是一个漫长的流程,不断克服困难,不断反思前进的过程。在这个过程中会产生很多对于人生的质疑和思考,于是我决定将自己的思考,经验和故事全部分享出来,以此寻找共鸣 !!!
专注于Android/Unity和各种游戏开发技巧,以及各种资源分享(网站、工具、素材、源码、游戏等)
有什么需要欢迎私我,交流群让学习不再孤单

在这里插入图片描述

👉实践过程

😜效果

在这里插入图片描述

😜代码

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }
    private string GetFolType()
    {
        int Tid = comboBox1.SelectedIndex;
        switch (Tid)
        {
            case 0: return @"{20D04FE0-3AEA-1069-A2D8-08002B30309D}";
            case 1: return @"{450D8FBA-AD25-11D0-98A8-0800361B1103}";
            case 2: return @"{992CFFA0-F557-101A-88EC-00DD010CCC48}";
            case 3: return @"{21EC2020-3AEA-1069-A2DD-08002B30309D}";
            case 4: return @"{D6277990-4C6A-11CF-8D87-00AA0060F5BF}";
            case 5: return @"{2227A280-3AEA-1069-A2DE-08002B30309D}";
            case 6: return @"{208D2C60-3AEA-1069-A2D7-08002B30309D}";
            case 7: return @"{645FF040-5081-101B-9F08-00AA002F954E}";
            case 8: return @"{85BBD920-42A0-1069-A2E4-08002B30309D}";
            case 9: return @"{BD84B380-8CA2-1069-AB1D-08000948F534}";
            case 10: return @"{BDEADF00-C265-11d0-BCED-00A0C90AB50F}";
        }
        return @"{20D04FE0-3AEA-1069-A2D8-08002B30309D}";
    }
    private void button1_Click(object sender, EventArgs e)
    {
        if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
        {
            if (folderBrowserDialog1.SelectedPath.Length >= 4)
            {
                txtFolPath.Text = folderBrowserDialog1.SelectedPath;
            }
            else
            {
                MessageBox.Show("不能对盘符进行伪装", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        comboBox1.SelectedIndex = 0;
    }

    private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (comboBox1.SelectedIndex == 11)
        {
            txtID.ReadOnly = false;
            txtID.Text = "";
        }
        else
        {
            txtID.ReadOnly = true;
            txtID.Text = GetFolType();
        }

    }

    private void Camouflage(string str)
    {
        StreamWriter sw = File.CreateText(txtFolPath.Text.Trim() + @"\desktop.ini");
        sw.WriteLine(@"[.ShellClassInfo]");
        sw.WriteLine("CLSID=" + str);
        sw.Close();
        File.SetAttributes(txtFolPath.Text.Trim() + @"\desktop.ini", FileAttributes.Hidden);
        File.SetAttributes(txtFolPath.Text.Trim(), FileAttributes.System);
        MessageBox.Show("伪装成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
    }

    private void button2_Click(object sender, EventArgs e)
    {
        if (this.txtFolPath.Text == "")
        {
            MessageBox.Show("请选择文件夹路径!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
        else
        {
            try
            {
                if (txtID.ReadOnly == false)
                {
                    string str = txtID.Text.Trim();
                    if (str.StartsWith("."))
                        str = str.Substring(1);
                    if (!str.StartsWith("{")||str.Trim().Length!=38)
                    {
                        MessageBox.Show("自定义类型错误!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        Camouflage(str);
                    }
                }
                else
                {
                    Camouflage(GetFolType());
                }
            }
            catch
            {
                MessageBox.Show ("不要进行多次伪装!","提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
            }
        }
    }

    private void button3_Click(object sender, EventArgs e)
    {
        if (txtFolPath.Text == "")
        {
            MessageBox.Show("请选择加密过的文件夹!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Error);
        }
        else
        {
            try
            {
                FileInfo fi = new FileInfo(txtFolPath.Text.Trim() + @"\desktop.ini");
                if (!fi.Exists)
                {
                    MessageBox.Show("该文件夹没有被伪装!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    System.Threading.Thread.Sleep(1000);
                    File.Delete(txtFolPath.Text + @"\desktop.ini");
                    File.SetAttributes(txtFolPath.Text.Trim(), FileAttributes.System);
                    MessageBox.Show("还原成功", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch
            {
                MessageBox.Show("不要多次还原!");
            }
        }
    }
}
partial class Form1
{
    /// <summary>
    /// 必需的设计器变量。
    /// </summary>
    private System.ComponentModel.IContainer components = null;

    /// <summary>
    /// 清理所有正在使用的资源。
    /// </summary>
    /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
    protected override void Dispose(bool disposing)
    {
        if (disposing && (components != null))
        {
            components.Dispose();
        }
        base.Dispose(disposing);
    }

    #region Windows 窗体设计器生成的代码

    /// <summary>
    /// 设计器支持所需的方法 - 不要
    /// 使用代码编辑器修改此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {
        this.groupBox1 = new System.Windows.Forms.GroupBox();
        this.txtFolPath = new System.Windows.Forms.TextBox();
        this.button1 = new System.Windows.Forms.Button();
        this.label1 = new System.Windows.Forms.Label();
        this.groupBox2 = new System.Windows.Forms.GroupBox();
        this.txtID = new System.Windows.Forms.TextBox();
        this.label3 = new System.Windows.Forms.Label();
        this.comboBox1 = new System.Windows.Forms.ComboBox();
        this.label2 = new System.Windows.Forms.Label();
        this.groupBox3 = new System.Windows.Forms.GroupBox();
        this.button3 = new System.Windows.Forms.Button();
        this.button2 = new System.Windows.Forms.Button();
        this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
        this.groupBox1.SuspendLayout();
        this.groupBox2.SuspendLayout();
        this.groupBox3.SuspendLayout();
        this.SuspendLayout();
        // 
        // groupBox1
        // 
        this.groupBox1.Controls.Add(this.txtFolPath);
        this.groupBox1.Controls.Add(this.button1);
        this.groupBox1.Controls.Add(this.label1);
        this.groupBox1.ForeColor = System.Drawing.Color.Black;
        this.groupBox1.Location = new System.Drawing.Point(12, 8);
        this.groupBox1.Name = "groupBox1";
        this.groupBox1.Size = new System.Drawing.Size(431, 55);
        this.groupBox1.TabIndex = 1;
        this.groupBox1.TabStop = false;
        this.groupBox1.Text = "第一步:选择文件夹";
        // 
        // txtFolPath
        // 
        this.txtFolPath.Location = new System.Drawing.Point(78, 22);
        this.txtFolPath.Name = "txtFolPath";
        this.txtFolPath.Size = new System.Drawing.Size(296, 21);
        this.txtFolPath.TabIndex = 0;
        // 
        // button1
        // 
        this.button1.Location = new System.Drawing.Point(380, 21);
        this.button1.Name = "button1";
        this.button1.Size = new System.Drawing.Size(43, 23);
        this.button1.TabIndex = 2;
        this.button1.Text = "选择";
        this.button1.UseVisualStyleBackColor = true;
        this.button1.Click += new System.EventHandler(this.button1_Click);
        // 
        // label1
        // 
        this.label1.AutoSize = true;
        this.label1.Location = new System.Drawing.Point(6, 25);
        this.label1.Name = "label1";
        this.label1.Size = new System.Drawing.Size(77, 12);
        this.label1.TabIndex = 1;
        this.label1.Text = "文件夹路径:";
        // 
        // groupBox2
        // 
        this.groupBox2.Controls.Add(this.txtID);
        this.groupBox2.Controls.Add(this.label3);
        this.groupBox2.Controls.Add(this.comboBox1);
        this.groupBox2.Controls.Add(this.label2);
        this.groupBox2.ForeColor = System.Drawing.Color.Black;
        this.groupBox2.Location = new System.Drawing.Point(12, 69);
        this.groupBox2.Name = "groupBox2";
        this.groupBox2.Size = new System.Drawing.Size(431, 99);
        this.groupBox2.TabIndex = 2;
        this.groupBox2.TabStop = false;
        this.groupBox2.Text = "第二部:选择伪装的类型";
        // 
        // txtID
        // 
        this.txtID.Location = new System.Drawing.Point(103, 57);
        this.txtID.Name = "txtID";
        this.txtID.ReadOnly = true;
        this.txtID.Size = new System.Drawing.Size(320, 21);
        this.txtID.TabIndex = 3;
        // 
        // label3
        // 
        this.label3.AutoSize = true;
        this.label3.Location = new System.Drawing.Point(20, 60);
        this.label3.Name = "label3";
        this.label3.Size = new System.Drawing.Size(77, 12);
        this.label3.TabIndex = 2;
        this.label3.Text = "自定义类型:";
        // 
        // comboBox1
        // 
        this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
        this.comboBox1.FormattingEnabled = true;
        this.comboBox1.Items.AddRange(new object[] {
        "我的电脑",
        "我的文档",
        "拨号网络",
        "控制面板",
        "计划任务",
        "打印机",
        "网络邻居",
        "回收站",
        "公文包",
        "字体",
        "Web 文件夹",
        "自定义ID"});
        this.comboBox1.Location = new System.Drawing.Point(101, 26);
        this.comboBox1.Name = "comboBox1";
        this.comboBox1.Size = new System.Drawing.Size(322, 20);
        this.comboBox1.TabIndex = 1;
        this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
        // 
        // label2
        // 
        this.label2.AutoSize = true;
        this.label2.Location = new System.Drawing.Point(8, 30);
        this.label2.Name = "label2";
        this.label2.Size = new System.Drawing.Size(89, 12);
        this.label2.TabIndex = 0;
        this.label2.Text = "选择伪装类型:";
        // 
        // groupBox3
        // 
        this.groupBox3.Controls.Add(this.button3);
        this.groupBox3.Controls.Add(this.button2);
        this.groupBox3.ForeColor = System.Drawing.Color.Black;
        this.groupBox3.Location = new System.Drawing.Point(12, 174);
        this.groupBox3.Name = "groupBox3";
        this.groupBox3.Size = new System.Drawing.Size(431, 53);
        this.groupBox3.TabIndex = 3;
        this.groupBox3.TabStop = false;
        this.groupBox3.Text = "第三部:操作";
        // 
        // button3
        // 
        this.button3.Location = new System.Drawing.Point(230, 20);
        this.button3.Name = "button3";
        this.button3.Size = new System.Drawing.Size(75, 23);
        this.button3.TabIndex = 1;
        this.button3.Text = "还原";
        this.button3.UseVisualStyleBackColor = true;
        this.button3.Click += new System.EventHandler(this.button3_Click);
        // 
        // button2
        // 
        this.button2.Location = new System.Drawing.Point(127, 20);
        this.button2.Name = "button2";
        this.button2.Size = new System.Drawing.Size(75, 23);
        this.button2.TabIndex = 0;
        this.button2.Text = "伪装";
        this.button2.UseVisualStyleBackColor = true;
        this.button2.Click += new System.EventHandler(this.button2_Click);
        // 
        // Form1
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(452, 233);
        this.Controls.Add(this.groupBox3);
        this.Controls.Add(this.groupBox2);
        this.Controls.Add(this.groupBox1);
        this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
        this.MaximizeBox = false;
        this.Name = "Form1";
        this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
        this.Text = "伪装文件夹";
        this.Load += new System.EventHandler(this.Form1_Load);
        this.groupBox1.ResumeLayout(false);
        this.groupBox1.PerformLayout();
        this.groupBox2.ResumeLayout(false);
        this.groupBox2.PerformLayout();
        this.groupBox3.ResumeLayout(false);
        this.ResumeLayout(false);

    }

    #endregion

    private System.Windows.Forms.GroupBox groupBox1;
    private System.Windows.Forms.TextBox txtFolPath;
    private System.Windows.Forms.Button button1;
    private System.Windows.Forms.Label label1;
    private System.Windows.Forms.GroupBox groupBox2;
    private System.Windows.Forms.GroupBox groupBox3;
    private System.Windows.Forms.Button button3;
    private System.Windows.Forms.Button button2;
    private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1;
    private System.Windows.Forms.ComboBox comboBox1;
    private System.Windows.Forms.Label label2;
    private System.Windows.Forms.TextBox txtID;
    private System.Windows.Forms.Label label3;
}

需要的再直接Call我,直接发。

👉其他

📢作者:小空和小芝中的小空
📢转载说明-务必注明来源:https://zhima.blog.csdn.net/
📢这位道友请留步☁️,我观你气度不凡,谈吐间隐隐有王者霸气💚,日后定有一番大作为📝!!!旁边有点赞👍收藏🌟今日传你,点了吧,未来你成功☀️,我分文不取,若不成功⚡️,也好回来找我。

温馨提示点击下方卡片获取更多意想不到的资源。
空名先生

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/114945.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Redis分布式锁存在的问题

假设有这样一个场景&#xff0c;在一个购票软件上买一张票&#xff0c;但是此时剩余票数只有一张或几张&#xff0c;这个时候有几十个人都在同时使用这个软件购票。在不考虑任何影响下&#xff0c;正常的逻辑是首先判断当前是否还有剩余的票&#xff0c;如果有&#xff0c;那么…

Spring5.3.0源码下载

目录源码下载环境配置import into idea修改配置gradle-wapper.propertiesbuild.gradleSetting Gradlerefresh Gradle写一个小dome源码研究心得源码下载 Spring5.3.0 Download Address 我们只需要下载zip就行了&#xff0c; 如果忘记了这个地址&#xff0c;可以在Spring Offici…

网络技术——网络运维工程师必会的网络知识(3)(详细讲解)

作者简介&#xff1a;一名在校云计算网络运维学生、每天分享网络运维的学习经验、和学习笔记。 座右铭&#xff1a;低头赶路&#xff0c;敬事如仪 个人主页&#xff1a;网络豆的主页​​​​​​ 目录 前言 一.网络层协议与应用 1.网络层的功能 2.IP数据包格式 3.广播与…

100天精通Python(数据分析篇)——第70天:Pandas常用排序、排名方法(sort_index、sort_values、rank)

文章目录每篇前言一、按索引排序&#xff1a;sort_index()1. Series类型排序1&#xff09;升序2&#xff09;降序2. DataFrame类型排序1&#xff09;按行索引排序2&#xff09;按列索引排序二、按值排序&#xff1a;sort_values()1. Series类型排序1&#xff09;升序2&#xff…

冻结集合:不可能增删frozenset()

【小白从小学Python、C、Java】 【计算机等级考试500强双证书】 【Python-数据分析】 冻结集合&#xff1a;不可能增删 frozenset() 选择题 对于以下python代码表述错误的一项是? a{1,2} print("【显示】a",a) a.add(3) print("【执行】a.add(3)【显示】a"…

【现代机器人学】学习笔记七:开链动力学(前向动力学Forward dynamics 与逆动力学Inverse dynamics)

这节的内容主要讲述机器人动力学的内容。相对于本书其他部分运动学内容相比&#xff0c;把动力学一下子合成了一章。看完以后有三个感受&#xff1a; 1.本章难度相对其他章节较大&#xff0c;因此需要反复去看&#xff0c;以求对重要内容的眼熟&#xff0c;不求全部记住&#…

Java window多环境配置

目录JDK版本下载配置内容描述创建JAVA_HOME在Path配置版本切换效果JDK版本下载 Java8 Download address 这个是Java8 的下载地址&#xff0c;下载是要登录的&#xff0c;自己花费一点时间去注册。如果想要下载其它版本的JDK&#xff0c;请看下面的图&#xff0c;然后你就可以看…

QT数据库-网络编程-打包

目录 一、讲解之前 二、数据库基本操作 三、模糊查询 二、编程之前 三、通信结构 一、设置应用图标&#xff08;熟悉&#xff09; 二、Debug和Release模式&#xff08;掌握&#xff09; 三、动态链接库&#xff08;掌握&#xff09; 四、打包&#xff08;熟悉&#xff09; 一、…

FastDDS(10)Transport Layer传输层

传输层在DDS实体之间提供通信服务,负责通过物理传输实际发送和接收消息。DDS层将此服务用于用户数据和发现流量通信。然而,DDS层本身是独立于传输的,它定义了一个传输API,可以运行在实现该API的任何传输插件上。这样,它就不局限于特定的传输,应用程序可以选择最适合其需求…

公众号开发(4) —— 使用Senparc.Weixin SDK进行模板消息推送

微信公众号支持推送模板消息给特定用户&#xff0c;只要获取到公众号用户的openid向微信提供的接口发送post请求即可向特定用户推送模板消息&#xff0c;以下记录简单记录使用Senparc.Weixin SDK进行模板消息推送的过程。 1 模板消息建立 在微信公众号测试账号中添加如下消息…

数据结构之排序【冒泡排序和快速排序之一的实现及分析】内含动态演示图

引言&#xff1a; 今天分享一下一点小事迹&#xff0c;自从从学校回到家里&#xff0c;我已经好久没睡上一个好觉了&#xff0c;因为真的冷&#xff0c;莫名被窝总是感觉很冷&#xff0c;然后穿着袜袜的脚也是冰凉&#xff0c;所以每次早晨要起床的时候总是感觉非常的冷&#…

shell基础使用

一、hello world 首先建立一个tmux vim test.sh //再创建一个test.sh文件 进入文件后&#xff0c;创建一个如下命令&#xff0c;指明bash为脚本解释器 #! /bin/bash //相当与c头文件echo "hello world"运行方式 1.作为可执行文件 acs9e0ebfcd82d7:~$ chmod x test.s…

我是如何将2千万StackOverflow问答翻译成中文的?

大家好&#xff01;大家觉得如果需要翻译SO上全部问答可以怎么做呢&#xff1f;我讲讲我是怎么的&#xff0c;大家看看做得怎么样。 自我介绍 我是一名有10年开发经验的老程序员。做过大数据&#xff0c;做过Java程序员&#xff0c;也做过算法工程师&#xff0c;目前是一名大厂…

Spring Security的项目中集成JWT Token令牌安全访问后台API

Spring Security的项目中集成JWT Token令牌安全访问后台API引言JWT 简介jwt token 的适用场景jwt 的结构完整jwtjwt 的使用方式客户端获取jwt令牌访问受保护资源的具体流程Spring Security 安全框架下使用jwt token新建一个spring boot项目加入spring security 和 jwt 相关依赖…

五、传输层(二)UDP

目录 2.1 UDP概述 2.2 UDP的首部格式 2.3 UDP校验 2.1 UDP概述 UDP无须建立连接。因此不会引入建立连接的时延。 UDP为无连接状态。因此当服务器使用UDP时&#xff0c;一般能支持更多的活动客户机。 UDP分组首部仅有8B的开销&#xff0c;而TCP有20B的首部开销。 应用层…

后端思维篇:如何抽个上报模板

前言 大家好&#xff0c;我是田螺。 我的后端思维专栏好久没更新啦&#xff0c;本文是后端思维专栏的第六篇哈。我的整个后端思维专栏都是跟日常工作相关的哈。 最近刚好优化了安全上报这块的代码&#xff0c;抽了一个基础模板&#xff0c;看起来挺优雅的。所以今天手把手教…

〖产品思维训练白宝书 - 产品思维认知篇⑤〗- 学习 [产品思维] 需要做哪些准备?

大家好&#xff0c;我是 哈士奇 &#xff0c;一位工作了十年的"技术混子"&#xff0c; 致力于为开发者赋能的UP主, 目前正在运营着 TFS_CLUB社区。 &#x1f4ac; 人生格言&#xff1a;优于别人,并不高贵,真正的高贵应该是优于过去的自己。&#x1f4ac; &#x1f4e…

php wampserver的使用配置

php wampserver的使用配置wampserver1.php时区配置2.修改apache服务器端口号3.设置起始页4.设置web服务器主目录5.设置虚拟目录wampserver WampServer是Windows Apache Mysql PHP集成安装环境&#xff0c;在Windows操作系统下的apache、php和mysql的服务器软件。 1.php时区配…

RabbitMQ 第二天 高级 7 RabbitMQ 高级特性 7.2 Consumer Ack

RabbitMQ 【黑马程序员RabbitMQ全套教程&#xff0c;rabbitmq消息中间件到实战】 文章目录RabbitMQ第二天 高级7 RabbitMQ 高级特性7.2 Consumer Ack7.2.1 Consumer Ack7.2.2 Consumer Ack 小结7.2.3 消息可靠性总结第二天 高级 7 RabbitMQ 高级特性 7.2 Consumer Ack 7.2.…

12.25日周报

周报 代码行数&#xff1a; 周一 704 周二 481 周三 571 周四 589 周五 595 周六 520 周日 537 遇到的问题&#xff1a; 没用过的方法AtomicInteger Insert Proto currentTimeMillis RequestParam BufferedReader UriComponents RestTemplate OSS 不清楚在…