@ECHO OFF
REM ************************************************************
REM
REM MultiOTP - Strong two-factor authentication PHP class package
REM http://www.multiotp.net
REM
REM Filename: checkmultiotp.cmd
REM Version: 3.0.0
REM Language: Windows batch file for Windows NT4/2K/XP/2003
REM Copyright: SysCo systèmes de communication sa
REM Created: 2010-06-08 SysCo/al
REM Last modified: 2010-09-02 SysCo/al
REM Web site: http://developer.sysco.ch/multiotp/
REM Email: developer@sysco.ch
REM
REM Description
REM
REM checkmultiotp is a small script that will check
REM multiotp compliance with RFC4226. It must be launched
REM in the same directory as the multiotp.exe file.
REM
REM
REM Usage
REM
REM The script must be launched in the same directory as multiotp.exe.
REM
REM
REM External file needed
REM
REM multiotp.exe
REM
REM
REM External file created
REM
REM None
REM
REM
REM Licence
REM
REM Copyright (c) 2010, SysCo systèmes de communication sa
REM SysCo (tm) is a trademark of SysCo systèmes de communication sa
REM (http://www.sysco.ch/)
REM All rights reserved.
REM
REM This script is free software; you can redistribute it and/or
REM modify it under the terms of the GNU Lesser General Public
REM License as published by the Free Software Foundation; either
REM version 2.1 of the License, or (at your option) any later version.
REM
REM This library is distributed in the hope that it will be useful,
REM but WITHOUT ANY WARRANTY; without even the implied warranty of
REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
REM Lesser General Public License for more details.
REM
REM You should have received a copy of the GNU Lesser General Public
REM License along with this library; if not, write to the Free Software
REM Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
REM (http://www.fsf.org/)
REM
REM
REM Change Log
REM
REM 2010-09-02 3.0.0 SysCo/al More flexible variable definition to launch multiotp
REM 2010-08-21 2.0.4 SysCo/al More documentation, tests results resume
REM 2010-07-19 2.0.1 SysCo/al More documentation
REM 2010-07-19 2.0.0 SysCo/al New version for the new multiotp implementation
REM 2010-06-08 1.1.0 SysCo/al Project renamed to multiotp to avoid overlapping
REM 2010-06-08 1.0.0 SysCo/al Initial release
REM
REM ************************************************************
SET _current_dir=%~d0%~p0
SET _multiotp="%_current_dir%multiotp.exe"
SET SUCCESS=0
ECHO multiotp HOTP implementation check
ECHO (RFC 4226, http://www.ietf.org/rfc/rfc4226.txt)
ECHO -----------------------------------------------
ECHO.
%_multiotp% -version
ECHO.
ECHO Deleting the test_user
%_multiotp% -log -delete test_user
IF NOT ERRORLEVEL 13 ECHO - User test_user successfully deleted
ECHO.
ECHO Creating user test_user with the RFC test values HOTP token
%_multiotp% -log -create test_user HOTP 3132333435363738393031323334353637383930 1234 6 0
IF NOT ERRORLEVEL 12 ECHO - OK! User test_user successfully created
IF ERRORLEVEL 12 ECHO - KO! Error creating the user test_user
IF NOT ERRORLEVEL 12 SET /A SUCCESS=SUCCESS+1
ECHO.
ECHO Authenticating test_user with the first token of the RFC test values
%_multiotp% -log test_user 755224
IF NOT ERRORLEVEL 1 ECHO - OK! Token of the user test_user successfully accepted
IF ERRORLEVEL 1 ECHO - KO! Error authenticating the user test_user with the first token
IF NOT ERRORLEVEL 1 SET /A SUCCESS=SUCCESS+1
ECHO.
ECHO Testing the replay rejection
%_multiotp% -log test_user 755224
IF ERRORLEVEL 1 ECHO - OK! Token of the user test_user successfully REJECTED (replay)
IF NOT ERRORLEVEL 1 ECHO - KO! Replayed token *WRONGLY* accepted
IF ERRORLEVEL 1 SET /A SUCCESS=SUCCESS+1
ECHO.
ECHO Resynchronizing the key
%_multiotp% -log -resync -status test_user 338314 254676
IF NOT ERRORLEVEL 15 ECHO - OK! Token of the user test_user successfully resynchronized
IF ERRORLEVEL 15 ECHO - KO! Token of the user test_user NOT resynchronized
IF NOT ERRORLEVEL 15 SET /A SUCCESS=SUCCESS+1
ECHO.
ECHO Testing a false resynchronisation (in the past, may take some time)
%_multiotp% -log -resync -status test_user 287082 359152
IF ERRORLEVEL 20 ECHO - OK! Token of test_user successfully NOT resynchronized (in the past)
IF NOT ERRORLEVEL 20 ECHO - KO! Token of user test_user *WRONGLY* resynchronized
IF ERRORLEVEL 20 SET /A SUCCESS=SUCCESS+1
ECHO.
ECHO Deleting the test_user2
%_multiotp% -log -delete test_user2
IF NOT ERRORLEVEL 13 ECHO - User test_user2 successfully deleted
ECHO.
ECHO Creating user test_user2 with the RFC test values HOTP token and PIN prefix
ECHO (like Authenex / ZyXEL / Billion is doing for their OTP solution)
%_multiotp% -log -create -prefix-pin test_user2 HOTP 3132333435363738393031323334353637383930 1234 6 0
IF NOT ERRORLEVEL 12 ECHO - OK! User test_user2 successfully created
IF ERRORLEVEL 12 ECHO - KO! Error creating the user test_user2
IF NOT ERRORLEVEL 12 SET /A SUCCESS=SUCCESS+1
ECHO.
ECHO Authenticating test_user2 with the first token of the RFC test values with PIN
%_multiotp% -log test_user2 1234755224
IF NOT ERRORLEVEL 1 ECHO - OK! Token of the user test_user2 (with prefix PIN) successfully accepted
IF ERRORLEVEL 1 ECHO - KO! Error authenticating the user test_user2 with the first token and PIN prefix
IF NOT ERRORLEVEL 1 SET /A SUCCESS=SUCCESS+1
ECHO.
ECHO.
IF %SUCCESS% EQU 7 ECHO OK! ALL %SUCCESS% TESTS HAVE PASSED SUCCESSFULLY !
IF %SUCCESS% NEQ 7 ECHO KO! ONLY %SUCCESS%/7 TESTS HAVE PASSED SUCCESSFULLY !
ECHO.
PAUSE
|