i have the following case :-
i design :-
1- file.bat
on windows 2003
2- file2.sh
on unix-aix
file2.bash
call file.bat
and file.bat
receve path from file2.bash
and file.bash
return a value to file2.bat
.... when i execute this from my servers all thing good
but when i call this from my website (PHP) the following error appear :-
ERROR: API = ReadConsole.
error code = 109.
message = The pipe has been ended.
i think (PHP) close the stream between windows and unix before windows write a value to unix
after tracing the code avp.com scan
accoure this error why ???!!!!
the same error appear when I use ssh -n user host
how i can solve this problem
file.bat :-
@echo off
"C:\Program Files\Kaspersky Lab\Kaspersky Anti-Virus 6.0 for Windows Servers\avp.com" %1 /i2 > NUL 2>&1
set /a error = %errorlevel%
::error in executing avp.com command
if %error% equ 9009 goto :something_error
:: Infected
if not exist %1 goto :file_not_exist
:: if error grater than zero go to label something_error otherwise [error=0] go to label valu_0
if %error% gtr 0 (goto :something_error) else (goto :value_0)
:something_error
:: There is threat
if %error% equ 102 exit /b 1
:: Infected
if %error% equ 101 exit /b 2
:: Missing parameters
if %error% equ 1 exit /b 4
:: Anti-Virus application error
if %error% equ 3 exit /b 3
if %error% equ 4 exit /b 3
if %error% equ 9009 exit /b 3
:: Abnormal error
if %error% equ 2 exit /b 7
:value_0
::No threat
exit /b 0
:file_not_exist
:: Infected
exit /b 2
file2.sh:-
PRIMARY_SERVER_NAME="1.1.1.1"
PRIMARY_SERVER_USERNAME="Administrator"
BACKUP_SERVER_NAME="1.2.5.2"
BACKUP_SERVER_USERNAME="Administrator"
LOG_FILE="/opt/payone/antivirus/log/scan.log"
COPY_FILE_TO_WINDOWS_UNIX_FORMAT="/cygdrive/d/payone"
SCAN_BATCH_FILE_WINDOWS="d:\\\payone\\\scan.bat"
COPY_FILE_TO_WINDOWS_WINDOWS_FORMAT="d:\\\payone"
# $1 = name of the uploaded file
if [ -f "$1" ];
then
scp -r /$1/ ${PRIMARY_SERVER_USERNAME}
@${PRIMARY_SERVER_NAME}:${COPY_FILE_TO_WINDOWS_UNIX_FORMAT}
if [ $? -eq 0 ];
then
ssh -l ${PRIMARY_SERVER_USERNAME}
${PRIMARY_SERVER_NAME} 'cmd /c '$SCAN_BATCH_FILE_WINDOWS' '$COPY_FILE_TO_WINDOWS_WINDOWS_FORMAT'/'$x''
else
scp -r /$1/ ${BACKUP_SERVER_USERNAME }
@${BACKUP_SERVER_NAME}:${COPY_FILE_TO_WINDOWS_UNIX_FORMAT}
ssh -l ${BACKUP_SERVER_USERNAME}
${BACKUP_SERVER_NAME} 'cmd /c '$SCAN_BATCH_FILE_WINDOWS' '$COPY_FILE_TO_WINDOWS_WINDOWS_FO
RMAT'/'$1''`
fi
error_code=$?
echo "$(date +%c) $1 error code=$error_code">> ${LOG_FILE}
exit $error_code
else
echo "$(date +%c) $1 error code = 5 " >> ${LOG_FILE}
exit 5
fi