public static void run() { // get access token from: http://www.imagetyperz.com string token = Config.TOKEN; ImageTypersAPI i = new ImageTypersAPI(token); // balance string balance = i.account_balance(); Console.WriteLine(string.Format("Balance: {0}", balance)); Dictionary <string, string> d = new Dictionary <string, string>(); d.Add("page_url", "https://your-site.com"); d.Add("sitekey", "Fme6hZLjuCRMMC3uh15F52D3uNms5c"); //d.Add("proxy", "126.45.34.53:123"); // or with auth 126.45.34.53:123:user:pass - optional //d.Add("user_agent", "Your user agent"); // optional string captcha_id = i.submit_capy(d); Console.WriteLine("Waiting for captcha to be solved..."); Dictionary <string, string> response = null; while (response == null) { System.Threading.Thread.Sleep(10000); // sleep for 10 secons before checking for response response = i.retrieve_response(captcha_id); } ImageTypers.Utils.print_response(response); }
/// <summary> /// Private _run method /// </summary> private void _run() { var a = this._arguments; // for easier use local ImageTypersAPI i; var token = a.get_token(); if (string.IsNullOrWhiteSpace(token)) { throw new Exception("token is missing"); } i = new ImageTypersAPI(token); switch (a.get_mode()) { case "get_balance": string balance = i.account_balance(); this.show_output(balance); // show balance break; case "submit_image": // solve normal captcha string captcha_file = a.get_captcha_file(); if (string.IsNullOrWhiteSpace(captcha_file)) { throw new Exception("Invalid captcha file"); } // optional params Dictionary <string, string> id = new Dictionary <string, string>(); // optional if (a.is_case_sensitive()) { id.Add("iscase", "true"); } if (a.get_is_phrase()) { id.Add("isphrase", "true"); } if (a.get_is_math()) { id.Add("ismath", "true"); } if (a.get_alpha_numeric() != -1) { id.Add("alphanumeric", a.get_alpha_numeric().ToString()); } if (a.get_min_length() != -1) { id.Add("minlength", a.get_min_length().ToString()); } if (a.get_max_length() != -1) { id.Add("maxlength", a.get_max_length().ToString()); } string captcha_id = i.submit_image(captcha_file, id); this.show_output(captcha_id); break; case "submit_recaptcha": string page_url = a.get_page_url(); string site_key = a.get_site_key(); if (string.IsNullOrWhiteSpace(page_url)) { throw new Exception("Invalid pageurl"); } if (string.IsNullOrWhiteSpace(site_key)) { throw new Exception("Invalid sitekey"); } Dictionary <string, string> d = new Dictionary <string, string>(); d.Add("page_url", page_url); d.Add("sitekey", site_key); // optional if (!string.IsNullOrWhiteSpace(a.get_type())) { d.Add("type", a.get_type()); } if (!string.IsNullOrWhiteSpace(a.get_v3_action())) { d.Add("v3_action", a.get_v3_action()); } if (!string.IsNullOrWhiteSpace(a.get_v3_score())) { d.Add("v3_min_score", a.get_v3_score()); } if (!string.IsNullOrWhiteSpace(a.get_user_agent())) { d.Add("user_agent", a.get_user_agent()); } if (!string.IsNullOrWhiteSpace(a.get_datas())) { d.Add("data-s", a.get_datas()); } if (!string.IsNullOrWhiteSpace(a.get_cookie_input())) { d.Add("cookie_input", a.get_cookie_input()); } if (!string.IsNullOrWhiteSpace(a.get_proxy())) { d.Add("proxy", a.get_proxy()); } if (!string.IsNullOrWhiteSpace(a.get_user_agent())) { d.Add("user_agent", a.get_user_agent()); } string cid = i.submit_recaptcha(d); this.show_output(cid); break; case "submit_hcaptcha": string page_urlh = a.get_page_url(); string site_keyh = a.get_site_key(); if (string.IsNullOrWhiteSpace(page_urlh)) { throw new Exception("Invalid pageurl"); } if (string.IsNullOrWhiteSpace(site_keyh)) { throw new Exception("Invalid sitekey"); } Dictionary <string, string> dh = new Dictionary <string, string>(); if (!string.IsNullOrWhiteSpace(a.get_proxy())) { dh.Add("proxy", a.get_proxy()); } if (!string.IsNullOrWhiteSpace(a.get_user_agent())) { dh.Add("user_agent", a.get_user_agent()); } if (a.get_invisible_hcaptcha()) { dh.Add("invisible", "1"); } dh.Add("page_url", page_urlh); dh.Add("sitekey", site_keyh); string hcaptcha_id_sub = i.submit_hcaptcha(dh); this.show_output(hcaptcha_id_sub); break; case "submit_capy": string page_urlc = a.get_page_url(); string site_keyc = a.get_site_key(); if (string.IsNullOrWhiteSpace(page_urlc)) { throw new Exception("Invalid pageurl"); } if (string.IsNullOrWhiteSpace(site_keyc)) { throw new Exception("Invalid sitekey"); } Dictionary <string, string> dc = new Dictionary <string, string>(); if (!string.IsNullOrWhiteSpace(a.get_proxy())) { dc.Add("proxy", a.get_proxy()); } if (!string.IsNullOrWhiteSpace(a.get_user_agent())) { dc.Add("user_agent", a.get_user_agent()); } dc.Add("page_url", page_urlc); dc.Add("sitekey", site_keyc); string capy_id_sub = i.submit_capy(dc); this.show_output(capy_id_sub); break; case "submit_geetest": string gt_domain = a.get_gt_domain(); string gt_challenge = a.get_gt_challenge(); string gt_gt = a.get_gt_gt(); if (string.IsNullOrWhiteSpace(gt_domain)) { throw new Exception("Invalid domain"); } if (string.IsNullOrWhiteSpace(gt_challenge)) { throw new Exception("Invalid challenge"); } if (string.IsNullOrWhiteSpace(gt_gt)) { throw new Exception("Invalid gt"); } Dictionary <string, string> dg = new Dictionary <string, string>(); dg.Add("domain", gt_domain); dg.Add("challenge", gt_challenge); dg.Add("gt", gt_gt); // optional if (!string.IsNullOrWhiteSpace(a.get_proxy())) { dg.Add("proxy", a.get_proxy()); } if (!string.IsNullOrWhiteSpace(a.get_user_agent())) { dg.Add("user_agent", a.get_user_agent()); } string geetest_id_sub = i.submit_geetest(dg); this.show_output(geetest_id_sub); break; case "submit_geetest_v4": string gt_v4_domain = a.get_gt_domain(); string gt_v4_geetestid = a.get_gt_geetestid(); if (string.IsNullOrWhiteSpace(gt_v4_domain)) { throw new Exception("Invalid domain"); } if (string.IsNullOrWhiteSpace(gt_v4_geetestid)) { throw new Exception("Invalid geetestid"); } Dictionary <string, string> dg4 = new Dictionary <string, string>(); dg4.Add("domain", gt_v4_domain); dg4.Add("geetestid", gt_v4_geetestid); // optional if (!string.IsNullOrWhiteSpace(a.get_proxy())) { dg4.Add("proxy", a.get_proxy()); } if (!string.IsNullOrWhiteSpace(a.get_user_agent())) { dg4.Add("user_agent", a.get_user_agent()); } string geetest_v4_id_sub = i.submit_geetest_v4(dg4); this.show_output(geetest_v4_id_sub); break; case "submit_tiktok": string page_urlt = a.get_page_url(); string cookie_input = a.get_cookie_input(); if (string.IsNullOrWhiteSpace(page_urlt)) { throw new Exception("Invalid pageurl"); } if (string.IsNullOrWhiteSpace(cookie_input)) { throw new Exception("Invalid cookie_input"); } Dictionary <string, string> dcc = new Dictionary <string, string>(); if (!string.IsNullOrWhiteSpace(a.get_proxy())) { dcc.Add("proxy", a.get_proxy()); } if (!string.IsNullOrWhiteSpace(a.get_user_agent())) { dcc.Add("user_agent", a.get_user_agent()); } dcc.Add("page_url", page_urlt); dcc.Add("cookie_input", cookie_input); string tiktok_id = i.submit_tiktok(dcc); this.show_output(tiktok_id); break; case "submit_funcaptcha": string page_urlfc = a.get_page_url(); string site_keyfc = a.get_site_key(); if (string.IsNullOrWhiteSpace(page_urlfc)) { throw new Exception("Invalid pageurl"); } if (string.IsNullOrWhiteSpace(site_keyfc)) { throw new Exception("Invalid sitekey"); } Dictionary <string, string> dcf = new Dictionary <string, string>(); dcf.Add("page_url", page_urlfc); dcf.Add("sitekey", site_keyfc); // others if (!string.IsNullOrWhiteSpace(a.get_s_url())) { dcf.Add("s_url", a.get_s_url()); } if (!string.IsNullOrWhiteSpace(a.get_data())) { dcf.Add("data", a.get_data()); } if (!string.IsNullOrWhiteSpace(a.get_proxy())) { dcf.Add("proxy", a.get_proxy()); } if (!string.IsNullOrWhiteSpace(a.get_user_agent())) { dcf.Add("user_agent", a.get_user_agent()); } string funcaptcha_id = i.submit_funcaptcha(dcf); this.show_output(funcaptcha_id); break; case "retrieve_response": string kid = a.get_captcha_id(); if (string.IsNullOrWhiteSpace(kid)) { throw new Exception("id is invalid"); } var recaptcha_response = i.retrieve_response(kid); // get recaptcha response this.show_output(recaptcha_response); // show response break; case "set_captcha_bad": string bad_id = a.get_captcha_id(); if (string.IsNullOrWhiteSpace(bad_id)) { throw new Exception("id is invalid"); } string response = i.set_captcha_bad(bad_id); // set it bad this.show_output(response); // show response break; default: throw new Exception("invalid mode"); } }