• 伪装文件夹


    实现效果:

      

    知识运用:  

      File类的CreateText方法    //创建或打开一个文件用于写入UTF-8编码的文本

      public static StreamWriter CreateText (string path)    //f返回一个StreamWriter对象 它使用UTF-8编码写入指定文件

      StreamWriter对象的WriteLine方法  //将字符串写入文本流

      public virtual voidWriteLine (string value)

    实现代码:

            //返回对应值
            private string GetFolType()
            {
                int flage = comboBox1.SelectedIndex;
                switch (flage)
                { 
                    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}";
                }
                return @"{20D04FE0-3AEA-1069-A2D8-08002B30309D}";
            }
            //进行伪装操作
            private void Camouflage(string fpath)
            {
                if (File.Exists(fpath + "\" + @"desktop.ini"))
                    File.Delete(fpath + "\" + @"desktop.ini");
                StreamWriter sw= File.CreateText(fpath+"\"+@"desktop.ini");
                sw.WriteLine(@"[.ShellClassInfo]");
                sw.WriteLine("CLSID="+GetFolType());
                sw.Close();
                File.SetAttributes(fpath + "\" + @"desktop.ini",FileAttributes.Hidden);
                File.SetAttributes(fpath + "\" + @"desktop.ini", FileAttributes.System);
                MessageBox.Show("伪装成功","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
            }
            //还原伪装文件夹
            private void NCamouflage(string fpath)
            {
                string temp = fpath + "\" + @"desktop.ini";
                if (!File.Exists(temp))
                {
                    MessageBox.Show("该文件夹没有被伪装", "提示");
                    return;
                }
                else
                {
                    File.Delete(temp);
                    MessageBox.Show("还原成功!", "提示");
                }
            }
    

      

  • 相关阅读:
    BugkuCtf-pwn2-exp
    Python 基础知识(一)
    C++基本语法的部分总结
    Ububtu 14.04 安装 Hadoop 2.7.3
    leetcode-Evaluate the value of an arithmetic expression in Reverse Polish Notation
    leetcode-Given a binary tree, find its minimum depth
    Java 实现 AES 加解密
    git fork代码并修改胡提交到自己的git仓库
    git使用记录_备忘
    java awt 中文乱码 显示为 方块
  • 原文地址:https://www.cnblogs.com/feiyucha/p/10249399.html
Copyright © 2020-2023  润新知