Linux® 是必需的,还要设置可以正常运行的 X Window System。1999 年以后发布的附带有图形桌面的所有发行版都应当提供了初始的预配置环境。您还需要用直接连接的鼠标实际访问计算机。瘦客户机、VNC 连接和虚拟客户机在理论上可以工作,但是不同处理层和网络延迟可能导致异常行为。
有效地捕捉和处理 X Window System 事件最好由 GNU Xnee 之类的程序完成。查看 参考资料 下载 Xnee(以及 cnee,它是本文使用的命令行程序)。您还需要 Perl,这是目前几乎每个 Linux 发行版都有的标准程序。另外还需要的是 Tk、Tk::Png、threads 和 Thread::Queue Perl 模块。
并且为了生成鼠标单击次数的加密散列,您需要 mkpasswd 程序。
demoLogin.pl 程序
创建演示界面、测量单击时间及将它们与存储的签名进行最终比较是由 demoLogin.pl 程序执行的。该程序将使用 Tk GUI 生成模块呈现类似 GDM face 浏览器的界面。cnee 程序的实例将在后台运行以精确记录鼠标数据。这种方法可用于记录特定应用程序或整个 X Window System 的属性。本文将主要演示如何监视单一应用程序,以及有效地生成和比较签名所需的框架。
#!/usr/bin/perl -w
# demoLogin.pl - example mouse dynamics login screen
use strict;
use Tk; # GUI handling
use Tk::PNG; # load user images
use threads; # for asynchronous pipe reads
use Thread::Queue; # for asynchronous pipe reads
die "specify record or compare mode " unless @ARGV == 1;
my $mode = $ARGV[0];
my( $salt, $hash ) = ""; # to be read from mouse.signatures
my $checkRng = 5; # fuziness of click time matching
my $userMatch = 0; # click time match found
my @clicks = (); # significant press time for mouse click
# cnee is used to monitor X windows mouse events
my $cneeCmd = "cnee --record --mouse -e xnee.err 2> raw.err | ";
# open an asynchronous pipe to store events while tk churns
my $pipe = createPipe( $cneeCmd ) or die "cannot create cnee cpipe";
# create a list of images to load (active and inactive)
my @inactiveImages = `ls -1 images/*Inactive.png`; chomp(@inactiveImages);
my @activeImages = `ls -1 images/*Active.png`; chomp(@activeImages);
# create a Tk window and a canvas to overlay user images on
my $mw = Tk::MainWindow->new;
my $can = $mw->Canvas( -width => 648, -height => 226,
-borderwidth => 0, -highlightthickness => 0
)->pack( -fill => "both", -expand => 1);
# load all of the inactive images onto the canvas
my $imgCount = 0;
while( $imgCount <= $#inactiveImages )
{
my $tempImg = $mw->Photo( -file => $inactiveImages[$imgCount],
-format => "png");
$can->createImage( ($imgCount * 150) +40, 50,
-image => $tempImg,
-anchor => 'nw',
-tags =>[" $imgCount"] );
my $setVar = " $imgCount"; # this has to be set or variables get passed by
# reference.
# call the active image display on click
$can->bind( $setVar, '<1>' => sub { clickImage( $setVar ) });
$imgCount++;
}#while each image
# left space fill so entry and submit buttons placement ease
my $cantop2 = $mw->Canvas( -width => 50, -height => 150,
-highlightthickness => 0 )->pack( -side => "left");
# asterisk entry box and submit button to run the click time processing
$mw->Entry ( -show => '*' )->pack( -side => "top");
$mw->Button( -text => 'Submit',
-command => sub{ runSubmit() }) -> pack( -side => "top");
MainLoop();
Linux® 是必需的,还要设置可以正常运行的 X Window System。1999 年以后发布的附带有图形桌面的所有发行版都应当提供了初始的预配置环境。您还需要用直接连接的鼠标实际访问计算机。瘦客户机、VNC 连接和虚拟客户机在理论上可以工作,但是不同处理层和网络延迟可能导致异常行为。
有效地捕捉和处理 X Window System 事件最好由 GNU Xnee 之类的程序完成。查看 参考资料 下载 Xnee(以及 cnee,它是本文使用的命令行程序)。您还需要 Perl,这是目前几乎每个 Linux 发行版都有的标准程序。另外还需要的是 Tk、Tk::Png、threads 和 Thread::Queue Perl 模块。
并且为了生成鼠标单击次数的加密散列,您需要 mkpasswd 程序。
demoLogin.pl 程序
创建演示界面、测量单击时间及将它们与存储的签名进行最终比较是由 demoLogin.pl 程序执行的。该程序将使用 Tk GUI 生成模块呈现类似 GDM face 浏览器的界面。cnee 程序的实例将在后台运行以精确记录鼠标数据。这种方法可用于记录特定应用程序或整个 X Window System 的属性。本文将主要演示如何监视单一应用程序,以及有效地生成和比较签名所需的框架。
#!/usr/bin/perl -w
# demoLogin.pl - example mouse dynamics login screen
use strict;
use Tk; # GUI handling
use Tk::PNG; # load user images
use threads; # for asynchronous pipe reads
use Thread::Queue; # for asynchronous pipe reads
die "specify record or compare mode " unless @ARGV == 1;
my $mode = $ARGV[0];
my( $salt, $hash ) = ""; # to be read from mouse.signatures
my $checkRng = 5; # fuziness of click time matching
my $userMatch = 0; # click time match found
my @clicks = (); # significant press time for mouse click
# cnee is used to monitor X windows mouse events
my $cneeCmd = "cnee --record --mouse -e xnee.err 2> raw.err | ";
# open an asynchronous pipe to store events while tk churns
my $pipe = createPipe( $cneeCmd ) or die "cannot create cnee cpipe";
# create a list of images to load (active and inactive)
my @inactiveImages = `ls -1 images/*Inactive.png`; chomp(@inactiveImages);
my @activeImages = `ls -1 images/*Active.png`; chomp(@activeImages);
# create a Tk window and a canvas to overlay user images on
my $mw = Tk::MainWindow->new;
my $can = $mw->Canvas( -width => 648, -height => 226,
-borderwidth => 0, -highlightthickness => 0
)->pack( -fill => "both", -expand => 1);
# load all of the inactive images onto the canvas
my $imgCount = 0;
while( $imgCount <= $#inactiveImages )
{
my $tempImg = $mw->Photo( -file => $inactiveImages[$imgCount],
-format => "png");
$can->createImage( ($imgCount * 150) +40, 50,
-image => $tempImg,
-anchor => 'nw',
-tags =>[" $imgCount"] );
my $setVar = " $imgCount"; # this has to be set or variables get passed by
# reference.
# call the active image display on click
$can->bind( $setVar, '<1>' => sub { clickImage( $setVar ) });
$imgCount++;
}#while each image
# left space fill so entry and submit buttons placement ease
my $cantop2 = $mw->Canvas( -width => 50, -height => 150,
-highlightthickness => 0 )->pack( -side => "left");
# asterisk entry box and submit button to run the click time processing
$mw->Entry ( -show => '*' )->pack( -side => "top");
$mw->Button( -text => 'Submit',
-command => sub{ runSubmit() }) -> pack( -side => "top");
MainLoop();
sub runSubmit
{
# process the recorded cnee events, create signature or attempt match
sleep(1); # wait to ensure tk events bubble up to cnee
processEvents();
if( $mode eq "record" )
{
print "@clicks\n", `echo "@clicks" | mkpasswd -H md5 --stdin `;
}#if in record mode
exit(0);
}#runSubmit
sub processEvents
{
# read all relevant mouse events from cnee
my $lastTime = ""; # store initial mouse press time
while( $pipe->pending )
{
my $line = $pipe->dequeue or next;
# skip line unless it has mouse information ( 7 commas and no colons )
next unless( ( () = $line =~ /,/g ) == 7 && $line !~ /:/ );
my( undef, $button, $x, $y, undef, undef, undef, $time ) = split ",", $line;
if( $button == 4 ){ $lastTime = $time } # mouse down 4, mouse release 5
# only grab the most significant digits of the mouse click-hold time
if( $button == 5 ){ push @clicks, sprintf("%0.0f", ($time-$lastTime)/10) }
}#for each line of data
}#processEvents
Linux® 是必需的,还要设置可以正常运行的 X Window System。1999 年以后发布的附带有图形桌面的所有发行版都应当提供了初始的预配置环境。您还需要用直接连接的鼠标实际访问计算机。瘦客户机、VNC 连接和虚拟客户机在理论上可以工作,但是不同处理层和网络延迟可能导致异常行为。
有效地捕捉和处理 X Window System 事件最好由 GNU Xnee 之类的程序完成。查看 参考资料 下载 Xnee(以及 cnee,它是本文使用的命令行程序)。您还需要 Perl,这是目前几乎每个 Linux 发行版都有的标准程序。另外还需要的是 Tk、Tk::Png、threads 和 Thread::Queue Perl 模块。
并且为了生成鼠标单击次数的加密散列,您需要 mkpasswd 程序。
demoLogin.pl 程序
创建演示界面、测量单击时间及将它们与存储的签名进行最终比较是由 demoLogin.pl 程序执行的。该程序将使用 Tk GUI 生成模块呈现类似 GDM face 浏览器的界面。cnee 程序的实例将在后台运行以精确记录鼠标数据。这种方法可用于记录特定应用程序或整个 X Window System 的属性。本文将主要演示如何监视单一应用程序,以及有效地生成和比较签名所需的框架。
#!/usr/bin/perl -w
# demoLogin.pl - example mouse dynamics login screen
use strict;
use Tk; # GUI handling
use Tk::PNG; # load user images
use threads; # for asynchronous pipe reads
use Thread::Queue; # for asynchronous pipe reads
die "specify record or compare mode " unless @ARGV == 1;
my $mode = $ARGV[0];
my( $salt, $hash ) = ""; # to be read from mouse.signatures
my $checkRng = 5; # fuziness of click time matching
my $userMatch = 0; # click time match found
my @clicks = (); # significant press time for mouse click
# cnee is used to monitor X windows mouse events
my $cneeCmd = "cnee --record --mouse -e xnee.err 2> raw.err | ";
# open an asynchronous pipe to store events while tk churns
my $pipe = createPipe( $cneeCmd ) or die "cannot create cnee cpipe";
# create a list of images to load (active and inactive)
my @inactiveImages = `ls -1 images/*Inactive.png`; chomp(@inactiveImages);
my @activeImages = `ls -1 images/*Active.png`; chomp(@activeImages);
# create a Tk window and a canvas to overlay user images on
my $mw = Tk::MainWindow->new;
my $can = $mw->Canvas( -width => 648, -height => 226,
-borderwidth => 0, -highlightthickness => 0
)->pack( -fill => "both", -expand => 1);
# load all of the inactive images onto the canvas
my $imgCount = 0;
while( $imgCount <= $#inactiveImages )
{
my $tempImg = $mw->Photo( -file => $inactiveImages[$imgCount],
-format => "png");
$can->createImage( ($imgCount * 150) +40, 50,
-image => $tempImg,
-anchor => 'nw',
-tags =>[" $imgCount"] );
my $setVar = " $imgCount"; # this has to be set or variables get passed by
# reference.
# call the active image display on click
$can->bind( $setVar, '<1>' => sub { clickImage( $setVar ) });
$imgCount++;
}#while each image
# left space fill so entry and submit buttons placement ease
my $cantop2 = $mw->Canvas( -width => 50, -height => 150,
-highlightthickness => 0 )->pack( -side => "left");
# asterisk entry box and submit button to run the click time processing
$mw->Entry ( -show => '*' )->pack( -side => "top");
$mw->Button( -text => 'Submit',
-command => sub{ runSubmit() }) -> pack( -side => "top");
MainLoop();
Linux® 是必需的,还要设置可以正常运行的 X Window System。1999 年以后发布的附带有图形桌面的所有发行版都应当提供了初始的预配置环境。您还需要用直接连接的鼠标实际访问计算机。瘦客户机、VNC 连接和虚拟客户机在理论上可以工作,但是不同处理层和网络延迟可能导致异常行为。
有效地捕捉和处理 X Window System 事件最好由 GNU Xnee 之类的程序完成。查看 参考资料 下载 Xnee(以及 cnee,它是本文使用的命令行程序)。您还需要 Perl,这是目前几乎每个 Linux 发行版都有的标准程序。另外还需要的是 Tk、Tk::Png、threads 和 Thread::Queue Perl 模块。
并且为了生成鼠标单击次数的加密散列,您需要 mkpasswd 程序。
demoLogin.pl 程序
创建演示界面、测量单击时间及将它们与存储的签名进行最终比较是由 demoLogin.pl 程序执行的。该程序将使用 Tk GUI 生成模块呈现类似 GDM face 浏览器的界面。cnee 程序的实例将在后台运行以精确记录鼠标数据。这种方法可用于记录特定应用程序或整个 X Window System 的属性。本文将主要演示如何监视单一应用程序,以及有效地生成和比较签名所需的框架。
#!/usr/bin/perl -w
# demoLogin.pl - example mouse dynamics login screen
use strict;
use Tk; # GUI handling
use Tk::PNG; # load user images
use threads; # for asynchronous pipe reads
use Thread::Queue; # for asynchronous pipe reads
die "specify record or compare mode " unless @ARGV == 1;
my $mode = $ARGV[0];
my( $salt, $hash ) = ""; # to be read from mouse.signatures
my $checkRng = 5; # fuziness of click time matching
my $userMatch = 0; # click time match found
my @clicks = (); # significant press time for mouse click
# cnee is used to monitor X windows mouse events
my $cneeCmd = "cnee --record --mouse -e xnee.err 2> raw.err | ";
# open an asynchronous pipe to store events while tk churns
my $pipe = createPipe( $cneeCmd ) or die "cannot create cnee cpipe";
# create a list of images to load (active and inactive)
my @inactiveImages = `ls -1 images/*Inactive.png`; chomp(@inactiveImages);
my @activeImages = `ls -1 images/*Active.png`; chomp(@activeImages);
# create a Tk window and a canvas to overlay user images on
my $mw = Tk::MainWindow->new;
my $can = $mw->Canvas( -width => 648, -height => 226,
-borderwidth => 0, -highlightthickness => 0
)->pack( -fill => "both", -expand => 1);
# load all of the inactive images onto the canvas
my $imgCount = 0;
while( $imgCount <= $#inactiveImages )
{
my $tempImg = $mw->Photo( -file => $inactiveImages[$imgCount],
-format => "png");
$can->createImage( ($imgCount * 150) +40, 50,
-image => $tempImg,
-anchor => 'nw',
-tags =>[" $imgCount"] );
my $setVar = " $imgCount"; # this has to be set or variables get passed by
# reference.
# call the active image display on click
$can->bind( $setVar, '<1>' => sub { clickImage( $setVar ) });
$imgCount++;
}#while each image
# left space fill so entry and submit buttons placement ease
my $cantop2 = $mw->Canvas( -width => 50, -height => 150,
-highlightthickness => 0 )->pack( -side => "left");
# asterisk entry box and submit button to run the click time processing
$mw->Entry ( -show => '*' )->pack( -side => "top");
$mw->Button( -text => 'Submit',
-command => sub{ runSubmit() }) -> pack( -side => "top");
MainLoop();
sub runSubmit
{
# process the recorded cnee events, create signature or attempt match
sleep(1); # wait to ensure tk events bubble up to cnee
processEvents();
if( $mode eq "record" )
{
print "@clicks\n", `echo "@clicks" | mkpasswd -H md5 --stdin `;
}#if in record mode
exit(0);
}#runSubmit
sub processEvents
{
# read all relevant mouse events from cnee
my $lastTime = ""; # store initial mouse press time
while( $pipe->pending )
{
my $line = $pipe->dequeue or next;
# skip line unless it has mouse information ( 7 commas and no colons )
next unless( ( () = $line =~ /,/g ) == 7 && $line !~ /:/ );
my( undef, $button, $x, $y, undef, undef, undef, $time ) = split ",", $line;
if( $button == 4 ){ $lastTime = $time } # mouse down 4, mouse release 5
# only grab the most significant digits of the mouse click-hold time
if( $button == 5 ){ push @clicks, sprintf("%0.0f", ($time-$lastTime)/10) }
}#for each line of data
}#processEvents
sub loadSignatureFile
{
open(INFILE,"mouse.signatures") or die "no signature file";
my $line =<INFILE>;
die "empty file " unless defined $line;
chomp($line);
( undef, undef, $salt, $hash ) = split '\
loadSignatureFile 将简单地读取在记录阶段中储存的 salt 和散列。清单 12 显示了更复杂的 checkDynamics 子例程。
清单 12. checkDynamics 子例程
sub checkDynamics
{
# recursive 'fuzziness' matching for click time signatures
print "checking level
Linux® 是必需的,还要设置可以正常运行的 X Window System。1999 年以后发布的附带有图形桌面的所有发行版都应当提供了初始的预配置环境。您还需要用直接连接的鼠标实际访问计算机。瘦客户机、VNC 连接和虚拟客户机在理论上可以工作,但是不同处理层和网络延迟可能导致异常行为。
有效地捕捉和处理 X Window System 事件最好由 GNU Xnee 之类的程序完成。查看 参考资料 下载 Xnee(以及 cnee,它是本文使用的命令行程序)。您还需要 Perl,这是目前几乎每个 Linux 发行版都有的标准程序。另外还需要的是 Tk、Tk::Png、threads 和 Thread::Queue Perl 模块。
并且为了生成鼠标单击次数的加密散列,您需要 mkpasswd 程序。
demoLogin.pl 程序
创建演示界面、测量单击时间及将它们与存储的签名进行最终比较是由 demoLogin.pl 程序执行的。该程序将使用 Tk GUI 生成模块呈现类似 GDM face 浏览器的界面。cnee 程序的实例将在后台运行以精确记录鼠标数据。这种方法可用于记录特定应用程序或整个 X Window System 的属性。本文将主要演示如何监视单一应用程序,以及有效地生成和比较签名所需的框架。
#!/usr/bin/perl -w
# demoLogin.pl - example mouse dynamics login screen
use strict;
use Tk; # GUI handling
use Tk::PNG; # load user images
use threads; # for asynchronous pipe reads
use Thread::Queue; # for asynchronous pipe reads
die "specify record or compare mode " unless @ARGV == 1;
my $mode = $ARGV[0];
my( $salt, $hash ) = ""; # to be read from mouse.signatures
my $checkRng = 5; # fuziness of click time matching
my $userMatch = 0; # click time match found
my @clicks = (); # significant press time for mouse click
# cnee is used to monitor X windows mouse events
my $cneeCmd = "cnee --record --mouse -e xnee.err 2> raw.err | ";
# open an asynchronous pipe to store events while tk churns
my $pipe = createPipe( $cneeCmd ) or die "cannot create cnee cpipe";
# create a list of images to load (active and inactive)
my @inactiveImages = `ls -1 images/*Inactive.png`; chomp(@inactiveImages);
my @activeImages = `ls -1 images/*Active.png`; chomp(@activeImages);
# create a Tk window and a canvas to overlay user images on
my $mw = Tk::MainWindow->new;
my $can = $mw->Canvas( -width => 648, -height => 226,
-borderwidth => 0, -highlightthickness => 0
)->pack( -fill => "both", -expand => 1);
# load all of the inactive images onto the canvas
my $imgCount = 0;
while( $imgCount <= $#inactiveImages )
{
my $tempImg = $mw->Photo( -file => $inactiveImages[$imgCount],
-format => "png");
$can->createImage( ($imgCount * 150) +40, 50,
-image => $tempImg,
-anchor => 'nw',
-tags =>[" $imgCount"] );
my $setVar = " $imgCount"; # this has to be set or variables get passed by
# reference.
# call the active image display on click
$can->bind( $setVar, '<1>' => sub { clickImage( $setVar ) });
$imgCount++;
}#while each image
# left space fill so entry and submit buttons placement ease
my $cantop2 = $mw->Canvas( -width => 50, -height => 150,
-highlightthickness => 0 )->pack( -side => "left");
# asterisk entry box and submit button to run the click time processing
$mw->Entry ( -show => '*' )->pack( -side => "top");
$mw->Button( -text => 'Submit',
-command => sub{ runSubmit() }) -> pack( -side => "top");
MainLoop();
Linux® 是必需的,还要设置可以正常运行的 X Window System。1999 年以后发布的附带有图形桌面的所有发行版都应当提供了初始的预配置环境。您还需要用直接连接的鼠标实际访问计算机。瘦客户机、VNC 连接和虚拟客户机在理论上可以工作,但是不同处理层和网络延迟可能导致异常行为。
有效地捕捉和处理 X Window System 事件最好由 GNU Xnee 之类的程序完成。查看 参考资料 下载 Xnee(以及 cnee,它是本文使用的命令行程序)。您还需要 Perl,这是目前几乎每个 Linux 发行版都有的标准程序。另外还需要的是 Tk、Tk::Png、threads 和 Thread::Queue Perl 模块。
并且为了生成鼠标单击次数的加密散列,您需要 mkpasswd 程序。
demoLogin.pl 程序
创建演示界面、测量单击时间及将它们与存储的签名进行最终比较是由 demoLogin.pl 程序执行的。该程序将使用 Tk GUI 生成模块呈现类似 GDM face 浏览器的界面。cnee 程序的实例将在后台运行以精确记录鼠标数据。这种方法可用于记录特定应用程序或整个 X Window System 的属性。本文将主要演示如何监视单一应用程序,以及有效地生成和比较签名所需的框架。
#!/usr/bin/perl -w
# demoLogin.pl - example mouse dynamics login screen
use strict;
use Tk; # GUI handling
use Tk::PNG; # load user images
use threads; # for asynchronous pipe reads
use Thread::Queue; # for asynchronous pipe reads
die "specify record or compare mode " unless @ARGV == 1;
my $mode = $ARGV[0];
my( $salt, $hash ) = ""; # to be read from mouse.signatures
my $checkRng = 5; # fuziness of click time matching
my $userMatch = 0; # click time match found
my @clicks = (); # significant press time for mouse click
# cnee is used to monitor X windows mouse events
my $cneeCmd = "cnee --record --mouse -e xnee.err 2> raw.err | ";
# open an asynchronous pipe to store events while tk churns
my $pipe = createPipe( $cneeCmd ) or die "cannot create cnee cpipe";
# create a list of images to load (active and inactive)
my @inactiveImages = `ls -1 images/*Inactive.png`; chomp(@inactiveImages);
my @activeImages = `ls -1 images/*Active.png`; chomp(@activeImages);
# create a Tk window and a canvas to overlay user images on
my $mw = Tk::MainWindow->new;
my $can = $mw->Canvas( -width => 648, -height => 226,
-borderwidth => 0, -highlightthickness => 0
)->pack( -fill => "both", -expand => 1);
# load all of the inactive images onto the canvas
my $imgCount = 0;
while( $imgCount <= $#inactiveImages )
{
my $tempImg = $mw->Photo( -file => $inactiveImages[$imgCount],
-format => "png");
$can->createImage( ($imgCount * 150) +40, 50,
-image => $tempImg,
-anchor => 'nw',
-tags =>[" $imgCount"] );
my $setVar = " $imgCount"; # this has to be set or variables get passed by
# reference.
# call the active image display on click
$can->bind( $setVar, '<1>' => sub { clickImage( $setVar ) });
$imgCount++;
}#while each image
# left space fill so entry and submit buttons placement ease
my $cantop2 = $mw->Canvas( -width => 50, -height => 150,
-highlightthickness => 0 )->pack( -side => "left");
# asterisk entry box and submit button to run the click time processing
$mw->Entry ( -show => '*' )->pack( -side => "top");
$mw->Button( -text => 'Submit',
-command => sub{ runSubmit() }) -> pack( -side => "top");
MainLoop();
sub runSubmit
{
# process the recorded cnee events, create signature or attempt match
sleep(1); # wait to ensure tk events bubble up to cnee
processEvents();
if( $mode eq "record" )
{
print "@clicks\n", `echo "@clicks" | mkpasswd -H md5 --stdin `;
}#if in record mode
exit(0);
}#runSubmit
sub processEvents
{
# read all relevant mouse events from cnee
my $lastTime = ""; # store initial mouse press time
while( $pipe->pending )
{
my $line = $pipe->dequeue or next;
# skip line unless it has mouse information ( 7 commas and no colons )
next unless( ( () = $line =~ /,/g ) == 7 && $line !~ /:/ );
my( undef, $button, $x, $y, undef, undef, undef, $time ) = split ",", $line;
if( $button == 4 ){ $lastTime = $time } # mouse down 4, mouse release 5
# only grab the most significant digits of the mouse click-hold time
if( $button == 5 ){ push @clicks, sprintf("%0.0f", ($time-$lastTime)/10) }
}#for each line of data
}#processEvents
Linux® 是必需的,还要设置可以正常运行的 X Window System。1999 年以后发布的附带有图形桌面的所有发行版都应当提供了初始的预配置环境。您还需要用直接连接的鼠标实际访问计算机。瘦客户机、VNC 连接和虚拟客户机在理论上可以工作,但是不同处理层和网络延迟可能导致异常行为。
有效地捕捉和处理 X Window System 事件最好由 GNU Xnee 之类的程序完成。查看 参考资料 下载 Xnee(以及 cnee,它是本文使用的命令行程序)。您还需要 Perl,这是目前几乎每个 Linux 发行版都有的标准程序。另外还需要的是 Tk、Tk::Png、threads 和 Thread::Queue Perl 模块。
并且为了生成鼠标单击次数的加密散列,您需要 mkpasswd 程序。
demoLogin.pl 程序
创建演示界面、测量单击时间及将它们与存储的签名进行最终比较是由 demoLogin.pl 程序执行的。该程序将使用 Tk GUI 生成模块呈现类似 GDM face 浏览器的界面。cnee 程序的实例将在后台运行以精确记录鼠标数据。这种方法可用于记录特定应用程序或整个 X Window System 的属性。本文将主要演示如何监视单一应用程序,以及有效地生成和比较签名所需的框架。
#!/usr/bin/perl -w
# demoLogin.pl - example mouse dynamics login screen
use strict;
use Tk; # GUI handling
use Tk::PNG; # load user images
use threads; # for asynchronous pipe reads
use Thread::Queue; # for asynchronous pipe reads
die "specify record or compare mode " unless @ARGV == 1;
my $mode = $ARGV[0];
my( $salt, $hash ) = ""; # to be read from mouse.signatures
my $checkRng = 5; # fuziness of click time matching
my $userMatch = 0; # click time match found
my @clicks = (); # significant press time for mouse click
# cnee is used to monitor X windows mouse events
my $cneeCmd = "cnee --record --mouse -e xnee.err 2> raw.err | ";
# open an asynchronous pipe to store events while tk churns
my $pipe = createPipe( $cneeCmd ) or die "cannot create cnee cpipe";
# create a list of images to load (active and inactive)
my @inactiveImages = `ls -1 images/*Inactive.png`; chomp(@inactiveImages);
my @activeImages = `ls -1 images/*Active.png`; chomp(@activeImages);
# create a Tk window and a canvas to overlay user images on
my $mw = Tk::MainWindow->new;
my $can = $mw->Canvas( -width => 648, -height => 226,
-borderwidth => 0, -highlightthickness => 0
)->pack( -fill => "both", -expand => 1);
# load all of the inactive images onto the canvas
my $imgCount = 0;
while( $imgCount <= $#inactiveImages )
{
my $tempImg = $mw->Photo( -file => $inactiveImages[$imgCount],
-format => "png");
$can->createImage( ($imgCount * 150) +40, 50,
-image => $tempImg,
-anchor => 'nw',
-tags =>[" $imgCount"] );
my $setVar = " $imgCount"; # this has to be set or variables get passed by
# reference.
# call the active image display on click
$can->bind( $setVar, '<1>' => sub { clickImage( $setVar ) });
$imgCount++;
}#while each image
# left space fill so entry and submit buttons placement ease
my $cantop2 = $mw->Canvas( -width => 50, -height => 150,
-highlightthickness => 0 )->pack( -side => "left");
# asterisk entry box and submit button to run the click time processing
$mw->Entry ( -show => '*' )->pack( -side => "top");
$mw->Button( -text => 'Submit',
-command => sub{ runSubmit() }) -> pack( -side => "top");
MainLoop();
Linux® 是必需的,还要设置可以正常运行的 X Window System。1999 年以后发布的附带有图形桌面的所有发行版都应当提供了初始的预配置环境。您还需要用直接连接的鼠标实际访问计算机。瘦客户机、VNC 连接和虚拟客户机在理论上可以工作,但是不同处理层和网络延迟可能导致异常行为。
有效地捕捉和处理 X Window System 事件最好由 GNU Xnee 之类的程序完成。查看 参考资料 下载 Xnee(以及 cnee,它是本文使用的命令行程序)。您还需要 Perl,这是目前几乎每个 Linux 发行版都有的标准程序。另外还需要的是 Tk、Tk::Png、threads 和 Thread::Queue Perl 模块。
并且为了生成鼠标单击次数的加密散列,您需要 mkpasswd 程序。
demoLogin.pl 程序
创建演示界面、测量单击时间及将它们与存储的签名进行最终比较是由 demoLogin.pl 程序执行的。该程序将使用 Tk GUI 生成模块呈现类似 GDM face 浏览器的界面。cnee 程序的实例将在后台运行以精确记录鼠标数据。这种方法可用于记录特定应用程序或整个 X Window System 的属性。本文将主要演示如何监视单一应用程序,以及有效地生成和比较签名所需的框架。
#!/usr/bin/perl -w
# demoLogin.pl - example mouse dynamics login screen
use strict;
use Tk; # GUI handling
use Tk::PNG; # load user images
use threads; # for asynchronous pipe reads
use Thread::Queue; # for asynchronous pipe reads
die "specify record or compare mode " unless @ARGV == 1;
my $mode = $ARGV[0];
my( $salt, $hash ) = ""; # to be read from mouse.signatures
my $checkRng = 5; # fuziness of click time matching
my $userMatch = 0; # click time match found
my @clicks = (); # significant press time for mouse click
# cnee is used to monitor X windows mouse events
my $cneeCmd = "cnee --record --mouse -e xnee.err 2> raw.err | ";
# open an asynchronous pipe to store events while tk churns
my $pipe = createPipe( $cneeCmd ) or die "cannot create cnee cpipe";
# create a list of images to load (active and inactive)
my @inactiveImages = `ls -1 images/*Inactive.png`; chomp(@inactiveImages);
my @activeImages = `ls -1 images/*Active.png`; chomp(@activeImages);
# create a Tk window and a canvas to overlay user images on
my $mw = Tk::MainWindow->new;
my $can = $mw->Canvas( -width => 648, -height => 226,
-borderwidth => 0, -highlightthickness => 0
)->pack( -fill => "both", -expand => 1);
# load all of the inactive images onto the canvas
my $imgCount = 0;
while( $imgCount <= $#inactiveImages )
{
my $tempImg = $mw->Photo( -file => $inactiveImages[$imgCount],
-format => "png");
$can->createImage( ($imgCount * 150) +40, 50,
-image => $tempImg,
-anchor => 'nw',
-tags =>[" $imgCount"] );
my $setVar = " $imgCount"; # this has to be set or variables get passed by
# reference.
# call the active image display on click
$can->bind( $setVar, '<1>' => sub { clickImage( $setVar ) });
$imgCount++;
}#while each image
# left space fill so entry and submit buttons placement ease
my $cantop2 = $mw->Canvas( -width => 50, -height => 150,
-highlightthickness => 0 )->pack( -side => "left");
# asterisk entry box and submit button to run the click time processing
$mw->Entry ( -show => '*' )->pack( -side => "top");
$mw->Button( -text => 'Submit',
-command => sub{ runSubmit() }) -> pack( -side => "top");
MainLoop();
sub runSubmit
{
# process the recorded cnee events, create signature or attempt match
sleep(1); # wait to ensure tk events bubble up to cnee
processEvents();
if( $mode eq "record" )
{
print "@clicks\n", `echo "@clicks" | mkpasswd -H md5 --stdin `;
}#if in record mode
exit(0);
}#runSubmit
sub processEvents
{
# read all relevant mouse events from cnee
my $lastTime = ""; # store initial mouse press time
while( $pipe->pending )
{
my $line = $pipe->dequeue or next;
# skip line unless it has mouse information ( 7 commas and no colons )
next unless( ( () = $line =~ /,/g ) == 7 && $line !~ /:/ );
my( undef, $button, $x, $y, undef, undef, undef, $time ) = split ",", $line;
if( $button == 4 ){ $lastTime = $time } # mouse down 4, mouse release 5
# only grab the most significant digits of the mouse click-hold time
if( $button == 5 ){ push @clicks, sprintf("%0.0f", ($time-$lastTime)/10) }
}#for each line of data
}#processEvents
sub loadSignatureFile
{
open(INFILE,"mouse.signatures") or die "no signature file";
my $line =<INFILE>;
die "empty file " unless defined $line;
chomp($line);
( undef, undef, $salt, $hash ) = split '\
loadSignatureFile 将简单地读取在记录阶段中储存的 salt 和散列。清单 12 显示了更复杂的 checkDynamics 子例程。
此外,鼠标力学是少数几个可以使用生物测量学进行连续验证的领域之一。考虑将应用程序修改为使用本文所述的一些技术,检测和跟踪应用程序用户特有的常见单击位置、单击按住时间和其他鼠标使用情况。尝试通过为 Web 验证应用程序测量单击按住时间,进一步推动 captcha 技术。(责任编辑:A6)
) while <$pipe>;
$queue-<enqueue( undef );
}-<detach;
#detach causes the threads to be silently terminated on exit (sometimes)
return $queue;
}#createPipe
此外,鼠标力学是少数几个可以使用生物测量学进行连续验证的领域之一。考虑将应用程序修改为使用本文所述的一些技术,检测和跟踪应用程序用户特有的常见单击位置、单击按住时间和其他鼠标使用情况。尝试通过为 Web 验证应用程序测量单击按住时间,进一步推动 captcha 技术。(责任编辑:A6)
) while <$pipe>;
$queue-<enqueue( undef );
}-<detach;
#detach causes the threads to be silently terminated on exit (sometimes)
return $queue;
}#createPipe
Linux® 是必需的,还要设置可以正常运行的 X Window System。1999 年以后发布的附带有图形桌面的所有发行版都应当提供了初始的预配置环境。您还需要用直接连接的鼠标实际访问计算机。瘦客户机、VNC 连接和虚拟客户机在理论上可以工作,但是不同处理层和网络延迟可能导致异常行为。
有效地捕捉和处理 X Window System 事件最好由 GNU Xnee 之类的程序完成。查看 参考资料 下载 Xnee(以及 cnee,它是本文使用的命令行程序)。您还需要 Perl,这是目前几乎每个 Linux 发行版都有的标准程序。另外还需要的是 Tk、Tk::Png、threads 和 Thread::Queue Perl 模块。
并且为了生成鼠标单击次数的加密散列,您需要 mkpasswd 程序。
demoLogin.pl 程序
创建演示界面、测量单击时间及将它们与存储的签名进行最终比较是由 demoLogin.pl 程序执行的。该程序将使用 Tk GUI 生成模块呈现类似 GDM face 浏览器的界面。cnee 程序的实例将在后台运行以精确记录鼠标数据。这种方法可用于记录特定应用程序或整个 X Window System 的属性。本文将主要演示如何监视单一应用程序,以及有效地生成和比较签名所需的框架。
#!/usr/bin/perl -w
# demoLogin.pl - example mouse dynamics login screen
use strict;
use Tk; # GUI handling
use Tk::PNG; # load user images
use threads; # for asynchronous pipe reads
use Thread::Queue; # for asynchronous pipe reads
die "specify record or compare mode " unless @ARGV == 1;
my $mode = $ARGV[0];
my( $salt, $hash ) = ""; # to be read from mouse.signatures
my $checkRng = 5; # fuziness of click time matching
my $userMatch = 0; # click time match found
my @clicks = (); # significant press time for mouse click
# cnee is used to monitor X windows mouse events
my $cneeCmd = "cnee --record --mouse -e xnee.err 2> raw.err | ";
# open an asynchronous pipe to store events while tk churns
my $pipe = createPipe( $cneeCmd ) or die "cannot create cnee cpipe";
# create a list of images to load (active and inactive)
my @inactiveImages = `ls -1 images/*Inactive.png`; chomp(@inactiveImages);
my @activeImages = `ls -1 images/*Active.png`; chomp(@activeImages);
# create a Tk window and a canvas to overlay user images on
my $mw = Tk::MainWindow->new;
my $can = $mw->Canvas( -width => 648, -height => 226,
-borderwidth => 0, -highlightthickness => 0
)->pack( -fill => "both", -expand => 1);
# load all of the inactive images onto the canvas
my $imgCount = 0;
while( $imgCount <= $#inactiveImages )
{
my $tempImg = $mw->Photo( -file => $inactiveImages[$imgCount],
-format => "png");
$can->createImage( ($imgCount * 150) +40, 50,
-image => $tempImg,
-anchor => 'nw',
-tags =>[" $imgCount"] );
my $setVar = " $imgCount"; # this has to be set or variables get passed by
# reference.
# call the active image display on click
$can->bind( $setVar, '<1>' => sub { clickImage( $setVar ) });
$imgCount++;
}#while each image
# left space fill so entry and submit buttons placement ease
my $cantop2 = $mw->Canvas( -width => 50, -height => 150,
-highlightthickness => 0 )->pack( -side => "left");
# asterisk entry box and submit button to run the click time processing
$mw->Entry ( -show => '*' )->pack( -side => "top");
$mw->Button( -text => 'Submit',
-command => sub{ runSubmit() }) -> pack( -side => "top");
MainLoop();
Linux® 是必需的,还要设置可以正常运行的 X Window System。1999 年以后发布的附带有图形桌面的所有发行版都应当提供了初始的预配置环境。您还需要用直接连接的鼠标实际访问计算机。瘦客户机、VNC 连接和虚拟客户机在理论上可以工作,但是不同处理层和网络延迟可能导致异常行为。
有效地捕捉和处理 X Window System 事件最好由 GNU Xnee 之类的程序完成。查看 参考资料 下载 Xnee(以及 cnee,它是本文使用的命令行程序)。您还需要 Perl,这是目前几乎每个 Linux 发行版都有的标准程序。另外还需要的是 Tk、Tk::Png、threads 和 Thread::Queue Perl 模块。
并且为了生成鼠标单击次数的加密散列,您需要 mkpasswd 程序。
demoLogin.pl 程序
创建演示界面、测量单击时间及将它们与存储的签名进行最终比较是由 demoLogin.pl 程序执行的。该程序将使用 Tk GUI 生成模块呈现类似 GDM face 浏览器的界面。cnee 程序的实例将在后台运行以精确记录鼠标数据。这种方法可用于记录特定应用程序或整个 X Window System 的属性。本文将主要演示如何监视单一应用程序,以及有效地生成和比较签名所需的框架。
#!/usr/bin/perl -w
# demoLogin.pl - example mouse dynamics login screen
use strict;
use Tk; # GUI handling
use Tk::PNG; # load user images
use threads; # for asynchronous pipe reads
use Thread::Queue; # for asynchronous pipe reads
die "specify record or compare mode " unless @ARGV == 1;
my $mode = $ARGV[0];
my( $salt, $hash ) = ""; # to be read from mouse.signatures
my $checkRng = 5; # fuziness of click time matching
my $userMatch = 0; # click time match found
my @clicks = (); # significant press time for mouse click
# cnee is used to monitor X windows mouse events
my $cneeCmd = "cnee --record --mouse -e xnee.err 2> raw.err | ";
# open an asynchronous pipe to store events while tk churns
my $pipe = createPipe( $cneeCmd ) or die "cannot create cnee cpipe";
# create a list of images to load (active and inactive)
my @inactiveImages = `ls -1 images/*Inactive.png`; chomp(@inactiveImages);
my @activeImages = `ls -1 images/*Active.png`; chomp(@activeImages);
# create a Tk window and a canvas to overlay user images on
my $mw = Tk::MainWindow->new;
my $can = $mw->Canvas( -width => 648, -height => 226,
-borderwidth => 0, -highlightthickness => 0
)->pack( -fill => "both", -expand => 1);
# load all of the inactive images onto the canvas
my $imgCount = 0;
while( $imgCount <= $#inactiveImages )
{
my $tempImg = $mw->Photo( -file => $inactiveImages[$imgCount],
-format => "png");
$can->createImage( ($imgCount * 150) +40, 50,
-image => $tempImg,
-anchor => 'nw',
-tags =>[" $imgCount"] );
my $setVar = " $imgCount"; # this has to be set or variables get passed by
# reference.
# call the active image display on click
$can->bind( $setVar, '<1>' => sub { clickImage( $setVar ) });
$imgCount++;
}#while each image
# left space fill so entry and submit buttons placement ease
my $cantop2 = $mw->Canvas( -width => 50, -height => 150,
-highlightthickness => 0 )->pack( -side => "left");
# asterisk entry box and submit button to run the click time processing
$mw->Entry ( -show => '*' )->pack( -side => "top");
$mw->Button( -text => 'Submit',
-command => sub{ runSubmit() }) -> pack( -side => "top");
MainLoop();
sub runSubmit
{
# process the recorded cnee events, create signature or attempt match
sleep(1); # wait to ensure tk events bubble up to cnee
processEvents();
if( $mode eq "record" )
{
print "@clicks\n", `echo "@clicks" | mkpasswd -H md5 --stdin `;
}#if in record mode
exit(0);
}#runSubmit
sub processEvents
{
# read all relevant mouse events from cnee
my $lastTime = ""; # store initial mouse press time
while( $pipe->pending )
{
my $line = $pipe->dequeue or next;
# skip line unless it has mouse information ( 7 commas and no colons )
next unless( ( () = $line =~ /,/g ) == 7 && $line !~ /:/ );
my( undef, $button, $x, $y, undef, undef, undef, $time ) = split ",", $line;
if( $button == 4 ){ $lastTime = $time } # mouse down 4, mouse release 5
# only grab the most significant digits of the mouse click-hold time
if( $button == 5 ){ push @clicks, sprintf("%0.0f", ($time-$lastTime)/10) }
}#for each line of data
}#processEvents
Linux® 是必需的,还要设置可以正常运行的 X Window System。1999 年以后发布的附带有图形桌面的所有发行版都应当提供了初始的预配置环境。您还需要用直接连接的鼠标实际访问计算机。瘦客户机、VNC 连接和虚拟客户机在理论上可以工作,但是不同处理层和网络延迟可能导致异常行为。
有效地捕捉和处理 X Window System 事件最好由 GNU Xnee 之类的程序完成。查看 参考资料 下载 Xnee(以及 cnee,它是本文使用的命令行程序)。您还需要 Perl,这是目前几乎每个 Linux 发行版都有的标准程序。另外还需要的是 Tk、Tk::Png、threads 和 Thread::Queue Perl 模块。
并且为了生成鼠标单击次数的加密散列,您需要 mkpasswd 程序。
demoLogin.pl 程序
创建演示界面、测量单击时间及将它们与存储的签名进行最终比较是由 demoLogin.pl 程序执行的。该程序将使用 Tk GUI 生成模块呈现类似 GDM face 浏览器的界面。cnee 程序的实例将在后台运行以精确记录鼠标数据。这种方法可用于记录特定应用程序或整个 X Window System 的属性。本文将主要演示如何监视单一应用程序,以及有效地生成和比较签名所需的框架。
#!/usr/bin/perl -w
# demoLogin.pl - example mouse dynamics login screen
use strict;
use Tk; # GUI handling
use Tk::PNG; # load user images
use threads; # for asynchronous pipe reads
use Thread::Queue; # for asynchronous pipe reads
die "specify record or compare mode " unless @ARGV == 1;
my $mode = $ARGV[0];
my( $salt, $hash ) = ""; # to be read from mouse.signatures
my $checkRng = 5; # fuziness of click time matching
my $userMatch = 0; # click time match found
my @clicks = (); # significant press time for mouse click
# cnee is used to monitor X windows mouse events
my $cneeCmd = "cnee --record --mouse -e xnee.err 2> raw.err | ";
# open an asynchronous pipe to store events while tk churns
my $pipe = createPipe( $cneeCmd ) or die "cannot create cnee cpipe";
# create a list of images to load (active and inactive)
my @inactiveImages = `ls -1 images/*Inactive.png`; chomp(@inactiveImages);
my @activeImages = `ls -1 images/*Active.png`; chomp(@activeImages);
# create a Tk window and a canvas to overlay user images on
my $mw = Tk::MainWindow->new;
my $can = $mw->Canvas( -width => 648, -height => 226,
-borderwidth => 0, -highlightthickness => 0
)->pack( -fill => "both", -expand => 1);
# load all of the inactive images onto the canvas
my $imgCount = 0;
while( $imgCount <= $#inactiveImages )
{
my $tempImg = $mw->Photo( -file => $inactiveImages[$imgCount],
-format => "png");
$can->createImage( ($imgCount * 150) +40, 50,
-image => $tempImg,
-anchor => 'nw',
-tags =>[" $imgCount"] );
my $setVar = " $imgCount"; # this has to be set or variables get passed by
# reference.
# call the active image display on click
$can->bind( $setVar, '<1>' => sub { clickImage( $setVar ) });
$imgCount++;
}#while each image
# left space fill so entry and submit buttons placement ease
my $cantop2 = $mw->Canvas( -width => 50, -height => 150,
-highlightthickness => 0 )->pack( -side => "left");
# asterisk entry box and submit button to run the click time processing
$mw->Entry ( -show => '*' )->pack( -side => "top");
$mw->Button( -text => 'Submit',
-command => sub{ runSubmit() }) -> pack( -side => "top");
MainLoop();
Linux® 是必需的,还要设置可以正常运行的 X Window System。1999 年以后发布的附带有图形桌面的所有发行版都应当提供了初始的预配置环境。您还需要用直接连接的鼠标实际访问计算机。瘦客户机、VNC 连接和虚拟客户机在理论上可以工作,但是不同处理层和网络延迟可能导致异常行为。
有效地捕捉和处理 X Window System 事件最好由 GNU Xnee 之类的程序完成。查看 参考资料 下载 Xnee(以及 cnee,它是本文使用的命令行程序)。您还需要 Perl,这是目前几乎每个 Linux 发行版都有的标准程序。另外还需要的是 Tk、Tk::Png、threads 和 Thread::Queue Perl 模块。
并且为了生成鼠标单击次数的加密散列,您需要 mkpasswd 程序。
demoLogin.pl 程序
创建演示界面、测量单击时间及将它们与存储的签名进行最终比较是由 demoLogin.pl 程序执行的。该程序将使用 Tk GUI 生成模块呈现类似 GDM face 浏览器的界面。cnee 程序的实例将在后台运行以精确记录鼠标数据。这种方法可用于记录特定应用程序或整个 X Window System 的属性。本文将主要演示如何监视单一应用程序,以及有效地生成和比较签名所需的框架。
#!/usr/bin/perl -w
# demoLogin.pl - example mouse dynamics login screen
use strict;
use Tk; # GUI handling
use Tk::PNG; # load user images
use threads; # for asynchronous pipe reads
use Thread::Queue; # for asynchronous pipe reads
die "specify record or compare mode " unless @ARGV == 1;
my $mode = $ARGV[0];
my( $salt, $hash ) = ""; # to be read from mouse.signatures
my $checkRng = 5; # fuziness of click time matching
my $userMatch = 0; # click time match found
my @clicks = (); # significant press time for mouse click
# cnee is used to monitor X windows mouse events
my $cneeCmd = "cnee --record --mouse -e xnee.err 2> raw.err | ";
# open an asynchronous pipe to store events while tk churns
my $pipe = createPipe( $cneeCmd ) or die "cannot create cnee cpipe";
# create a list of images to load (active and inactive)
my @inactiveImages = `ls -1 images/*Inactive.png`; chomp(@inactiveImages);
my @activeImages = `ls -1 images/*Active.png`; chomp(@activeImages);
# create a Tk window and a canvas to overlay user images on
my $mw = Tk::MainWindow->new;
my $can = $mw->Canvas( -width => 648, -height => 226,
-borderwidth => 0, -highlightthickness => 0
)->pack( -fill => "both", -expand => 1);
# load all of the inactive images onto the canvas
my $imgCount = 0;
while( $imgCount <= $#inactiveImages )
{
my $tempImg = $mw->Photo( -file => $inactiveImages[$imgCount],
-format => "png");
$can->createImage( ($imgCount * 150) +40, 50,
-image => $tempImg,
-anchor => 'nw',
-tags =>[" $imgCount"] );
my $setVar = " $imgCount"; # this has to be set or variables get passed by
# reference.
# call the active image display on click
$can->bind( $setVar, '<1>' => sub { clickImage( $setVar ) });
$imgCount++;
}#while each image
# left space fill so entry and submit buttons placement ease
my $cantop2 = $mw->Canvas( -width => 50, -height => 150,
-highlightthickness => 0 )->pack( -side => "left");
# asterisk entry box and submit button to run the click time processing
$mw->Entry ( -show => '*' )->pack( -side => "top");
$mw->Button( -text => 'Submit',
-command => sub{ runSubmit() }) -> pack( -side => "top");
MainLoop();
sub runSubmit
{
# process the recorded cnee events, create signature or attempt match
sleep(1); # wait to ensure tk events bubble up to cnee
processEvents();
if( $mode eq "record" )
{
print "@clicks\n", `echo "@clicks" | mkpasswd -H md5 --stdin `;
}#if in record mode
exit(0);
}#runSubmit
sub processEvents
{
# read all relevant mouse events from cnee
my $lastTime = ""; # store initial mouse press time
while( $pipe->pending )
{
my $line = $pipe->dequeue or next;
# skip line unless it has mouse information ( 7 commas and no colons )
next unless( ( () = $line =~ /,/g ) == 7 && $line !~ /:/ );
my( undef, $button, $x, $y, undef, undef, undef, $time ) = split ",", $line;
if( $button == 4 ){ $lastTime = $time } # mouse down 4, mouse release 5
# only grab the most significant digits of the mouse click-hold time
if( $button == 5 ){ push @clicks, sprintf("%0.0f", ($time-$lastTime)/10) }
}#for each line of data
}#processEvents
sub loadSignatureFile
{
open(INFILE,"mouse.signatures") or die "no signature file";
my $line =<INFILE>;
die "empty file " unless defined $line;
chomp($line);
( undef, undef, $salt, $hash ) = split '\
loadSignatureFile 将简单地读取在记录阶段中储存的 salt 和散列。清单 12 显示了更复杂的 checkDynamics 子例程。
此外,鼠标力学是少数几个可以使用生物测量学进行连续验证的领域之一。考虑将应用程序修改为使用本文所述的一些技术,检测和跟踪应用程序用户特有的常见单击位置、单击按住时间和其他鼠标使用情况。尝试通过为 Web 验证应用程序测量单击按住时间,进一步推动 captcha 技术。(责任编辑:A6)
) while <$pipe>;
$queue-<enqueue( undef );
}-<detach;
#detach causes the threads to be silently terminated on exit (sometimes)
return $queue;
}#createPipe
此外,鼠标力学是少数几个可以使用生物测量学进行连续验证的领域之一。考虑将应用程序修改为使用本文所述的一些技术,检测和跟踪应用程序用户特有的常见单击位置、单击按住时间和其他鼠标使用情况。尝试通过为 Web 验证应用程序测量单击按住时间,进一步推动 captcha 技术。(责任编辑:A6)
) while <$pipe>;
$queue-<enqueue( undef );
}-<detach;
#detach causes the threads to be silently terminated on exit (sometimes)
return $queue;
}#createPipe
Linux® 是必需的,还要设置可以正常运行的 X Window System。1999 年以后发布的附带有图形桌面的所有发行版都应当提供了初始的预配置环境。您还需要用直接连接的鼠标实际访问计算机。瘦客户机、VNC 连接和虚拟客户机在理论上可以工作,但是不同处理层和网络延迟可能导致异常行为。
有效地捕捉和处理 X Window System 事件最好由 GNU Xnee 之类的程序完成。查看 参考资料 下载 Xnee(以及 cnee,它是本文使用的命令行程序)。您还需要 Perl,这是目前几乎每个 Linux 发行版都有的标准程序。另外还需要的是 Tk、Tk::Png、threads 和 Thread::Queue Perl 模块。
并且为了生成鼠标单击次数的加密散列,您需要 mkpasswd 程序。
demoLogin.pl 程序
创建演示界面、测量单击时间及将它们与存储的签名进行最终比较是由 demoLogin.pl 程序执行的。该程序将使用 Tk GUI 生成模块呈现类似 GDM face 浏览器的界面。cnee 程序的实例将在后台运行以精确记录鼠标数据。这种方法可用于记录特定应用程序或整个 X Window System 的属性。本文将主要演示如何监视单一应用程序,以及有效地生成和比较签名所需的框架。
#!/usr/bin/perl -w
# demoLogin.pl - example mouse dynamics login screen
use strict;
use Tk; # GUI handling
use Tk::PNG; # load user images
use threads; # for asynchronous pipe reads
use Thread::Queue; # for asynchronous pipe reads
die "specify record or compare mode " unless @ARGV == 1;
my $mode = $ARGV[0];
my( $salt, $hash ) = ""; # to be read from mouse.signatures
my $checkRng = 5; # fuziness of click time matching
my $userMatch = 0; # click time match found
my @clicks = (); # significant press time for mouse click
# cnee is used to monitor X windows mouse events
my $cneeCmd = "cnee --record --mouse -e xnee.err 2> raw.err | ";
# open an asynchronous pipe to store events while tk churns
my $pipe = createPipe( $cneeCmd ) or die "cannot create cnee cpipe";
# create a list of images to load (active and inactive)
my @inactiveImages = `ls -1 images/*Inactive.png`; chomp(@inactiveImages);
my @activeImages = `ls -1 images/*Active.png`; chomp(@activeImages);
# create a Tk window and a canvas to overlay user images on
my $mw = Tk::MainWindow->new;
my $can = $mw->Canvas( -width => 648, -height => 226,
-borderwidth => 0, -highlightthickness => 0
)->pack( -fill => "both", -expand => 1);
# load all of the inactive images onto the canvas
my $imgCount = 0;
while( $imgCount <= $#inactiveImages )
{
my $tempImg = $mw->Photo( -file => $inactiveImages[$imgCount],
-format => "png");
$can->createImage( ($imgCount * 150) +40, 50,
-image => $tempImg,
-anchor => 'nw',
-tags =>[" $imgCount"] );
my $setVar = " $imgCount"; # this has to be set or variables get passed by
# reference.
# call the active image display on click
$can->bind( $setVar, '<1>' => sub { clickImage( $setVar ) });
$imgCount++;
}#while each image
# left space fill so entry and submit buttons placement ease
my $cantop2 = $mw->Canvas( -width => 50, -height => 150,
-highlightthickness => 0 )->pack( -side => "left");
# asterisk entry box and submit button to run the click time processing
$mw->Entry ( -show => '*' )->pack( -side => "top");
$mw->Button( -text => 'Submit',
-command => sub{ runSubmit() }) -> pack( -side => "top");
MainLoop();
Linux® 是必需的,还要设置可以正常运行的 X Window System。1999 年以后发布的附带有图形桌面的所有发行版都应当提供了初始的预配置环境。您还需要用直接连接的鼠标实际访问计算机。瘦客户机、VNC 连接和虚拟客户机在理论上可以工作,但是不同处理层和网络延迟可能导致异常行为。
有效地捕捉和处理 X Window System 事件最好由 GNU Xnee 之类的程序完成。查看 参考资料 下载 Xnee(以及 cnee,它是本文使用的命令行程序)。您还需要 Perl,这是目前几乎每个 Linux 发行版都有的标准程序。另外还需要的是 Tk、Tk::Png、threads 和 Thread::Queue Perl 模块。
并且为了生成鼠标单击次数的加密散列,您需要 mkpasswd 程序。
demoLogin.pl 程序
创建演示界面、测量单击时间及将它们与存储的签名进行最终比较是由 demoLogin.pl 程序执行的。该程序将使用 Tk GUI 生成模块呈现类似 GDM face 浏览器的界面。cnee 程序的实例将在后台运行以精确记录鼠标数据。这种方法可用于记录特定应用程序或整个 X Window System 的属性。本文将主要演示如何监视单一应用程序,以及有效地生成和比较签名所需的框架。
#!/usr/bin/perl -w
# demoLogin.pl - example mouse dynamics login screen
use strict;
use Tk; # GUI handling
use Tk::PNG; # load user images
use threads; # for asynchronous pipe reads
use Thread::Queue; # for asynchronous pipe reads
die "specify record or compare mode " unless @ARGV == 1;
my $mode = $ARGV[0];
my( $salt, $hash ) = ""; # to be read from mouse.signatures
my $checkRng = 5; # fuziness of click time matching
my $userMatch = 0; # click time match found
my @clicks = (); # significant press time for mouse click
# cnee is used to monitor X windows mouse events
my $cneeCmd = "cnee --record --mouse -e xnee.err 2> raw.err | ";
# open an asynchronous pipe to store events while tk churns
my $pipe = createPipe( $cneeCmd ) or die "cannot create cnee cpipe";
# create a list of images to load (active and inactive)
my @inactiveImages = `ls -1 images/*Inactive.png`; chomp(@inactiveImages);
my @activeImages = `ls -1 images/*Active.png`; chomp(@activeImages);
# create a Tk window and a canvas to overlay user images on
my $mw = Tk::MainWindow->new;
my $can = $mw->Canvas( -width => 648, -height => 226,
-borderwidth => 0, -highlightthickness => 0
)->pack( -fill => "both", -expand => 1);
# load all of the inactive images onto the canvas
my $imgCount = 0;
while( $imgCount <= $#inactiveImages )
{
my $tempImg = $mw->Photo( -file => $inactiveImages[$imgCount],
-format => "png");
$can->createImage( ($imgCount * 150) +40, 50,
-image => $tempImg,
-anchor => 'nw',
-tags =>[" $imgCount"] );
my $setVar = " $imgCount"; # this has to be set or variables get passed by
# reference.
# call the active image display on click
$can->bind( $setVar, '<1>' => sub { clickImage( $setVar ) });
$imgCount++;
}#while each image
# left space fill so entry and submit buttons placement ease
my $cantop2 = $mw->Canvas( -width => 50, -height => 150,
-highlightthickness => 0 )->pack( -side => "left");
# asterisk entry box and submit button to run the click time processing
$mw->Entry ( -show => '*' )->pack( -side => "top");
$mw->Button( -text => 'Submit',
-command => sub{ runSubmit() }) -> pack( -side => "top");
MainLoop();
sub runSubmit
{
# process the recorded cnee events, create signature or attempt match
sleep(1); # wait to ensure tk events bubble up to cnee
processEvents();
if( $mode eq "record" )
{
print "@clicks\n", `echo "@clicks" | mkpasswd -H md5 --stdin `;
}#if in record mode
exit(0);
}#runSubmit
sub processEvents
{
# read all relevant mouse events from cnee
my $lastTime = ""; # store initial mouse press time
while( $pipe->pending )
{
my $line = $pipe->dequeue or next;
# skip line unless it has mouse information ( 7 commas and no colons )
next unless( ( () = $line =~ /,/g ) == 7 && $line !~ /:/ );
my( undef, $button, $x, $y, undef, undef, undef, $time ) = split ",", $line;
if( $button == 4 ){ $lastTime = $time } # mouse down 4, mouse release 5
# only grab the most significant digits of the mouse click-hold time
if( $button == 5 ){ push @clicks, sprintf("%0.0f", ($time-$lastTime)/10) }
}#for each line of data
}#processEvents
Linux® 是必需的,还要设置可以正常运行的 X Window System。1999 年以后发布的附带有图形桌面的所有发行版都应当提供了初始的预配置环境。您还需要用直接连接的鼠标实际访问计算机。瘦客户机、VNC 连接和虚拟客户机在理论上可以工作,但是不同处理层和网络延迟可能导致异常行为。
有效地捕捉和处理 X Window System 事件最好由 GNU Xnee 之类的程序完成。查看 参考资料 下载 Xnee(以及 cnee,它是本文使用的命令行程序)。您还需要 Perl,这是目前几乎每个 Linux 发行版都有的标准程序。另外还需要的是 Tk、Tk::Png、threads 和 Thread::Queue Perl 模块。
并且为了生成鼠标单击次数的加密散列,您需要 mkpasswd 程序。
demoLogin.pl 程序
创建演示界面、测量单击时间及将它们与存储的签名进行最终比较是由 demoLogin.pl 程序执行的。该程序将使用 Tk GUI 生成模块呈现类似 GDM face 浏览器的界面。cnee 程序的实例将在后台运行以精确记录鼠标数据。这种方法可用于记录特定应用程序或整个 X Window System 的属性。本文将主要演示如何监视单一应用程序,以及有效地生成和比较签名所需的框架。
#!/usr/bin/perl -w
# demoLogin.pl - example mouse dynamics login screen
use strict;
use Tk; # GUI handling
use Tk::PNG; # load user images
use threads; # for asynchronous pipe reads
use Thread::Queue; # for asynchronous pipe reads
die "specify record or compare mode " unless @ARGV == 1;
my $mode = $ARGV[0];
my( $salt, $hash ) = ""; # to be read from mouse.signatures
my $checkRng = 5; # fuziness of click time matching
my $userMatch = 0; # click time match found
my @clicks = (); # significant press time for mouse click
# cnee is used to monitor X windows mouse events
my $cneeCmd = "cnee --record --mouse -e xnee.err 2> raw.err | ";
# open an asynchronous pipe to store events while tk churns
my $pipe = createPipe( $cneeCmd ) or die "cannot create cnee cpipe";
# create a list of images to load (active and inactive)
my @inactiveImages = `ls -1 images/*Inactive.png`; chomp(@inactiveImages);
my @activeImages = `ls -1 images/*Active.png`; chomp(@activeImages);
# create a Tk window and a canvas to overlay user images on
my $mw = Tk::MainWindow->new;
my $can = $mw->Canvas( -width => 648, -height => 226,
-borderwidth => 0, -highlightthickness => 0
)->pack( -fill => "both", -expand => 1);
# load all of the inactive images onto the canvas
my $imgCount = 0;
while( $imgCount <= $#inactiveImages )
{
my $tempImg = $mw->Photo( -file => $inactiveImages[$imgCount],
-format => "png");
$can->createImage( ($imgCount * 150) +40, 50,
-image => $tempImg,
-anchor => 'nw',
-tags =>[" $imgCount"] );
my $setVar = " $imgCount"; # this has to be set or variables get passed by
# reference.
# call the active image display on click
$can->bind( $setVar, '<1>' => sub { clickImage( $setVar ) });
$imgCount++;
}#while each image
# left space fill so entry and submit buttons placement ease
my $cantop2 = $mw->Canvas( -width => 50, -height => 150,
-highlightthickness => 0 )->pack( -side => "left");
# asterisk entry box and submit button to run the click time processing
$mw->Entry ( -show => '*' )->pack( -side => "top");
$mw->Button( -text => 'Submit',
-command => sub{ runSubmit() }) -> pack( -side => "top");
MainLoop();
Linux® 是必需的,还要设置可以正常运行的 X Window System。1999 年以后发布的附带有图形桌面的所有发行版都应当提供了初始的预配置环境。您还需要用直接连接的鼠标实际访问计算机。瘦客户机、VNC 连接和虚拟客户机在理论上可以工作,但是不同处理层和网络延迟可能导致异常行为。
有效地捕捉和处理 X Window System 事件最好由 GNU Xnee 之类的程序完成。查看 参考资料 下载 Xnee(以及 cnee,它是本文使用的命令行程序)。您还需要 Perl,这是目前几乎每个 Linux 发行版都有的标准程序。另外还需要的是 Tk、Tk::Png、threads 和 Thread::Queue Perl 模块。
并且为了生成鼠标单击次数的加密散列,您需要 mkpasswd 程序。
demoLogin.pl 程序
创建演示界面、测量单击时间及将它们与存储的签名进行最终比较是由 demoLogin.pl 程序执行的。该程序将使用 Tk GUI 生成模块呈现类似 GDM face 浏览器的界面。cnee 程序的实例将在后台运行以精确记录鼠标数据。这种方法可用于记录特定应用程序或整个 X Window System 的属性。本文将主要演示如何监视单一应用程序,以及有效地生成和比较签名所需的框架。
#!/usr/bin/perl -w
# demoLogin.pl - example mouse dynamics login screen
use strict;
use Tk; # GUI handling
use Tk::PNG; # load user images
use threads; # for asynchronous pipe reads
use Thread::Queue; # for asynchronous pipe reads
die "specify record or compare mode " unless @ARGV == 1;
my $mode = $ARGV[0];
my( $salt, $hash ) = ""; # to be read from mouse.signatures
my $checkRng = 5; # fuziness of click time matching
my $userMatch = 0; # click time match found
my @clicks = (); # significant press time for mouse click
# cnee is used to monitor X windows mouse events
my $cneeCmd = "cnee --record --mouse -e xnee.err 2> raw.err | ";
# open an asynchronous pipe to store events while tk churns
my $pipe = createPipe( $cneeCmd ) or die "cannot create cnee cpipe";
# create a list of images to load (active and inactive)
my @inactiveImages = `ls -1 images/*Inactive.png`; chomp(@inactiveImages);
my @activeImages = `ls -1 images/*Active.png`; chomp(@activeImages);
# create a Tk window and a canvas to overlay user images on
my $mw = Tk::MainWindow->new;
my $can = $mw->Canvas( -width => 648, -height => 226,
-borderwidth => 0, -highlightthickness => 0
)->pack( -fill => "both", -expand => 1);
# load all of the inactive images onto the canvas
my $imgCount = 0;
while( $imgCount <= $#inactiveImages )
{
my $tempImg = $mw->Photo( -file => $inactiveImages[$imgCount],
-format => "png");
$can->createImage( ($imgCount * 150) +40, 50,
-image => $tempImg,
-anchor => 'nw',
-tags =>[" $imgCount"] );
my $setVar = " $imgCount"; # this has to be set or variables get passed by
# reference.
# call the active image display on click
$can->bind( $setVar, '<1>' => sub { clickImage( $setVar ) });
$imgCount++;
}#while each image
# left space fill so entry and submit buttons placement ease
my $cantop2 = $mw->Canvas( -width => 50, -height => 150,
-highlightthickness => 0 )->pack( -side => "left");
# asterisk entry box and submit button to run the click time processing
$mw->Entry ( -show => '*' )->pack( -side => "top");
$mw->Button( -text => 'Submit',
-command => sub{ runSubmit() }) -> pack( -side => "top");
MainLoop();
sub runSubmit
{
# process the recorded cnee events, create signature or attempt match
sleep(1); # wait to ensure tk events bubble up to cnee
processEvents();
if( $mode eq "record" )
{
print "@clicks\n", `echo "@clicks" | mkpasswd -H md5 --stdin `;
}#if in record mode
exit(0);
}#runSubmit
sub processEvents
{
# read all relevant mouse events from cnee
my $lastTime = ""; # store initial mouse press time
while( $pipe->pending )
{
my $line = $pipe->dequeue or next;
# skip line unless it has mouse information ( 7 commas and no colons )
next unless( ( () = $line =~ /,/g ) == 7 && $line !~ /:/ );
my( undef, $button, $x, $y, undef, undef, undef, $time ) = split ",", $line;
if( $button == 4 ){ $lastTime = $time } # mouse down 4, mouse release 5
# only grab the most significant digits of the mouse click-hold time
if( $button == 5 ){ push @clicks, sprintf("%0.0f", ($time-$lastTime)/10) }
}#for each line of data
}#processEvents
sub loadSignatureFile
{
open(INFILE,"mouse.signatures") or die "no signature file";
my $line =<INFILE>;
die "empty file " unless defined $line;
chomp($line);
( undef, undef, $salt, $hash ) = split '\
loadSignatureFile 将简单地读取在记录阶段中储存的 salt 和散列。清单 12 显示了更复杂的 checkDynamics 子例程。
此外,鼠标力学是少数几个可以使用生物测量学进行连续验证的领域之一。考虑将应用程序修改为使用本文所述的一些技术,检测和跟踪应用程序用户特有的常见单击位置、单击按住时间和其他鼠标使用情况。尝试通过为 Web 验证应用程序测量单击按住时间,进一步推动 captcha 技术。(责任编辑:A6)
) while <$pipe>;
$queue-<enqueue( undef );
}-<detach;
#detach causes the threads to be silently terminated on exit (sometimes)
return $queue;
}#createPipe
此外,鼠标力学是少数几个可以使用生物测量学进行连续验证的领域之一。考虑将应用程序修改为使用本文所述的一些技术,检测和跟踪应用程序用户特有的常见单击位置、单击按住时间和其他鼠标使用情况。尝试通过为 Web 验证应用程序测量单击按住时间,进一步推动 captcha 技术。(责任编辑:A6)
) while <$pipe>;
$queue-<enqueue( undef );
}-<detach;
#detach causes the threads to be silently terminated on exit (sometimes)
return $queue;
}#createPipe
Linux® 是必需的,还要设置可以正常运行的 X Window System。1999 年以后发布的附带有图形桌面的所有发行版都应当提供了初始的预配置环境。您还需要用直接连接的鼠标实际访问计算机。瘦客户机、VNC 连接和虚拟客户机在理论上可以工作,但是不同处理层和网络延迟可能导致异常行为。
有效地捕捉和处理 X Window System 事件最好由 GNU Xnee 之类的程序完成。查看 参考资料 下载 Xnee(以及 cnee,它是本文使用的命令行程序)。您还需要 Perl,这是目前几乎每个 Linux 发行版都有的标准程序。另外还需要的是 Tk、Tk::Png、threads 和 Thread::Queue Perl 模块。
并且为了生成鼠标单击次数的加密散列,您需要 mkpasswd 程序。
demoLogin.pl 程序
创建演示界面、测量单击时间及将它们与存储的签名进行最终比较是由 demoLogin.pl 程序执行的。该程序将使用 Tk GUI 生成模块呈现类似 GDM face 浏览器的界面。cnee 程序的实例将在后台运行以精确记录鼠标数据。这种方法可用于记录特定应用程序或整个 X Window System 的属性。本文将主要演示如何监视单一应用程序,以及有效地生成和比较签名所需的框架。
#!/usr/bin/perl -w
# demoLogin.pl - example mouse dynamics login screen
use strict;
use Tk; # GUI handling
use Tk::PNG; # load user images
use threads; # for asynchronous pipe reads
use Thread::Queue; # for asynchronous pipe reads
die "specify record or compare mode " unless @ARGV == 1;
my $mode = $ARGV[0];
my( $salt, $hash ) = ""; # to be read from mouse.signatures
my $checkRng = 5; # fuziness of click time matching
my $userMatch = 0; # click time match found
my @clicks = (); # significant press time for mouse click
# cnee is used to monitor X windows mouse events
my $cneeCmd = "cnee --record --mouse -e xnee.err 2> raw.err | ";
# open an asynchronous pipe to store events while tk churns
my $pipe = createPipe( $cneeCmd ) or die "cannot create cnee cpipe";
# create a list of images to load (active and inactive)
my @inactiveImages = `ls -1 images/*Inactive.png`; chomp(@inactiveImages);
my @activeImages = `ls -1 images/*Active.png`; chomp(@activeImages);
# create a Tk window and a canvas to overlay user images on
my $mw = Tk::MainWindow->new;
my $can = $mw->Canvas( -width => 648, -height => 226,
-borderwidth => 0, -highlightthickness => 0
)->pack( -fill => "both", -expand => 1);
# load all of the inactive images onto the canvas
my $imgCount = 0;
while( $imgCount <= $#inactiveImages )
{
my $tempImg = $mw->Photo( -file => $inactiveImages[$imgCount],
-format => "png");
$can->createImage( ($imgCount * 150) +40, 50,
-image => $tempImg,
-anchor => 'nw',
-tags =>[" $imgCount"] );
my $setVar = " $imgCount"; # this has to be set or variables get passed by
# reference.
# call the active image display on click
$can->bind( $setVar, '<1>' => sub { clickImage( $setVar ) });
$imgCount++;
}#while each image
# left space fill so entry and submit buttons placement ease
my $cantop2 = $mw->Canvas( -width => 50, -height => 150,
-highlightthickness => 0 )->pack( -side => "left");
# asterisk entry box and submit button to run the click time processing
$mw->Entry ( -show => '*' )->pack( -side => "top");
$mw->Button( -text => 'Submit',
-command => sub{ runSubmit() }) -> pack( -side => "top");
MainLoop();
Linux® 是必需的,还要设置可以正常运行的 X Window System。1999 年以后发布的附带有图形桌面的所有发行版都应当提供了初始的预配置环境。您还需要用直接连接的鼠标实际访问计算机。瘦客户机、VNC 连接和虚拟客户机在理论上可以工作,但是不同处理层和网络延迟可能导致异常行为。
有效地捕捉和处理 X Window System 事件最好由 GNU Xnee 之类的程序完成。查看 参考资料 下载 Xnee(以及 cnee,它是本文使用的命令行程序)。您还需要 Perl,这是目前几乎每个 Linux 发行版都有的标准程序。另外还需要的是 Tk、Tk::Png、threads 和 Thread::Queue Perl 模块。
并且为了生成鼠标单击次数的加密散列,您需要 mkpasswd 程序。
demoLogin.pl 程序
创建演示界面、测量单击时间及将它们与存储的签名进行最终比较是由 demoLogin.pl 程序执行的。该程序将使用 Tk GUI 生成模块呈现类似 GDM face 浏览器的界面。cnee 程序的实例将在后台运行以精确记录鼠标数据。这种方法可用于记录特定应用程序或整个 X Window System 的属性。本文将主要演示如何监视单一应用程序,以及有效地生成和比较签名所需的框架。
#!/usr/bin/perl -w
# demoLogin.pl - example mouse dynamics login screen
use strict;
use Tk; # GUI handling
use Tk::PNG; # load user images
use threads; # for asynchronous pipe reads
use Thread::Queue; # for asynchronous pipe reads
die "specify record or compare mode " unless @ARGV == 1;
my $mode = $ARGV[0];
my( $salt, $hash ) = ""; # to be read from mouse.signatures
my $checkRng = 5; # fuziness of click time matching
my $userMatch = 0; # click time match found
my @clicks = (); # significant press time for mouse click
# cnee is used to monitor X windows mouse events
my $cneeCmd = "cnee --record --mouse -e xnee.err 2> raw.err | ";
# open an asynchronous pipe to store events while tk churns
my $pipe = createPipe( $cneeCmd ) or die "cannot create cnee cpipe";
# create a list of images to load (active and inactive)
my @inactiveImages = `ls -1 images/*Inactive.png`; chomp(@inactiveImages);
my @activeImages = `ls -1 images/*Active.png`; chomp(@activeImages);
# create a Tk window and a canvas to overlay user images on
my $mw = Tk::MainWindow->new;
my $can = $mw->Canvas( -width => 648, -height => 226,
-borderwidth => 0, -highlightthickness => 0
)->pack( -fill => "both", -expand => 1);
# load all of the inactive images onto the canvas
my $imgCount = 0;
while( $imgCount <= $#inactiveImages )
{
my $tempImg = $mw->Photo( -file => $inactiveImages[$imgCount],
-format => "png");
$can->createImage( ($imgCount * 150) +40, 50,
-image => $tempImg,
-anchor => 'nw',
-tags =>[" $imgCount"] );
my $setVar = " $imgCount"; # this has to be set or variables get passed by
# reference.
# call the active image display on click
$can->bind( $setVar, '<1>' => sub { clickImage( $setVar ) });
$imgCount++;
}#while each image
# left space fill so entry and submit buttons placement ease
my $cantop2 = $mw->Canvas( -width => 50, -height => 150,
-highlightthickness => 0 )->pack( -side => "left");
# asterisk entry box and submit button to run the click time processing
$mw->Entry ( -show => '*' )->pack( -side => "top");
$mw->Button( -text => 'Submit',
-command => sub{ runSubmit() }) -> pack( -side => "top");
MainLoop();
sub runSubmit
{
# process the recorded cnee events, create signature or attempt match
sleep(1); # wait to ensure tk events bubble up to cnee
processEvents();
if( $mode eq "record" )
{
print "@clicks\n", `echo "@clicks" | mkpasswd -H md5 --stdin `;
}#if in record mode
exit(0);
}#runSubmit
sub processEvents
{
# read all relevant mouse events from cnee
my $lastTime = ""; # store initial mouse press time
while( $pipe->pending )
{
my $line = $pipe->dequeue or next;
# skip line unless it has mouse information ( 7 commas and no colons )
next unless( ( () = $line =~ /,/g ) == 7 && $line !~ /:/ );
my( undef, $button, $x, $y, undef, undef, undef, $time ) = split ",", $line;
if( $button == 4 ){ $lastTime = $time } # mouse down 4, mouse release 5
# only grab the most significant digits of the mouse click-hold time
if( $button == 5 ){ push @clicks, sprintf("%0.0f", ($time-$lastTime)/10) }
}#for each line of data
}#processEvents
Linux® 是必需的,还要设置可以正常运行的 X Window System。1999 年以后发布的附带有图形桌面的所有发行版都应当提供了初始的预配置环境。您还需要用直接连接的鼠标实际访问计算机。瘦客户机、VNC 连接和虚拟客户机在理论上可以工作,但是不同处理层和网络延迟可能导致异常行为。
有效地捕捉和处理 X Window System 事件最好由 GNU Xnee 之类的程序完成。查看 参考资料 下载 Xnee(以及 cnee,它是本文使用的命令行程序)。您还需要 Perl,这是目前几乎每个 Linux 发行版都有的标准程序。另外还需要的是 Tk、Tk::Png、threads 和 Thread::Queue Perl 模块。
并且为了生成鼠标单击次数的加密散列,您需要 mkpasswd 程序。
demoLogin.pl 程序
创建演示界面、测量单击时间及将它们与存储的签名进行最终比较是由 demoLogin.pl 程序执行的。该程序将使用 Tk GUI 生成模块呈现类似 GDM face 浏览器的界面。cnee 程序的实例将在后台运行以精确记录鼠标数据。这种方法可用于记录特定应用程序或整个 X Window System 的属性。本文将主要演示如何监视单一应用程序,以及有效地生成和比较签名所需的框架。
#!/usr/bin/perl -w
# demoLogin.pl - example mouse dynamics login screen
use strict;
use Tk; # GUI handling
use Tk::PNG; # load user images
use threads; # for asynchronous pipe reads
use Thread::Queue; # for asynchronous pipe reads
die "specify record or compare mode " unless @ARGV == 1;
my $mode = $ARGV[0];
my( $salt, $hash ) = ""; # to be read from mouse.signatures
my $checkRng = 5; # fuziness of click time matching
my $userMatch = 0; # click time match found
my @clicks = (); # significant press time for mouse click
# cnee is used to monitor X windows mouse events
my $cneeCmd = "cnee --record --mouse -e xnee.err 2> raw.err | ";
# open an asynchronous pipe to store events while tk churns
my $pipe = createPipe( $cneeCmd ) or die "cannot create cnee cpipe";
# create a list of images to load (active and inactive)
my @inactiveImages = `ls -1 images/*Inactive.png`; chomp(@inactiveImages);
my @activeImages = `ls -1 images/*Active.png`; chomp(@activeImages);
# create a Tk window and a canvas to overlay user images on
my $mw = Tk::MainWindow->new;
my $can = $mw->Canvas( -width => 648, -height => 226,
-borderwidth => 0, -highlightthickness => 0
)->pack( -fill => "both", -expand => 1);
# load all of the inactive images onto the canvas
my $imgCount = 0;
while( $imgCount <= $#inactiveImages )
{
my $tempImg = $mw->Photo( -file => $inactiveImages[$imgCount],
-format => "png");
$can->createImage( ($imgCount * 150) +40, 50,
-image => $tempImg,
-anchor => 'nw',
-tags =>[" $imgCount"] );
my $setVar = " $imgCount"; # this has to be set or variables get passed by
# reference.
# call the active image display on click
$can->bind( $setVar, '<1>' => sub { clickImage( $setVar ) });
$imgCount++;
}#while each image
# left space fill so entry and submit buttons placement ease
my $cantop2 = $mw->Canvas( -width => 50, -height => 150,
-highlightthickness => 0 )->pack( -side => "left");
# asterisk entry box and submit button to run the click time processing
$mw->Entry ( -show => '*' )->pack( -side => "top");
$mw->Button( -text => 'Submit',
-command => sub{ runSubmit() }) -> pack( -side => "top");
MainLoop();
Linux® 是必需的,还要设置可以正常运行的 X Window System。1999 年以后发布的附带有图形桌面的所有发行版都应当提供了初始的预配置环境。您还需要用直接连接的鼠标实际访问计算机。瘦客户机、VNC 连接和虚拟客户机在理论上可以工作,但是不同处理层和网络延迟可能导致异常行为。
有效地捕捉和处理 X Window System 事件最好由 GNU Xnee 之类的程序完成。查看 参考资料 下载 Xnee(以及 cnee,它是本文使用的命令行程序)。您还需要 Perl,这是目前几乎每个 Linux 发行版都有的标准程序。另外还需要的是 Tk、Tk::Png、threads 和 Thread::Queue Perl 模块。
并且为了生成鼠标单击次数的加密散列,您需要 mkpasswd 程序。
demoLogin.pl 程序
创建演示界面、测量单击时间及将它们与存储的签名进行最终比较是由 demoLogin.pl 程序执行的。该程序将使用 Tk GUI 生成模块呈现类似 GDM face 浏览器的界面。cnee 程序的实例将在后台运行以精确记录鼠标数据。这种方法可用于记录特定应用程序或整个 X Window System 的属性。本文将主要演示如何监视单一应用程序,以及有效地生成和比较签名所需的框架。
#!/usr/bin/perl -w
# demoLogin.pl - example mouse dynamics login screen
use strict;
use Tk; # GUI handling
use Tk::PNG; # load user images
use threads; # for asynchronous pipe reads
use Thread::Queue; # for asynchronous pipe reads
die "specify record or compare mode " unless @ARGV == 1;
my $mode = $ARGV[0];
my( $salt, $hash ) = ""; # to be read from mouse.signatures
my $checkRng = 5; # fuziness of click time matching
my $userMatch = 0; # click time match found
my @clicks = (); # significant press time for mouse click
# cnee is used to monitor X windows mouse events
my $cneeCmd = "cnee --record --mouse -e xnee.err 2> raw.err | ";
# open an asynchronous pipe to store events while tk churns
my $pipe = createPipe( $cneeCmd ) or die "cannot create cnee cpipe";
# create a list of images to load (active and inactive)
my @inactiveImages = `ls -1 images/*Inactive.png`; chomp(@inactiveImages);
my @activeImages = `ls -1 images/*Active.png`; chomp(@activeImages);
# create a Tk window and a canvas to overlay user images on
my $mw = Tk::MainWindow->new;
my $can = $mw->Canvas( -width => 648, -height => 226,
-borderwidth => 0, -highlightthickness => 0
)->pack( -fill => "both", -expand => 1);
# load all of the inactive images onto the canvas
my $imgCount = 0;
while( $imgCount <= $#inactiveImages )
{
my $tempImg = $mw->Photo( -file => $inactiveImages[$imgCount],
-format => "png");
$can->createImage( ($imgCount * 150) +40, 50,
-image => $tempImg,
-anchor => 'nw',
-tags =>[" $imgCount"] );
my $setVar = " $imgCount"; # this has to be set or variables get passed by
# reference.
# call the active image display on click
$can->bind( $setVar, '<1>' => sub { clickImage( $setVar ) });
$imgCount++;
}#while each image
# left space fill so entry and submit buttons placement ease
my $cantop2 = $mw->Canvas( -width => 50, -height => 150,
-highlightthickness => 0 )->pack( -side => "left");
# asterisk entry box and submit button to run the click time processing
$mw->Entry ( -show => '*' )->pack( -side => "top");
$mw->Button( -text => 'Submit',
-command => sub{ runSubmit() }) -> pack( -side => "top");
MainLoop();
sub runSubmit
{
# process the recorded cnee events, create signature or attempt match
sleep(1); # wait to ensure tk events bubble up to cnee
processEvents();
if( $mode eq "record" )
{
print "@clicks\n", `echo "@clicks" | mkpasswd -H md5 --stdin `;
}#if in record mode
exit(0);
}#runSubmit
sub processEvents
{
# read all relevant mouse events from cnee
my $lastTime = ""; # store initial mouse press time
while( $pipe->pending )
{
my $line = $pipe->dequeue or next;
# skip line unless it has mouse information ( 7 commas and no colons )
next unless( ( () = $line =~ /,/g ) == 7 && $line !~ /:/ );
my( undef, $button, $x, $y, undef, undef, undef, $time ) = split ",", $line;
if( $button == 4 ){ $lastTime = $time } # mouse down 4, mouse release 5
# only grab the most significant digits of the mouse click-hold time
if( $button == 5 ){ push @clicks, sprintf("%0.0f", ($time-$lastTime)/10) }
}#for each line of data
}#processEvents
sub loadSignatureFile
{
open(INFILE,"mouse.signatures") or die "no signature file";
my $line =<INFILE>;
die "empty file " unless defined $line;
chomp($line);
( undef, undef, $salt, $hash ) = split '\
loadSignatureFile 将简单地读取在记录阶段中储存的 salt 和散列。清单 12 显示了更复杂的 checkDynamics 子例程。
此外,鼠标力学是少数几个可以使用生物测量学进行连续验证的领域之一。考虑将应用程序修改为使用本文所述的一些技术,检测和跟踪应用程序用户特有的常见单击位置、单击按住时间和其他鼠标使用情况。尝试通过为 Web 验证应用程序测量单击按住时间,进一步推动 captcha 技术。(责任编辑:A6)
) while <$pipe>;
$queue-<enqueue( undef );
}-<detach;
#detach causes the threads to be silently terminated on exit (sometimes)
return $queue;
}#createPipe
此外,鼠标力学是少数几个可以使用生物测量学进行连续验证的领域之一。考虑将应用程序修改为使用本文所述的一些技术,检测和跟踪应用程序用户特有的常见单击位置、单击按住时间和其他鼠标使用情况。尝试通过为 Web 验证应用程序测量单击按住时间,进一步推动 captcha 技术。(责任编辑:A6)
) while <$pipe>;
$queue-<enqueue( undef );
}-<detach;
#detach causes the threads to be silently terminated on exit (sometimes)
return $queue;
}#createPipe
此外,鼠标力学是少数几个可以使用生物测量学进行连续验证的领域之一。考虑将应用程序修改为使用本文所述的一些技术,检测和跟踪应用程序用户特有的常见单击位置、单击按住时间和其他鼠标使用情况。尝试通过为 Web 验证应用程序测量单击按住时间,进一步推动 captcha 技术。(责任编辑:A6)
) while <$pipe>;
$queue-<enqueue( undef );
}-<detach;
#detach causes the threads to be silently terminated on exit (sometimes)
return $queue;
}#createPipe
此外,鼠标力学是少数几个可以使用生物测量学进行连续验证的领域之一。考虑将应用程序修改为使用本文所述的一些技术,检测和跟踪应用程序用户特有的常见单击位置、单击按住时间和其他鼠标使用情况。尝试通过为 Web 验证应用程序测量单击按住时间,进一步推动 captcha 技术。(责任编辑:A6)
) while <$pipe>;
$queue-<enqueue( undef );
}-<detach;
#detach causes the threads to be silently terminated on exit (sometimes)
return $queue;
}#createPipe