コード例 #1
0
ファイル: Form1.cs プロジェクト: linktag/BTCOnlineBot
        public Form1(string[] args)
        {
            InitializeComponent();

            worker                     = new BackgroundWorker();
            worker.DoWork             += new DoWorkEventHandler(worker_DoWork);
            worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);

            CaptchaInterpreter.AllowGlobalDegugMessages();
            CaptchaInterpreter.OnGlobalBitmapMessage += new CaptchaInterpreter.BitmapMessageHandler(CaptchaInterpreter_OnGlobalBitmapMessage);

            if (args.Length > 0)
            {
                try
                {
                    Script = File.ReadAllText(args[0]);
                    Directory.SetCurrentDirectory(new FileInfo(args[0]).DirectoryName);

                    if (args[0].Contains("\\"))
                    {
                        textBox1.Text = args[0].Substring(args[0].LastIndexOf("\\") + 1);
                    }
                    else
                    {
                        textBox1.Text = "Script Loaded";
                    }
                }
                catch
                {
                    MessageBox.Show("Could not load script!", "CBL GUI", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
コード例 #2
0
        void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            StartArgs          go  = (StartArgs)e.Argument;
            CaptchaInterpreter run = new CaptchaInterpreter(go.Program, go.Image);

            e.Result = run.Execute();
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: linktag/BTCOnlineBot
 void CaptchaInterpreter_OnGlobalBitmapMessage(Bitmap image)
 {
     try
     {
         pictureBox1.Image = CaptchaInterpreter.MergeVertical(StartImage, image);
     }
     catch (InvalidOperationException)
     {
         pictureBox1.Image = null;
     }
 }
コード例 #4
0
ファイル: Form1.cs プロジェクト: linktag/BTCOnlineBot
 void worker_DoWork(object sender, DoWorkEventArgs e)
 {
     try
     {
         StartArgs          go  = (StartArgs)e.Argument;
         CaptchaInterpreter run = new CaptchaInterpreter(go.Program, go.Image);
         e.Result = run.Execute();
     }
     catch (Exception ex)
     {
         e.Result = ex.Message;
     }
 }
コード例 #5
0
        public Form1()
        {
            InitializeComponent();

            image = null;

            worker                     = new BackgroundWorker();
            worker.DoWork             += new DoWorkEventHandler(worker_DoWork);
            worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);

            CaptchaInterpreter.AllowGlobalDegugMessages();
            CaptchaInterpreter.OnGlobalBitmapMessage += new CaptchaInterpreter.BitmapMessageHandler(CaptchaInterpreter_OnGlobalBitmapMessage);
            CaptchaInterpreter.OnError += new CaptchaInterpreter.ErrorNotificationHandler(CaptchaInterpreter_OnError);
            CaptchaInterpreter.OnInfo  += new CaptchaInterpreter.InformationMessageHandler(CaptchaInterpreter_OnInfo);
        }
コード例 #6
0
        static void Main(string[] args)
        {
            if (args.Length == 2)
            {
                // SCRIPT RUN
                if (args[0].ToUpper() == "-S")
                {
                    if (File.Exists(args[1]))
                    {
                        string program = File.ReadAllText(args[1]);
                        Directory.SetCurrentDirectory(new FileInfo(args[1]).DirectoryName);
                        CaptchaInterpreter run = new CaptchaInterpreter(program);
                        run.Execute();
                    }
                    else
                    {
                        Console.WriteLine("The file you specified does not exist!");
                        Console.ReadKey();
                    }
                }
                //// COMPILE
                //else if (args[0].ToUpper() == "-C")
                //{
                //    if (File.Exists(args[1]))
                //    {
                //        string program = File.ReadAllText(args[1]);

                //        if (program.ToUpper().Contains("%IMAGE%"))
                //        {
                //            byte[] code = CompileScript(program);


                //        }
                //        else
                //        {
                //            Console.WriteLine("Compiled CAPTCHA Breaker scripts must contain a \"Solve, %IMAGE%\" command.");
                //            Console.ReadKey();
                //        }
                //    }
                //    else
                //    {
                //        Console.WriteLine("The file you specified does not exist!");
                //        Console.ReadKey();
                //    }
                //}
            }
            else if (args.Length == 4)
            {
                // SCRIPT RUN - WITH IMAGE
                if (args[0].ToUpper() == "-S" && args[2].ToUpper() == "-I")
                {
                    if (File.Exists(args[1]))
                    {
                        if (File.Exists(args[3]))
                        {
                            string program = File.ReadAllText(args[1]);
                            Directory.SetCurrentDirectory(new FileInfo(args[1]).DirectoryName);
                            CaptchaInterpreter run = new CaptchaInterpreter(program, new Bitmap(args[3]));
                            run.Execute();
                        }
                        else
                        {
                            Console.WriteLine("The image you specified does not exist!");
                            Console.ReadKey();
                        }
                    }
                    else
                    {
                        Console.WriteLine("The file you specified does not exist!");
                        try
                        {
                            Console.Read();
                        }
                        catch
                        {
                            Console.ReadKey();
                        }
                    }
                }
            }
            else
            {
                Console.WriteLine("You must specify a captcha breaking script to run!");
                Console.ReadKey();
            }
        }
コード例 #7
0
 static void Main(string[] args)
 {
     if (args.Length == 2)
     {
         // SCRIPT RUN
         if (args[0].ToUpper() == "-S")
         {
             if (File.Exists(args[1]))
             {
                 string program = File.ReadAllText(args[1]);
                 Directory.SetCurrentDirectory(new FileInfo(args[1]).DirectoryName);
                 CaptchaInterpreter run = new CaptchaInterpreter(program);
                 run.Execute();
             }
             else
             {
                 Console.WriteLine("The file you specified does not exist!");
                 Console.ReadKey();
             }
         }
     }
     else if (args.Length == 3)
     {
         // SCRIPT RUN - Training Mode
         if (args[0].ToUpper() == "-S" && args[2].ToUpper() == "-T")
         {
             if (File.Exists(args[1]))
             {
                 string program = File.ReadAllText(args[1]);
                 Directory.SetCurrentDirectory(new FileInfo(args[1]).DirectoryName);
                 CaptchaInterpreter run = new CaptchaInterpreter(program, true);
                 run.Execute();
             }
             else
             {
                 Console.WriteLine("The file you specified does not exist!");
                 try
                 {
                     Console.Read();
                 }
                 catch
                 {
                     Console.ReadKey();
                 }
             }
         }
     }
     else if (args.Length == 4)
     {
         // SCRIPT RUN - WITH IMAGE
         if (args[0].ToUpper() == "-S" && args[2].ToUpper() == "-I")
         {
             if (File.Exists(args[1]))
             {
                 if (File.Exists(args[3]))
                 {
                     string program = File.ReadAllText(args[1]);
                     Directory.SetCurrentDirectory(new FileInfo(args[1]).DirectoryName);
                     CaptchaInterpreter run = new CaptchaInterpreter(program, new Bitmap(args[3]));
                     run.Execute();
                 }
                 else
                 {
                     Console.WriteLine("The image you specified does not exist!");
                     Console.ReadKey();
                 }
             }
             else
             {
                 Console.WriteLine("The file you specified does not exist!");
                 try
                 {
                     Console.Read();
                 }
                 catch
                 {
                     Console.ReadKey();
                 }
             }
         }
     }
     else
     {
         Console.WriteLine("CAPTCHA Breaking Scripting Language Interpreter");
         Console.WriteLine("https" + "://github.com/skotz/captcha-breaking-library");
         Console.WriteLine();
         Console.WriteLine("Usage:");
         Console.WriteLine("    Execute a script:");
         Console.WriteLine("        cbli.exe -s <scriptFile.captcha>");
         Console.WriteLine("    Execute a script in training mode:");
         Console.WriteLine("        cbli.exe -s <scriptFile.captcha> -t");
         Console.WriteLine("    Execute a script and pass an image to solve:");
         Console.WriteLine("        cbli.exe -s <scriptFile.captcha> -i <imageToSolve.bmp>");
         Console.WriteLine();
         Console.ReadKey();
     }
 }