本工具提供自動化輸入 Juniper SSL-VPN 網頁方式的登入資訊,如「username」與「驗證碼」欄位,減少您重複過多的文字輸入,請依實際需求稍做調整。
// ==UserScript== // @name SSL-VPN Auto Captcha // @namespace autoCaptcha // @include https://sslvpn9.twaren.net/dana-na/auth/*/welcome.cgi // ==/UserScript== // Author: Hsieh, Li-Yi // Last Modified: 2011/12/10 13:30 function auto_captcha() { var captcha_objs = null; // array => txtCaptcha var txt_input_objs = null; // array => txtInput var username_objs = null; // array => username var captcha_val = null; // store captcha value var txt_input = null; // txtInput object captcha_objs = document.getElementsByName('txtCaptcha'); txt_input_objs = document.getElementsByName('txtInput'); username_objs = document.getElementsByName('username'); // auto set txtCaptcha field if (captcha_objs.length && txt_input_objs.length) { txt_input = txt_input_objs.item(0); captcha_val = captcha_objs.item(0).value; if ((txt_input != null) && (captcha_val != null)) { txt_input.value = captcha_val; } } // auto set username field if (username_objs.length) { var text = document.body.innerHTML; text = text.replace(/<\/?[a-z][a-z0-9]*[^<>]*>/ig, ""); text = text.match(/@[a-z0-9\.]+/i); username_objs.item(0).value = text; username_objs.item(0).focus(); } } // run after page loaded function init() { if (window.attachEvent) { window.attachEvent('onload', auto_captcha); } else { window.addEventListener('load', auto_captcha, false); } } // main function init();