Create a gist now

Instantly share code, notes, and snippets.

新生銀行に自動ログインするユーザースクリプト 2014年夏バージョン (現在の Google Chrome では動作しません。拡張機能を作成しましたので、そちらをご利用ください: https://chrome.google.com/webstore/detail/shinsei-power-direct-auto/cpkpahjljdchklimidmplhdlmgbbipna)
// ==UserScript==
// @name Shinsei Power Direct AutoFill
// @namespace http://milk1000.cc
// @include https://*.shinseibank.*/FLEXCUBEAt/LiveConnect.dll*
// @version 0.1.1
// @license MIT License
// @work Greasemonkey
// @work GreaseKit
// @work Google Chrome
// @inspired https://github.com/yoko/userscripts/blob/master/shinsei_power_direct_autofill.user.js
// ==/UserScript==
(function(d) {
/*** AT YOUR OWN RISK ***/
var account_id = '';
var account_pin = '';
var account_password = '';
var security_card_table = [
/* A B C D E F G H I J */
/* 0 */ 'x x x x x x x x x x',
/* 1 */ 'x x x x x x x x x x',
/* 2 */ 'x x x x x x x x x x',
/* 3 */ 'x x x x x x x x x x',
/* 4 */ 'x x x x x x x x x x',
];
if (document.title != 'ログインスクリーン') {
return;
}
$X('id("securitykeyboard")')[0].checked = false;
try {
var account_id_container = $X('id("main-left-account")//input')[0];
d.onload = account_id_container ?
function() { // page 1
account_id_container.value = account_id;
$X('id("main-left-pin")//input')[0].value = account_pin;
$X('id("main-left-password")//input')[0].value = account_password;
submit();
} :
function() { // page 2
var n = 3,
c,
strong = $X('id("main-left-security")//strong'),
input = $X('//input[@type="password"]');
while (c = strong[--n]) {
c = c.innerHTML;
input[n].value = security_card_table[c.charAt(1)].split(' ')[c.charCodeAt(0) - 65];
}
submit();
};
d.readyState == 'complete' && d.onload();
}
catch (e) {
alert([
'[Shinsei Power Direct AutoFill] Oops! Probably HTML has changed.',
'',
e
].join('\n'));
}
// https://gist.github.com/29681
function $X (exp, context, resolver, result_type) {
context || (context = document);
var Doc = context.ownerDocument || context;
var result = Doc.evaluate(exp, context, resolver, result_type || XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
if (result_type) return result;
for (var i = 0, len = result.snapshotLength, res = new Array(len); i < len; i++) {
res[i] = result.snapshotItem(i);
}
return res;
}
function submit() {
location.href = "javascript: window.CheckLogonInputs();";
}
})(this.unsafeWindow || document);
@extrajoker

FirefoxのGreasemonkeyが2.0になったのが原因なのか動作しなくなりました。
セキュリティキーボードのチェックは外れます。

@milk1000cc
Owner

Google Chrome 用ですが、拡張機能を作成しましたので、よろしければご利用ください。
https://chrome.google.com/webstore/detail/shinsei-power-direct-auto/cpkpahjljdchklimidmplhdlmgbbipna

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment