Есть ли способ программно войти на веб-сайт, например, в банк, где для пароля используется виртуальная клавиатура?
Я обнаружил, что мне нужно использовать OCR, чтобы прочитать изображение с клавиатуры. Это единственное решение?
И если это так, для чего я могу использовать OCR?
Как называется этот метод входа?
Я знаю, что он используется в целях безопасности, и это не должно быть легко для выполнения того, что я хочу и т.д. … Но это то, что я хотел, и некоторые коммерческие инструменты могут сделать это.
Спасибо
There is a way to login programatically to website like bank which use a virtual keybord for the password ?
— да. если вам повезет, у них есть API для этого. в противном случае, вы должны сделать все pretend to be a human logging in
вещь, которая часто намного сложнее.
I found that i have to use an OCR to read the keyboard image(s). Its is the only solution ?
— по моему опыту, нет. теоретически, только сервер может знать значение нажатых координат, что делает необходимым поведение, аналогичное OCR, но в каждом случае, который я проверял, сервер сообщал клиенту (браузеру или игре) значение каждой кнопки, убирая необходимость в OCR (потому что это немного менее безопасно, но намного проще в реализации и защищает от основной проблемы: клавиатурных шпионов.)
редактировать: вы специально упомянули банк BNP, я проверил их систему входа в систему https://mabanque.bnpparibas/en/login , и там только сервер действительно знает значение / расположение клавиатур, это первое! Интересно, что вам действительно нужно некоторое OCR-подобное поведение для грамматического входа в систему. К счастью, довольно просто определить расположение клавиш, поскольку их всего 10 (0-9), а их внешний вид статичен. Проверь это:
<?php
// get the real image binary from curl or something ofc, at https://mabanque.bnpparibas/identification-wspl-pres/grille/i-88243722402549998260015114166903914017
$imageBinary = base64_decode ( 'iVBORw0KGgoAAAANSUhEUgAAAZ8AAACgCAYAAADTuWFYAAAYQUlEQVR4nO3dfXBU5b0H8O8G8gKEjX/0guStiEJIUqS1wG4iY8cqEHQsajEWxrEkJEKuFMTAjV4qWiv2Oje895YKGCy3w0yWhHaGsYQNceZOJdlNp+1cIS/6j4y74daOdtyTkLJkd8/9Y/dsssnm/eGc55DvZ4Y/dk+c+c3XPfvb5znPeY4FEfP3PJEEYCWAbAB3gUYTAvB3AB9f23e+feABZjluzFIcZikOsxRnSJbTAWD+nidSAfzoVxuq1hUuWGpPm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ItIdr/kIIPtTDs2EWYrDLMVhluJoyXHkQ0REumPzISIi3bH5EBGR7njNRwDu+yQOsxSHWYrDLMXh3m5ERGQYNh8iItIdmw8REemOzYeIiHQXbT7Tp08f6e9oBEnJySEAIe01s5w4ZikOsxSHWYqjZakl2JM4I7knKZiU2tfXh1AoNNJ/SxHTpk1DSkoKer767GsAPZG3meUEMEtxmKU4zFKcwVlqzaezscP94bql3/vBjBkzjKzPdHr8vV+f/XPTXwB8GnmLWU4QsxSHWYrDLMUZmKXWfFwvnd1fq6pqaGnmwsWzkmemGlmgWXyhfPW3+r9+6LrQdvnstX3nv4y8zSwngFmKwyzFYZbiDM7Soh2Yv+eJBADfBpANYKZhFZrLlwDar+077x34JrOcEGYpDrMUh1mKEzdLIiIi3fw/DsxfURPiNkUAAAAASUVORK5CYII=' );
$keyLocations = BNPPinDecode ( $imageBinary );
print_r ( $keyLocations );
function BNPPinDecode(string $imageBinary): array {
$img = function (string $imageBinary) {
$ret = imagecreatefromstring ( $imageBinary );
if (! $ret) {
throw new \RuntimeException ( 'image format not recognized! (invalid binary?)' );
}
return $ret;
};
static $dictionary = NULL;
if ($dictionary === NULL) {
$dictionary = array (
0 => 'iVBORw0KGgoAAAANSUhEUgAAAAsAAAAcCAYAAAC3f0UFAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMjHxIGmVAAABXklEQVQ4T72UPU/CUBSG+08cdXLTzU0HPwbBiakuJkbix+qg/8Fo+XIzEh2MmrCZCi3OQEIYDJsEl7JYWgpNmxx5Ty2p3K7Q5BnOfZ+em970Hsl1XQJGr0fX2Syl5H3m8PiE7opFzkJYrjUatLyySguLSwLbiSQ3msjohCBTuKXw+TFNOr+45HXsyHKtXueFo9Mz8jyPRqPRBN/3eUeAWnotlVhW8oV/YgiaIDcMg6SbXI4LrfoRK6MJ8rKmQ87/ydVYOZp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KPVqcRsVubahG6SY6n0eeTFKs0tLNLl9TXd+Hx8ndLrOe8+vyB4LONgDlpugEZYJEUG+OI8JZP8oRG8ZjLcqOuU6AN9JaRobT4CLwAAAABJRU5ErkJggg=='
);
$dictionary = array_map ( $img, array_map ( 'base64_decode', $dictionary ) );
register_shutdown_function ( function () use (&$dictionary) {
array_map ( 'imagedestroy', $dictionary ); // free up memory... php probably would do this anyway at this point tho.
} );
}
$big = $img ( $imageBinary );
try {
$ret = array ();
foreach ( $dictionary as $key => $small ) {
$tmp = FindImageInImageV2 ( $big, $small );
if (empty ( $tmp )) {
throw new \RuntimeException ( "failed to find number {$key} on the keypad!" );
}
if (count ( $tmp ) > 1) {
throw new \LogicException ( "found number {$key} more than once! should never happen" );
}
$ret [$key] = $tmp [0];
}
} finally{
imagedestroy ( $big );
}
return $ret;
}
// from https://stackoverflow.com/q/36002799/1067003
function FindImageInImageV2($big, $small, int $max = PHP_INT_MAX, bool $center = true): array {
assert ( is_resource ( $small ) );
assert ( is_resource ( $big ) );
$ret = array ();
// think2 ( $big, 'FindImageInImage/big' );
// think2 ( $small, 'FindImageInImage/small' );
$smallx = imagesx ( $small );
$smally = imagesy ( $small );
$bigx = imagesx ( $big );
$bigy = imagesy ( $big );
assert ( $bigx >= $smallx );
if ($bigx < $smallx) {
return $ret; // match is impossible
}
assert ( $bigy >= $smally );
if ($bigy < $smally) {
return $ret; // match is impossible
}
$smallcolors = imagecolorstotal ( $small );
$bigcolors = imagecolorstotal ( $big );
// assert($smallcolors<$bigcolors);
if ($smallcolors > $bigcolors) {
return $ret; // too many colors, match is impossible.
}
$smallImageAsColors = array ();
for($x = 0; $x < $smallx; ++ $x) {
$smallImageAsColors [$x] = array ();
for($y = 0; $y < $smally; ++ $y) {
$tmp = imagecolorsforindex ( $small, imagecolorat ( $small, $x, $y ) );
// unset ( $tmp ['alpha'] );
$tmp = imagecolorexact ( $big, $tmp ['red'], $tmp ['green'], $tmp ['blue'] );
if ($tmp === - 1) {
// small has a color that does not exist in big, match is impossible
return $ret;
}
$smallImageAsColors [$x] [/*$y*/] = $tmp;
}
}
unset ( $x, $y, $tmp );
for($x = 0; $x < $bigx; ++ $x) {
if ($bigx < ($x + $smallx)) { // << todo: can be optimized away.
break; // too close to the end, no result possible..
}
for($y = 0; $y < $bigy; ++ $y) {
if ($bigy < ($y + $smally)) { // << todo: can be optimized away.
continue; // too close to the bottom, no result possible for this $y..
}
// $matchFound = true;
for($i = 0; $i < $smallx; ++ $i) {
for($ii = 0; $ii < $smally; ++ $ii) {
// yelp
if ($smallImageAsColors [$i] [$ii] !== imagecolorat ( $big, $x + $i, $y + $ii )) {
// $matchFound=false;
// goto outofmatching;//i can micro optimize the jumps more actually... but should i?
// goto uglyoptimize;
continue 3;
}
}
}
// outofmatching:
// if ($matchFound) {
$ret [] = array (
'x' => ($center ? $x + (( int ) floor ( $smallx / 2 )) : $x),
'y' => ($center ? $y + (( int ) floor ( $smally / 2 )) : $y)
);
if (count ( $ret ) >= $max) {
// goto done;
return $ret;
}
// }
// uglyoptimize:
}
}
// done:
return $ret;
}
что дает двумерные координаты X / Y для каждого числа 0-9 на клавиатуре:
Array
(
[0] => Array
(
[x] => 42
[y] => 119
)
[1] => Array
(
[x] => 41
[y] => 39
)
[2] => Array
(
[x] => 375
[y] => 119
)
[3] => Array
(
[x] => 126
[y] => 39
)
[4] => Array
(
[x] => 124
[y] => 119
)
[5] => Array
(
[x] => 209
[y] => 40
)
[6] => Array
(
[x] => 374
[y] => 40
)
[7] => Array
(
[x] => 208
[y] => 118
)
[8] => Array
(
[x] => 291
[y] => 119
)
[9] => Array
(
[x] => 291
[y] => 40
)
)
который вы можете использовать для эмуляции нажатия на клавиатуре, чтобы ввести пин-код с помощью PHP / curl, чтобы войти в систему. 🙂
сами ключи (0-9) были извлечены с Paint.net как это https://youtu.be/ke4CMRjeN-o , и base64 закодированы (в $ словарь), и функция поиска изображения была взята из этого вопроса: Способ найти изображение внутри другого изображения в PHP / GD?
Других решений пока нет …