打码平台注册链接  https://yescaptcha.com/i/WCjhgp

接口文档  https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/24543233/HCaptchaClassification+Hcaptcha

批量注册

class test9 {
    public static void main(String[] args) throws Exception {
        System.setProperty("webdriver.chrome.driver", "D:\\chromedriver.exe");
        ChromeOptions option = new ChromeOptions();
//        option.addArguments("--proxy-server=http://" + "58.54.8.50:8888");
        option.addArguments("user-agent=" + "Mozilla/5.0 (Macintosh; Intel Mac OS X 10 11_9; rv:1.9.3.20) Gecko/2011-05-02 04:10:19 Firefox/3.8");
        option.setExperimentalOption("excludeSwitches", new String[]{"enable-automation"});

        ChromeDriver driver = new ChromeDriver(option);
//        driver.manage().window().maximize();
        String url = "https://account.proton.me/signup";
        driver.get(url);
        Thread.sleep(5000);
        /**
         * 注册
         */
        new WebDriverWait(driver, 120).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@id=\"email\"]")));

//        driver.findElement(By.xpath("//*[@id=\"email\"]"));

        Actions actions = new Actions(driver);
        actions.sendKeys(Keys.chord(Keys.LEFT_CONTROL, "xxxxxxxxxxxxxxxxxxxxxxxxxx")).build().perform();
        driver.findElement(By.id("password")).sendKeys("xxxxxxxxxxxxxxxxxxxxxxxxxx");
        driver.findElement(By.id("repeat-password")).sendKeys("xxxxxxxxxxxxxxxxxxxxxxxxxx");
//        driver.findElement(By.xpath("/html/body/div[1]/div[3]/div[1]/div/main/div[2]/form/button")).click();
        new WebDriverWait(driver, 120).until(ExpectedConditions.elementToBeClickable(By.xpath("/html/body/div[1]/div[3]/div[1]/div/main/div[2]/form/button"))).click();

        new WebDriverWait(driver, 120).until(ExpectedConditions.presenceOfElementLocated(By.xpath("/html/body/div[1]/div[3]/div/div/div/main[1]/div[2]/div[3]/button"))).click();
        new WebDriverWait(driver, 120).until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@id=\"label_0\"]"))).click();
        Thread.sleep(2000);
        /**
         * 点击加载9宫格
         */
        driver.switchTo().frame(0).switchTo().frame(0);
        new WebDriverWait(driver, 120).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@id=\"checkbox\"]"))).click();

//        driver.findElement(By.xpath("//*[@id=\"checkbox\"]")).click();
        Thread.sleep(10000);
        while (true){
            /**
             * 获取描述
             */
            driver.switchTo().defaultContent();
            driver.switchTo().frame(0).switchTo().frame(1);
            String test = new WebDriverWait(driver, 120).until(ExpectedConditions.presenceOfElementLocated(By.cssSelector(".prompt-text"))).getText();

//        String test = driver.findElement(By.cssSelector(".prompt-text")).getText();
            System.out.println(test);
            /**
             * 找到每一个图片遍历url转base64存入list集合
             */
            List<WebElement> lss = driver.findElements(By.cssSelector(".task-image .image-wrapper .image"));
            List<String> strs = new ArrayList<String>();
            for (int i = 0; i < lss.size(); i++) {
//            System.out.println(lss.get(i).getAttribute("style"));
                String ree = lss.get(i).getAttribute("style");
                String s = ree.split("\"")[1];
                strs.add(Base64Util.imageUrlToBase64(s));
            }
//        System.out.println(strs);
            /**
             * 组装json向第三方打码平台发送post请求
             */
            JSONObject data = new JSONObject();
            data.put("type", "HCaptchaClassification");
            data.put("queries", strs);
            data.put("question", test);
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("clientKey", "xxxxxxxxxxxxxxxxxxxxxxxxxx");
            jsonObject.put("task", data);
            String param = jsonObject.toJSONString();
            String s1 = null;
            for (int x = 0; x < 3; x++) {
                String urls = "https://china.yescaptcha.com/createTask";
                s1 = HttpUtils.doPostJson(urls, param);
                System.out.println(s1);
                Map<String, Object> map = JSONObject.parseObject(s1, new TypeReference<Map<String, Object>>() {
                });
                if ((Integer) map.get("errorId") != 0) {
                    continue;
                }
                Map<String, List<String>> map2 = JSONObject.parseObject(map.get("solution").toString(), new TypeReference<Map<String, List<String>>>() {
                });
                /**
                 * 获取返回的9个true,false状态,如果为true就点击
                 */
                List<String> lst = map2.get("objects");
                List<WebElement> tasklss = driver.findElements(By.cssSelector(".task-image"));
                for (int i = 0; i < tasklss.size(); i++) {
                    if (lst.get(i).equals("true")) {
                        Actions actions3 = new Actions(driver);
                        actions3.click(lss.get(i)).perform();
                    }
                }
                break;
            }
            /**
             * 点击下一次验证,并重新循环点击新的9宫格
             */
            if (driver.findElement(By.cssSelector(".button-submit.button")).getAttribute("aria-label").equals("下一个挑战")){
                driver.findElement(By.cssSelector(".button-submit.button")).click();
                continue;
            }
            /**
             * 提交答案
             */
            if (driver.findElement(By.cssSelector(".button-submit.button")).getAttribute("aria-label").equals("提交答案")){
//                driver.findElement(By.cssSelector(".button-submit.button")).click();
                new WebDriverWait(driver, 120).until(ExpectedConditions.presenceOfElementLocated(By.cssSelector(".button-submit.button"))).click();
                break;
            }
            if (driver.findElement(By.cssSelector(".error-text")).getText().equals("请再试一次")){
                Thread.sleep(3000);
                continue;
            }

        }
        //打码结束
        Thread.sleep(5000);

    }

}

class Base64Util {

    /**
     * 图片URL转Base64编码
     *
     * @param imgUrl 图片URL
     * @return Base64编码
     */
    public static String imageUrlToBase64(String imgUrl) {
        URL url = null;
        InputStream is = null;
        ByteArrayOutputStream outStream = null;
        HttpURLConnection httpUrl = null;

        try {
            url = new URL(imgUrl);
            httpUrl = (HttpURLConnection) url.openConnection();
            httpUrl.connect();
            httpUrl.getInputStream();

            is = httpUrl.getInputStream();
            outStream = new ByteArrayOutputStream();

            //创建一个Buffer字符串
            byte[] buffer = new byte[1024];
            //每次读取的字符串长度,如果为-1,代表全部读取完毕
            int len = 0;
            //使用输入流从buffer里把数据读取出来
            while ((len = is.read(buffer)) != -1) {
                //用输出流往buffer里写入数据,中间参数代表从哪个位置开始读,len代表读取的长度
                outStream.write(buffer, 0, len);
            }

            // 对字节数组Base64编码
            return encode(outStream.toByteArray());
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (is != null) {
                    is.close();
                }
                if (outStream != null) {
                    outStream.close();
                }
                if (httpUrl != null) {
                    httpUrl.disconnect();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        return null;
    }

    /**
     * 图片转字符串
     *
     * @param image 图片Buffer
     * @return Base64编码
     */
    public static String encode(byte[] image) {
        BASE64Encoder decoder = new BASE64Encoder();
        return replaceEnter(decoder.encode(image));
    }

    /**
     * 字符替换
     *
     * @param str 字符串
     * @return 替换后的字符串
     */
    public static String replaceEnter(String str) {
        String reg = "[ ]";
        Pattern p = Pattern.compile(reg);
        Matcher m = p.matcher(str);
        return m.replaceAll("");
    }


}

class HttpUtils {
      public static String doPostJson(String url, String json) {
        // 创建Httpclient对象
        SocketConfig socketConfig = SocketConfig.custom().setSoTimeout(5000).build();
        CloseableHttpClient httpClient = HttpClients.custom().setDefaultSocketConfig(socketConfig).build();

//        CloseableHttpClient httpClient = HttpClients.createDefault();
        CloseableHttpResponse response = null;
        String resultString = "";
        try {
            // 创建Http Post请求
            HttpPost httpPost = new HttpPost(url);
            // 创建请求内容
            StringEntity entity = new StringEntity(json, ContentType.APPLICATION_JSON);
            httpPost.setEntity(entity);
            // 执行http请求
            response = httpClient.execute(httpPost);
            System.out.println(response);
            resultString = EntityUtils.toString(response.getEntity(), "utf-8");
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                response.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return resultString;
    }
}




 

批量发邮件

public class test6 {
    public static void main(String[] args) throws Exception {
        System.setProperty("webdriver.chrome.driver", "D:\\chromedriver.exe");
        ChromeOptions option = new ChromeOptions();
//        option.addArguments("--proxy-server=http://" + "58.54.8.50:8888");
        option.addArguments("user-agent=" + "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0");

        ChromeDriver driver = new ChromeDriver(option);
        String url = "https://mail.proton.me/u/0/drafts";
        driver.get(url);
//        driver.findElement(By.id("keyword")).clear();
//        driver.findElement(By.id("username")).sendKeys("xxxx@protonmail.com");
        new WebDriverWait(driver, 120).until(ExpectedConditions.elementToBeClickable(By.id("username"))).sendKeys("randomkali@protonmail.com");

        driver.findElement(By.id("password")).sendKeys("xxxxxxxxxxxxxxxxxxxxx");
//        Thread.sleep(10000);
        driver.findElement(By.cssSelector(".button.button-large.button-solid-norm.w100.mt1-75")).click();
        for (int i = 1; i < 9999999; i++) {
            new WebDriverWait(driver, 120).until(ExpectedConditions.elementToBeClickable(By.cssSelector(".button.button-large.button-solid-norm.mt0-25.w100.no-mobile"))).click();
            new WebDriverWait(driver, 120).until(ExpectedConditions.elementToBeClickable(By.xpath("/html/body/div[1]/div[4]/div/div/div/div/div/div[2]/div/div/div/div/div/div"))).findElement(By.tagName("input")).sendKeys("1729529732@qq.com");

//        driver.findElement(By.xpath("/html/body/div[1]/div[4]/div/div/div/div/div/div[2]/div/div/div/div/div/div")).findElement(By.tagName("input")).sendKeys("1729529732@qq.com");
            driver.findElement(By.xpath("/html/body/div[1]/div[4]/div/div/div/div/div/div[3]/div/div")).findElement(By.tagName("input")).sendKeys("你好");
            driver.findElement(By.xpath("/html/body/div[1]/div[4]/div/div/div/div/section/div/div/div[2]/button[12]")).click();
            Actions actions = new Actions(driver);
            actions.sendKeys(Keys.chord(Keys.LEFT_CONTROL, "\u200B\u200B啊啊啊啊啊啊啊啊啊\n" +
                    "aewwwwwwwwwwwawe\n" +
                    "\n" +
                    "https://www.baidu.com\n")).build().perform();
            driver.findElement(By.cssSelector(".button.button-group-item.button-solid-norm.composer-send-button")).click();
            System.out.println("已发送" + i + "次邮件");
            Thread.sleep(1000);
        }
    }
}