|
bjsh
银牌会员
    
积分 2000
发帖 621
注册 2007-1-1
状态 离线
|
『第 16 楼』:
使用 LLM 解释/回答一下
今天早上分析了一下
vkill兄的代码;
在这里解析下;以便于新手学习;
整体的流程是:
1.检查文件完整性 or下载
2.检查参数
3.测试登陆
4.写全配置文件
5.nc 灌入 发送邮件
This morning I analyzed the code of Brother vkill;
Here I will explain it; so that beginners can learn;
The overall process is:
1. Check file integrity or download
2. Check parameters
3. Test login
4. Write full configuration file
5. Inject via nc and send email
|
|
2007-4-26 01:24 |
|
|
bjsh
银牌会员
    
积分 2000
发帖 621
注册 2007-1-1
状态 离线
|
『第 17 楼』:
使用 LLM 解释/回答一下
看了下;发现些小问题;下面提出些建议;
为了避免只使用一次/x建议在开头把user等初始化
:发信程序最后漏写了个goto :eof
这一处错误会导致
:发信程序 执行后会紧接着执行 :判断登陆成功否;
在 call :判断登陆成功否后面加一句
if errorlevel 1 goto :del_
否则无论是否登陆成功都继续发信;
在call :判断发送成功否 会出现些其它不必要的信息;而且发送不成功的话;发送不成功提示会出现两次;
而且最后还会echo 全部信件发送完毕;
建议在
call :del
echo 全部信件发送完毕
上加
cls
if errorlevel 1 echo 发信不成功 & goto del_
在:交互模式中
if not defined user (set/p=用户名:<nul&set/p "user= ")
完全可以简写为:if not defined user (set/p "user=用户名: ")
依次类推
for /f "tokens=2 delims=" %%? in ('ping -n 1 smtp.163.com ^|findstr /i "^Pinging"') do (set "ip=%%?")
建议把pinging改为ping否则vista无法成功找到ip
vista回显为:
正在 Ping smtp.163.split.netease.com 具有 32 字节的数据:
来自 220.181.12.13 的回复: 字节=32 时间=35ms TTL=51
220.181.12.13 的 Ping 统计信息:
数据包: 已发送 = 1,已接收 = 1,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
最短 = 35ms,最长 = 35ms,平均 = 35ms
应该把help下的if "%1"=="vkill" goto :eof提到help前;否则则失去了他应有的作用;
I looked it over; I found some minor issues; and here are some suggestions below;
To avoid using it only once /x, it is suggested to initialize user and others at the beginning
: There is a missing goto :eof at the end of the sending program
This error will lead to
: After the sending program is executed, it will immediately execute :Judge whether the login is successful;
Add a sentence after call :Judge whether the login is successful
if errorlevel 1 goto :del_
Otherwise, it will continue to send the letter regardless of whether the login is successful;
When calling call :Judge whether the sending is successful, some other unnecessary information will appear; and if the sending is not successful, the prompt for unsuccessful sending will appear twice;
And finally, it will also echo All letters sent successfully;
It is suggested to add
cls
if errorlevel 1 echo Sending failed & goto del_
before
call :del
echo All letters sent successfully
In the :Interactive mode
if not defined user (set/p=Username:<nul&set/p "user= ")
It can be simply written as: if not defined user (set/p "user=Username: ")
And so on
for /f "tokens=2 delims=" %%? in ('ping -n 1 smtp.163.com ^|findstr /i "^Pinging"') do (set "ip=%%?")
It is suggested to change Pinging to ping otherwise Vista cannot successfully find the ip
Vista's echo is:
正在 Ping smtp.163.split.netease.com 具有 32 字节的数据:
来自 220.181.12.13 的回复: 字节=32 时间=35ms TTL=51
220.181.12.13 的 Ping 统计信息:
数据包: 已发送 = 1,已接收 = 1,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
最短 = 35ms,最长 = 35ms,平均 = 35ms
It should move the if "%1"=="vkill" goto :eof under help to before help; otherwise it will lose its proper function;
|
|
2007-4-26 01:27 |
|
|
wudixin96
银牌会员
    
积分 1928
发帖 931
注册 2007-1-6
状态 离线
|
『第 18 楼』:
使用 LLM 解释/回答一下
好东西。不过还是要借助vbs?!
Good stuff. But still need to rely on vbs? !
|
|
2007-4-26 01:33 |
|
|
bjsh
银牌会员
    
积分 2000
发帖 621
注册 2007-1-1
状态 离线
|
『第 19 楼』:
使用 LLM 解释/回答一下
给vkill兄的代码
根据上面的建议稍微修改了下
并稍微写了点注释
代码如下
- @echo off&setlocal ENABLEDELAYEDEXPANSION
- set "t_=test.conf"
- set "server=163.com"
- set "port=25"
- set "最大附件大小=15000000"
- set "tools_url=http://www.vkill.net/netbar/网吧所需exe/"
- set "tools_name=nc.exe;rar.exe;base64.exe"
- rem ================检查文件完整性=====================
- :down_tools
- set "down_ok=y"
- if not "%tools_name%*"=="*" (
- for %%? in (%tools_name%) do (
- if *%%~$PATH:?==* if not exist %%? (
- set "down_ok=n"
- echo 程序所依赖文件%%?缺失,已自动开始下载
- if not exist iget.vbs call :iget.vbs_
- iget.vbs "%tools_url%%%?" "%%?"
- ::move "%%?" %windir%>nul 2>nul
- echo 文件%%?下载完毕
- )
- )
- )
- del /f/q iget.vbs>nul 2>nul
- if %down_ok%]== goto down_tools
- rem ==================结束==============================
- rem ===============分析参数=============================
- for %%? in (/? -? /h -h --h) do (if "%1"=="%%?" goto help)
- if "%1"=="" goto help
- :loop_ap
- set/a n+=1
- if not "%1"=="" (
- if "%1"=="/x" goto 交互模式
- if "%1"=="/u" set "user=%~2"
- if "%1"=="/p" set "pass=%~2"
- if "%1"=="/t" set "to=%~2"
- if "%1"=="/s" set "subject=%~2"
- if "%1"=="/c" set "content=%~2"
- if "%1"=="/a" set "accessories=%~2"
- shift&shift
- goto loop_ap
- )
- for %%? in (user pass to subject) do (if not defined %%? goto 参数错误)
- goto start
- rem ===================结束===============================
- :交互模式
- call :help vkill
- if not defined user (set/p "user=用户名: ")
- if not defined pass (set/p "pass=密码: ")
- if not defined to (set/p "to=收件人: ")
- if not defined subject (set/p "subject=主题<hello>: ")
- if not defined content (set/p "content=内容: ")
- if not defined accessories (set/p "accessories=附件: ")
- rem :::::开始写配置文件:::::
- :start
- ::写单个发送配置文件
- for /l %%? in (1,1,7) do (>%%? cd.)
- >>1 echo helo vkill
- >>1 echo AUTH LOGIN
- rem ===================1文件的内容==========================
- rem helo vkill
- rem AUTH LOGIN
- rem ====================结束================================
- for %%? in (%user%;%pass%) do (
- set/p=%%?^<nul|base64>"!t_!"
- set/p v=<"!t_!"
- >>2 echo !v!
- del /f/q !t_!
- )
- rem
- rem =================2文件的内容=============================
- rem 用户名和密码的base64编码
- rem =====================结束================================
- rem
- >8 echo quit
- rem =================8文件的内容============================
- rem quit
- rem ====================结束================================
- copy 1+2+8 "!t_!" >nul 2>nul
- rem ::判断能否登陆::
- rem 第二次改写test.conf 以用来 验证能否登陆服务器 nc -nvv IP Port <test.conf
- rem =================test.conf文件的内容=====================
- rem helo vkill
- rem AUTH LOGIN
- rem 用户名base64编码
- rem 密码base64编码
- rem quit
- rem ====================结束================================
- call :发信程序
- cls
- call :判断登陆成功否
- if errorlevel 1 goto :del_
- rem ::判断结束::
- >>3 echo mail from: ^<%user%@%server%^>
- rem ===================3文件的内容=============================
- rem mail from: <%user%@163.com>
- rem =======================结束================================
- >>5 echo data
- >>5 echo From: %user%@%server%
- >>5 echo To: %to%
- >>5 echo Subject: %subject%
- >>5 echo X-mailer: p-163ms 2.0
- >>5 echo Mime-Version: 1.0
- >>5 echo Content-Type: multipart/mixed;
- >>5 echo boundary="=====vkill====="
- >>5 echo.
- if defined content (
- >>5 echo --=====vkill=====
- >>5 echo Content-Type: text/plain;
- >>5 echo charset="gb2312"
- >>5 echo Content-Transfer-Encoding: 7bit
- >>5 echo.
- dir !content! >nul 2>nul &&(type "!content!">>5) ||(>>5 echo !content!)
- )
- rem ====================5文件的内容=============================
- rem data
- rem From: %user%@163.com
- rem To: %to%
- rem Subject: %subject%
- rem X-mailer: p-163ms 2.0
- rem Mime-Version: 1.0
- rem Content-Type: multipart/mixed;
- rem boundary="=====vkill====="
- rem 如果有内容的话
- rem --=====vkill=====
- rem Content-Type: text/plain;
- rem charset="gb2312"
- rem Content-Transfer-Encoding: 7bit
- rem
- rem 内容
- rem ======================结束================================
- echo 压缩编码文件中...
- if defined accessories for %%? in (%accessories%) do (call :压缩编码附件 "%%?")
- >>7 echo --=====vkill=====--
- >>7 echo .
- >>7 echo quit
- rem ===================7文件的内容============================
- rem --=====vkill=====--
- rem
- rem quit
- rem ======================结束================================
- ::发信
- for %%? in (%to%) do (
- echo 给%%?发信中...
- ::合并单个发送配置文件
- >4 echo rcpt to: ^<%%?^>
- del /f/q "!t_!"
- copy 1+2+3+4+5+6+7 "!t_!" >nul 2>nul
- call :发信程序
- call :判断发送成功否
- )
- rem ====================4文件的内容=============================
- rem rcpt to:<%to%>
- rem =======================结束================================
- rem 第三次改写 test.conf文件.合并1-7个文件;内容如下;也是最关键的东西.
- rem ===================test.conf文件的内容==========================
- rem helo vkill
- rem AUTH LOGIN
- rem 用户名base64编码
- rem 密码base64编码
- rem mail from: <%user%@163.com>
- rem rcpt to: <%to%@163.com>
- rem data
- rem From: %user%@163.com
- rem To: %to%@163.com
- rem Subject: %subject%
- rem X-mailer: p-163ms 2.0
- rem Mime-Version: 1.0
- rem Content-Type: multipart/mixed;
- rem boundary="=====vkill====="
- rem
- rem --=====vkill=====
- rem Content-Type: text/plain;
- rem charset="gb2312"
- rem Content-Transfer-Encoding: 7bit
- rem
- rem %content%
- rem --=====vkill=====
- rem Content-Type: application/octet-stream;
- rem name="附件名称_.rar"
- rem Content-Transfer-Encoding: base64
- rem Content-Disposition: attachment;
- rem filename="附件名称_.rar"
- rem
- rem 附件压缩文件的base64编码
- rem
- rem --=====vkill=====--
- rem .
- rem quit
- rem ====================结束================================
- rem ::::写配置文件结束::::
- cls
- if errorlevel 1 echo 发信不成功 & goto del_
- call :del_
- echo 全部信件发送完毕
- ping -n 3 127.1>nul 2>nul
- goto :eof
- :del_
- for /l %%? in (1,1,8) do (del /f/q %%?>nul 2>nul)
- del /f/q "%t_%">nul 2>nul
- del /f/q p-163ms.log>nul 2>nul
- goto :eof
- :help
- if "%1"=="vkill" goto :eof
- echo ____help________________________________________________________________________
- echo.
- echo p-163ms v2.0 by:vkill
- echo Copyright (C) 2006-2008 http://www.vkill.net
- echo.
- echo Usage: p-163ms.cmd /u 用户名 /p 密码 /t 收件人 /s 主题
- echo.
- echo /x 交互模式,当使用此参数时别的参数全部无效
- echo /t 收件人:(多收件人中间用,隔开;多附件时用""引住)
- echo /c 内容:(文字/写好内容的文本文件路径)
- echo /a 附件:(绝对路径/相对路径,多附件中间用,隔开;多附件时用""引住)
- echo.
- echo 示例:
- echo p-163ms.cmd /u 123 /p abc /t "122755990@qq.com" /s hello
- echo p-163ms.cmd /u 123 /p abc /t "122755990@qq.com" /s hello /c 123 /a "d:\00.txt"
- echo p-163ms.cmd /u 123 /p abc /t "122755990@qq.com,yx127@yx127.com" /s hello /c 123 /a "d:\00.txt,c:\00.bat"
- echo.
- echo ________________________________________________________________________________
- goto :eof
- :压缩编码附件
- dir %~1 >nul 2>nul &&(call :压缩文件 "%~1" "rar.exe -r")||(call :压缩文件 "%~1" rar.exe)
- call :判断文件大小 "%~n1_.rar"
- >>6 echo --=====vkill=====
- >>6 echo Content-Type: application/octet-stream;
- >>6 echo name="%~n1_.rar"
- >>6 echo Content-Transfer-Encoding: base64
- >>6 echo Content-Disposition: attachment;
- >>6 echo filename="%~n1_.rar"
- >>6 echo.
- base64.exe -i "%~n1_.rar">>6
- >>6 echo.
- del /f/q "%~n1_.rar" >nul 2>nul
- goto :eof
- rem ==================6文件的内容===================================
- rem --=====vkill=====
- rem Content-Type: application/octet-stream;
- rem name="%~n1_.rar"
- rem Content-Transfer-Encoding: base64
- rem Content-Disposition: attachment;
- rem filename="%~n1_.rar"
- rem
- rem 附件的base64编码
- rem
- rem ====================结束======================================
- :压缩文件
- %~2 a "%~n1_.rar" "%~1" >nul 2>nul||(goto 压缩文件错误)
- goto :eof
- :判断文件大小
- set/a z+=%~z1
- ::判断附件大小
- if not !z! lss %最大附件大小% (goto 附件大小超出)
- goto :eof
- :发信程序
- for /f "tokens=2 delims=" %%? in ('ping -n 1 smtp.163.com ^|findstr /i "^Ping"') do (set "ip=%%?")
- nc -nvv !ip! %port%<"!t_!">p-163ms.log
- goto :eof
- :判断登陆成功否
- for /f "tokens=1-2 delims=:" %%a in ('findstr /N . p-163ms.log') do (set "%%a=%%b")
- echo !5!|findstr "^235" >nul 2>nul ||(goto 登陆不成功)
- goto :eof
- :判断发送成功否
- for /f "tokens=1-2 delims=:" %%a in ('findstr /N . p-163ms.log') do (set "%%a=%%b")
- if not defined 10 (call :发信不成功)
- echo !9!|findstr "^250" >nul 2>nul ||(goto 发信不成功)
- goto :eof
- :iget.vbs_
- >iget.vbs echo x=LCase(WScript.Arguments(1))
- >>iget.vbs echo y=LCase(WScript.Arguments(0))
- >>iget.vbs echo Set xPost=CreateObject("Microsoft.XMLHTTP")
- >>iget.vbs echo xPost.Open "GET",y,0
- >>iget.vbs echo xPost.Send()
- >>iget.vbs echo Set sGet=CreateObject("ADODB.Stream")
- >>iget.vbs echo sGet.Mode=3
- >>iget.vbs echo sGet.Type=1
- >>iget.vbs echo sGet.Open()
- >>iget.vbs echo sGet.Write(xPost.responseBody)
- >>iget.vbs echo sGet.SaveToFile x,2
- goto :eof
- :::::::::::::::::::::所有错误start::::::::::::::::::::::
- :参数错误
- echo 参数错误,用户名\密码\收件人\主题中某一项缺少
- goto :eof
- :压缩文件错误
- echo 压缩文件失败
- goto :eof
- :附件大小超出
- echo 附件大小超出
- goto :eof
- :登陆不成功
- echo 登陆不成功
- goto :eof
- :发信不成功
- echo 发信不成功
- goto :eof
- :::::::::::::::::::::所有错误end::::::::::::::::::::::
BJSH发表于: 2007-04-25 13:20
Last edited by bjsh on 2007-4-25 at 01:34 PM ]
Code for Brother vkill
Slightly modified according to the above suggestions and wrote some comments slightly
The code is as follows
- @echo off&setlocal ENABLEDELAYEDEXPANSION
- set "t_=test.conf"
- set "server=163.com"
- set "port=25"
- set "Maximum attachment size=15000000"
- set "tools_url=http://www.vkill.net/netbar/网吧所需exe/"
- set "tools_name=nc.exe;rar.exe;base64.exe"
- rem ================Check file integrity=====================
- :down_tools
- set "down_ok=y"
- if not "%tools_name%*"=="*" (
- for %%? in (%tools_name%) do (
- if *%%~$PATH:?==* if not exist %%? (
- set "down_ok=n"
- echo The dependent file of the program %? is missing, and automatic download has started
- if not exist iget.vbs call :iget.vbs_
- iget.vbs "%tools_url%%%?" "%%?"
- ::move "%%?" %windir%>nul 2>nul
- echo File %? downloaded successfully
- )
- )
- )
- del /f/q iget.vbs>nul 2>nul
- if %down_ok%]== goto down_tools
- rem ==================End==============================
- rem ===============Analyze parameters=============================
- for %%? in (/? -? /h -h --h) do (if "%1"=="%%?" goto help)
- if "%1"=="" goto help
- :loop_ap
- set/a n+=1
- if not "%1"=="" (
- if "%1"=="/x" goto Interactive mode
- if "%1"=="/u" set "user=%~2"
- if "%1"=="/p" set "pass=%~2"
- if "%1"=="/t" set "to=%~2"
- if "%1"=="/s" set "subject=%~2"
- if "%1"=="/c" set "content=%~2"
- if "%1"=="/a" set "accessories=%~2"
- shift&shift
- goto loop_ap
- )
- for %%? in (user pass to subject) do (if not defined %%? goto Parameter error)
- goto start
- rem ===================End===============================
- :Interactive mode
- call :help vkill
- if not defined user (set/p "user=Username: ")
- if not defined pass (set/p "pass=Password: ")
- if not defined to (set/p "Recipient: ")
- if not defined subject (set/p "Subject <hello>: ")
- if not defined content (set/p "Content: ")
- if not defined accessories (set/p "Accessories: ")
- rem :::::Start writing configuration file:::::
:start
- ::Write single send configuration file
- for /l %%? in (1,1,7) do (>%%? cd.)
- >>1 echo helo vkill
- >>1 echo AUTH LOGIN
- rem ===================1 file content==========================
- rem helo vkill
- rem AUTH LOGIN
- rem ====================End================================
- for %%? in (%user%;%pass%) do (
- set/p=%%?^<nul|base64>"!t_!"
- set/p v=<"!t_!"
- >>2 echo !v!
- del /f/q !t_!
- )
- rem
- rem =================2 file content=============================
- rem Base64 encoding of username and password
- rem =====================End================================
- rem
- >8 echo quit
- rem =================8 file content============================
- rem quit
- rem ====================End================================
- copy 1+2+8 "!t_!" >nul 2>nul
- rem ::Judge whether you can log in::
- rem Rewrite test.conf for the second time to verify whether you can log in to the server nc -nvv IP Port <test.conf
- rem =================test.conf file content=====================
- rem helo vkill
- rem AUTH LOGIN
- rem Base64 encoding of username
- rem Base64 encoding of password
- rem quit
- rem ====================End================================
- call :Sending program
- cls
- call :Judge whether the login is successful
- if errorlevel 1 goto :del_
- rem ::End of judgment::
- >>3 echo mail from: ^<%user%@%server%^>
- rem ===================3 file content=============================
- rem mail from: <%user%@163.com>
- rem =======================End================================
- >>5 echo data
- >>5 echo From: %user%@%server%
- >>5 echo To: %to%
- >>5 echo Subject: %subject%
- >>5 echo X-mailer: p-163ms 2.0
- >>5 echo Mime-Version: 1.0
- >>5 echo Content-Type: multipart/mixed;
- >>5 echo boundary="=====vkill====="
- >>5 echo.
- if defined content (
- >>5 echo --=====vkill=====
- >>5 echo Content-Type: text/plain;
- >>5 echo charset="gb2312"
- >>5 echo Content-Transfer-Encoding: 7bit
- >>5 echo.
- dir !content! >nul 2>nul &&(type "!content!">>5) ||(>>5 echo !content!)
- )
- rem ====================5 file content=============================
- rem data
- rem From: %user%@163.com
- rem To: %to%
- rem Subject: %subject%
- rem X-mailer: p-163ms 2.0
- rem Mime-Version: 1.0
- rem Content-Type: multipart/mixed;
- rem boundary="=====vkill====="
- rem If there is content
- rem --=====vkill=====
- rem Content-Type: text/plain;
- rem charset="gb2312"
- rem Content-Transfer-Encoding: 7bit
- rem
- rem Content
- rem ======================End================================
- echo Compressing and encoding files...
- if defined accessories for %%? in (%accessories%) do (call :Compress and encode attachment "%%?")
- >>7 echo --=====vkill=====--
- >>7 echo .
- >>7 echo quit
- rem ===================7 file content============================
- rem --=====vkill=====--
- rem
- rem quit
- rem ======================End================================
- ::Send
- for %%? in (%to%) do (
- echo Sending email to %%?
- ::Merge single send configuration file
- >4 echo rcpt to: ^<%%?^>
- del /f/q "!t_!"
- copy 1+2+3+4+5+6+7 "!t_!" >nul 2>nul
- call :Sending program
- call :Judge whether the sending is successful
- )
- rem ====================4 file content=============================
- rem rcpt to:<%to%>
- rem =======================End================================
- rem Rewrite test.conf file for the third time. Merge 1-7 files; the content is as follows; also the most critical thing.
- rem ===================test.conf file content==========================
- rem helo vkill
- rem AUTH LOGIN
- rem Base64 encoding of username
- rem Base64 encoding of password
- rem mail from: <%user%@163.com>
- rem rcpt to: <%to%@163.com>
- rem data
- rem From: %user%@163.com
- rem To: %to%@163.com
- rem Subject: %subject%
- rem X-mailer: p-163ms 2.0
- rem Mime-Version: 1.0
- rem Content-Type: multipart/mixed;
- rem boundary="=====vkill====="
- rem
- rem --=====vkill=====
- rem Content-Type: text/plain;
- rem charset="gb2312"
- rem Content-Transfer-Encoding: 7bit
- rem
- rem %content%
- rem --=====vkill=====
- rem Content-Type: application/octet-stream;
- rem name="Attachment name_.rar"
- rem Content-Transfer-Encoding: base64
- rem Content-Disposition: attachment;
- rem filename="Attachment name_.rar"
- rem
- rem Base64 encoding of compressed attachment file
- rem
- rem --=====vkill=====--
- rem .
- rem quit
- rem ====================End================================
- rem ::::End of writing configuration file::::
- cls
- if errorlevel 1 echo Email sending failed & goto del_
- call :del_
- echo All emails sent successfully
- ping -n 3 127.1>nul 2>nul
- goto :eof
- :del_
- for /l %%? in (1,1,8) do (del /f/q %%?>nul 2>nul)
- del /f/q "%t_%">nul 2>nul
- del /f/q p-163ms.log>nul 2>nul
- goto :eof
- :help
- if "%1"=="vkill" goto :eof
- echo ____help________________________________________________________________________
- echo.
- echo p-163ms v2.0 by:vkill
- echo Copyright (C) 2006-2008 http://www.vkill.net
- echo.
- echo Usage: p-163ms.cmd /u Username /p Password /t Recipient /s Subject
- echo.
- echo /x Interactive mode, when using this parameter, all other parameters are invalid
- echo /t Recipient:(Separate multiple recipients with,; enclose multiple attachments with"")
- echo /c Content:(Text/path of the text file with content written)
- echo /a Attachment:(Absolute path/relative path, separate multiple attachments with,; enclose multiple attachments with"")
- echo.
- echo Example:
- echo p-163ms.cmd /u 123 /p abc /t "122755990@qq.com" /s hello
- echo p-163ms.cmd /u 123 /p abc /t "122755990@qq.com" /s hello /c 123 /a "d:\00.txt"
- echo p-163ms.cmd /u 123 /p abc /t "122755990@qq.com,yx127@yx127.com" /s hello /c 123 /a "d:\00.txt,c:\00.bat"
- echo.
- echo ________________________________________________________________________________
- goto :eof
- :Compress and encode attachment
- dir %~1 >nul 2>nul &&(call :Compress file "%~1" "rar.exe -r")||(call :Compress file "%~1" rar.exe)
- call :Judge file size "%~n1_.rar"
- >>6 echo --=====vkill=====
- >>6 echo Content-Type: application/octet-stream;
- >>6 echo name="%~n1_.rar"
- >>6 echo Content-Transfer-Encoding: base64
- >>6 echo Content-Disposition: attachment;
- >>6 echo filename="%~n1_.rar"
- >>6 echo .
- base64.exe -i "%~n1_.rar">>6
- >>6 echo .
- del /f/q "%~n1_.rar" >nul 2>nul
- goto :eof
- rem ==================6 file content===================================
- rem --=====vkill=====
- rem Content-Type: application/octet-stream;
- rem name="%~n1_.rar"
- rem Content-Transfer-Encoding: base64
- rem Content-Disposition: attachment;
- rem filename="%~n1_.rar"
- rem
- rem Base64 encoding of attachment
- rem
- rem ====================End======================================
- :Compress file
- %~2 a "%~n1_.rar" "
此帖被 +16 点积分 点击查看详情 评分人:【 lxmxn 】 | 分数: +8 | 时间:2007-4-26 02:30 | 评分人:【 vkill 】 | 分数: +8 | 时间:2007-4-26 07:35 |
|
|
|
2007-4-26 01:35 |
|
|
bjsh
银牌会员
    
积分 2000
发帖 621
注册 2007-1-1
状态 离线
|
『第 20 楼』:
使用 LLM 解释/回答一下
根据vkill兄的代码;我重新写了一下;
直接生成 test 和 post文件;
避免了9个文件的加和和复制;
稍微容易理解些:
代码如下:
- @echo off&setlocal ENABLEDELAYEDEXPANSION
- set "t_=test.conf"
- set "server=163.com"
- set "port=25"
- set "最大附件大小=15000000"
- set "tools_url=http://www.vkill.net/netbar/网吧所需exe/"
- set "tools_name=nc.exe;rar.exe;base64.exe"
- set "user="
- set "pass="
- set "to="
- set "subject="
- set "content="
- set "accessories="
- :down_tools
- set "down_ok=y"
- if not "%tools_name%*"=="*" (
- for %%? in (%tools_name%) do (
- if *%%~$PATH:?==* if not exist %%? (
- set "down_ok=n"
- echo 程序所依赖文件%%?缺失,已自动开始下载
- if not exist iget.vbs call :iget.vbs_
- iget.vbs "%tools_url%%%?" "%%?"
- echo 文件%%?下载完毕
- )
- )
- )
- del /f/q iget.vbs>nul 2>nul
- if %down_ok%]== goto down_tools
- for %%? in (/? -? /h -h --h) do (if "%1"=="%%?" goto help)
- if "%1"=="" goto help
- :loop_ap
- set/a n+=1
- if not "%1"=="" (
- if "%1"=="/x" goto 交互模式
- if "%1"=="/u" set "user=%~2"
- if "%1"=="/p" set "pass=%~2"
- if "%1"=="/t" set "to=%~2"
- if "%1"=="/s" set "subject=%~2"
- if "%1"=="/c" set "content=%~2"
- if "%1"=="/a" set "accessories=%~2"
- shift&shift
- goto loop_ap
- )
- for %%? in (user pass to subject) do (
- if not defined %%? echo 参数错误参数错误,用户名\密码\收件人\主题中某一项缺少 & goto :eof
- )
- goto start
- :交互模式
- call :help vkill
- if not defined user (set/p "user=用户名: ")
- if not defined pass (set/p "pass=密码: ")
- if not defined to (set/p "to=收件人: ")
- if not defined subject (set/p "subject=主题<hello>: ")
- if not defined content (set/p "content=内容: ")
- if not defined accessories (set/p "accessories=附件: ")
- :start
- echo helo vkill >test
- echo AUTH LOGIN >>test
- set /p"=%user%"<nul|base64>"!t_!"
- set /p v=<"!t_!"
- >>test echo !v!
- set /p"=%pass%"<nul|base64>"!t_!"
- set /p v=<"!t_!"
- >>test echo !v!
- del /f /q !t_!
- echo quit>>test
- call :发信程序 test
- cls
- for /f "tokens=1-2 delims=:" %%a in ('findstr /N . p-163ms.log') do (set "%%a=%%b")
- echo !5!|findstr "^235" >nul 2>nul ||(echo 登陆不成功)
- if errorlevel 1 goto :del_
- if exist post del /f /q post
- for /f "delims=" %%a in (test) do if not "%%a"=="quit" echo %%a >>post
- del /f /q test
- >>post echo mail from: ^<%user%@%server%^>
- >>post echo rcpt to: ^<%to%^>
- >>post echo data
- >>post echo From: %user%@%server%
- >>post echo To: %to%
- >>post echo Subject: %subject%
- >>post echo X-mailer: p-163ms 2.0
- >>post echo Mime-Version: 1.0
- >>post echo Content-Type: multipart/mixed;
- >>post echo boundary="=====vkill====="
- >>post echo.
- if defined content (
- >>post echo --=====vkill=====
- >>post echo Content-Type: text/plain;
- >>post echo charset="gb2312"
- >>post echo Content-Transfer-Encoding: 7bit
- >>post echo.
- dir !content! >nul 2>nul &&(type "!content!">>post) ||(>>post echo !content!)
- )
- echo 压缩编码文件中...
- if defined accessories for %%? in (%accessories%) do (call :压缩编码附件 "%%?")
- echo 给%to%发信中...
- call :发信程序 post
- cls
- for /f "tokens=1-2 delims=:" %%a in ('findstr /N . p-163ms.log') do (set "%%a=%%b")
- if not defined 10 echo.
- echo !9!|findstr "^250" >nul 2>nul ||echo.
- cls
- if errorlevel 1 echo 发信不成功 & goto del_
- call :del_
- echo 全部信件发送完毕
- ping -n 3 127.1>nul 2>nul
- goto :eof
- :del_
- del /f /q test >nul 2>nul
- del /f /q post >nul 2>nul
- del /f /q p-163ms.log>nul 2>nul
- goto :eof
- :发信程序
- for /f "tokens=2 delims=" %%? in ('ping -n 1 smtp.163.com ^|findstr /i "^Ping"') do (set "ip=%%?")
- nc -nvv !ip! %port%<%1>p-163ms.log
- goto :eof
- :压缩编码附件
- dir %~1 >nul 2>nul &&(call :压缩文件 "%~1" "rar.exe -r")||(call :压缩文件 "%~1" rar.exe)
- call :判断文件大小 "%~n1_.rar"
- >>post echo --=====vkill=====
- >>post echo Content-Type: application/octet-stream;
- >>post echo name="%~n1_.rar"
- >>post echo Content-Transfer-Encoding: base64
- >>post echo Content-Disposition: attachment;
- >>post echo filename="%~n1_.rar"
- >>post echo.
- base64.exe -i "%~n1_.rar">>post
- >>post echo.
- del /f/q "%~n1_.rar" >nul 2>nul
- >>post echo --=====vkill=====--
- >>post echo .
- >>post echo quit
- goto :eof
- :压缩文件
- %~2 a "%~n1_.rar" "%~1" >nul 2>nul||(echo 压缩文件错误)
- goto :eof
- :判断文件大小
- set/a z+=%~z1
- ::判断附件大小
- if not !z! lss %最大附件大小% (echo 附件大小超出)
- goto :eof
- :help
- if "%1"=="vkill" goto :eof
- echo ____help________________________________________________________________________
- echo.
- echo p-163ms v2.0 by:vkill
- echo Copyright (C) 2006-2008 http://www.vkill.net
- echo.
- echo Usage: p-163ms.cmd /u 用户名 /p 密码 /t 收件人 /s 主题
- echo.
- echo /x 交互模式,当使用此参数时别的参数全部无效
- echo /t 收件人:(多收件人中间用,隔开;多附件时用""引住)
- echo /c 内容:(文字/写好内容的文本文件路径)
- echo /a 附件:(绝对路径/相对路径,多附件中间用,隔开;多附件时用""引住)
- echo.
- echo 示例:
- echo p-163ms.cmd /u 123 /p abc /t "122755990@qq.com" /s hello
- echo p-163ms.cmd /u 123 /p abc /t "122755990@qq.com" /s hello /c 123 /a "d:\00.txt"
- echo p-163ms.cmd /u 123 /p abc /t "122755990@qq.com,yx127@yx127.com" /s hello /c 123 /a "d:\00.txt,c:\00.bat"
- echo.
- echo ________________________________________________________________________________
- goto :eof
- :iget.vbs_
- >iget.vbs echo x=LCase(WScript.Arguments(1))
- >>iget.vbs echo y=LCase(WScript.Arguments(0))
- >>iget.vbs echo Set xPost=CreateObject("Microsoft.XMLHTTP")
- >>iget.vbs echo xPost.Open "GET",y,0
- >>iget.vbs echo xPost.Send()
- >>iget.vbs echo Set sGet=CreateObject("ADODB.Stream")
- >>iget.vbs echo sGet.Mode=3
- >>iget.vbs echo sGet.Type=1
- >>iget.vbs echo sGet.Open()
- >>iget.vbs echo sGet.Write(xPost.responseBody)
- >>iget.vbs echo sGet.SaveToFile x,2
- goto :eof
BJSH发表于: 2007-04-25 14:59
According to Brother vkill's code; I rewrote it directly to generate test and post files; avoiding the summation and copying of 9 files; it is a bit easier to understand:
The code is as follows:
- @echo off&setlocal ENABLEDELAYEDEXPANSION
- set "t_=test.conf"
- set "server=163.com"
- set "port=25"
- set "Maximum attachment size=15000000"
- set "tools_url=http://www.vkill.net/netbar/Required exe for Internet cafes/"
- set "tools_name=nc.exe;rar.exe;base64.exe"
- set "user="
- set "pass="
- set "to="
- set "subject="
- set "content="
- set "accessories="
- :down_tools
- set "down_ok=y"
- if not "%tools_name%*"=="*" (
- for %%? in (%tools_name%) do (
- if *%%~$PATH:?==* if not exist %%? (
- set "down_ok=n"
- echo The dependent file of the program %%? is missing, and automatic download has started
- if not exist iget.vbs call :iget.vbs_
- iget.vbs "%tools_url%%%?" "%%?"
- echo File %%? has been downloaded
- )
- )
- )
- del /f/q iget.vbs>nul 2>nul
- if %down_ok%]== goto down_tools
- for %%? in (/? -? /h -h --h) do (if "%1"=="%%?" goto help)
- if "%1"=="" goto help
- :loop_ap
- set/a n+=1
- if not "%1"=="" (
- if "%1"=="/x" goto 交互模式
- if "%1"=="/u" set "user=%~2"
- if "%1"=="/p" set "pass=%~2"
- if "%1"=="/t" set "to=%~2"
- if "%1"=="/s" set "subject=%~2"
- if "%1"=="/c" set "content=%~2"
- if "%1"=="/a" set "accessories=%~2"
- shift&shift
- goto loop_ap
- )
- for %%? in (user pass to subject) do (
- if not defined %%? echo Incorrect parameter. One of the username/password/recipient/subject is missing & goto :eof
- )
- goto start
- :交互模式
- call :help vkill
- if not defined user (set/p "user=Username: ")
- if not defined pass (set/p "pass=Password: ")
- if not defined to (set/p "to=Recipient: ")
- if not defined subject (set/p "subject=Subject <hello>: ")
- if not defined content (set/p "content=Content: ")
- if not defined accessories (set/p "accessories=Attachment: ")
- :start
- echo helo vkill >test
- echo AUTH LOGIN >>test
- set /p"=%user%"<nul|base64>"!t_!"
- set /p v=<"!t_!"
- >>test echo !v!
- set /p"=%pass%"<nul|base64>"!t_!"
- set /p v=<"!t_!"
- >>test echo !v!
- del /f /q !t_!
- echo quit>>test
- call :发信程序 test
- cls
- for /f "tokens=1-2 delims=:" %%a in ('findstr /N . p-163ms.log') do (set "%%a=%%b")
- echo !5!|findstr "^235" >nul 2>nul ||(echo Login unsuccessful)
- if errorlevel 1 goto :del_
- if exist post del /f /q post
- for /f "delims=" %%a in (test) do if not "%%a"=="quit" echo %%a >>post
- del /f /q test
- >>post echo mail from: ^<%user%@%server%^>
- >>post echo rcpt to: ^<%to%^>
- >>post echo data
- >>post echo From: %user%@%server%
- >>post echo To: %to%
- >>post echo Subject: %subject%
- >>post echo X-mailer: p-163ms 2.0
- >>post echo Mime-Version: 1.0
- >>post echo Content-Type: multipart/mixed;
- >>post echo boundary="=====vkill====="
- >>post echo.
- if defined content (
- >>post echo --=====vkill=====
- >>post echo Content-Type: text/plain;
- >>post echo charset="gb2312"
- >>post echo Content-Transfer-Encoding: 7bit
- >>post echo.
- dir !content! >nul 2>nul &&(type "!content!">>post) ||(>>post echo !content!)
- )
- echo Compressing and encoding the file...
- if defined accessories for %%? in (%accessories%) do (call :压缩编码附件 "%%?")
- echo Sending email to %to%...
- call :发信程序 post
- cls
- for /f "tokens=1-2 delims=:" %%a in ('findstr /N . p-163ms.log') do (set "%%a=%%b")
- if not defined 10 echo.
- echo !9!|findstr "^250" >nul 2>nul ||echo.
- cls
- if errorlevel 1 echo Email sending unsuccessful & goto del_
- call :del_
- echo All emails sent successfully
- ping -n 3 127.1>nul 2>nul
- goto :eof
- :del_
- del /f /q test >nul 2>nul
- del /f /q post >nul 2>nul
- del /f /q p-163ms.log>nul 2>nul
- goto :eof
- :发信程序
- for /f "tokens=2 delims=" %%? in ('ping -n 1 smtp.163.com ^|findstr /i "^Ping"') do (set "ip=%%?")
- nc -nvv !ip! %port%<%1>p-163ms.log
- goto :eof
- :压缩编码附件
- dir %~1 >nul 2>nul &&(call :压缩文件 "%~1" "rar.exe -r")||(call :压缩文件 "%~1" rar.exe)
- call :判断文件大小 "%~n1_.rar"
- >>post echo --=====vkill=====
- >>post echo Content-Type: application/octet-stream;
- >>post echo name="%~n1_.rar"
- >>post echo Content-Transfer-Encoding: base64
- >>post echo Content-Disposition: attachment;
- >>post echo filename="%~n1_.rar"
- >>post echo .
- base64.exe -i "%~n1_.rar">>post
- >>post echo .
- del /f/q "%~n1_.rar" >nul 2>nul
- >>post echo --=====vkill=====--
- >>post echo .
- >>post echo quit
- goto :eof
- :压缩文件
- %~2 a "%~n1_.rar" "%~1" >nul 2>nul||(echo File compression error)
- goto :eof
- :判断文件大小
- set/a z+=%~z1
- ::Judge attachment size
- if not !z! lss %Maximum attachment size% (echo Attachment size exceeded)
- goto :eof
- :help
- if "%1"=="vkill" goto :eof
- echo ____help________________________________________________________________________
- echo.
- echo p-163ms v2.0 by:vkill
- echo Copyright (C) 2006-2008 http://www.vkill.net
- echo.
- echo Usage: p-163ms.cmd /u Username /p Password /t Recipient
- echo.
- echo /x Interactive mode. When this parameter is used, all other parameters are invalid
- echo /t Recipient: (Separate multiple recipients with,; enclose multiple attachments with""
- echo /c Content: (Text/path of a text file with written content)
- echo /a Attachment: (Absolute path/relative path, separate multiple attachments with,; enclose multiple attachments with""
- echo.
- echo Example:
- echo p-163ms.cmd /u 123 /p abc /t "122755990@qq.com" /s hello
- echo p-163ms.cmd /u 123 /p abc /t "122755990@qq.com" /s hello /c 123 /a "d:\00.txt"
- echo p-163ms.cmd /u 123 /p abc /t "122755990@qq.com,yx127@yx127.com" /s hello /c 123 /a "d:\00.txt,c:\00.bat"
- echo.
- echo ________________________________________________________________________________
- goto :eof
- :iget.vbs_
- >iget.vbs echo x=LCase(WScript.Arguments(1))
- >>iget.vbs echo y=LCase(WScript.Arguments(0))
- >>iget.vbs echo Set xPost=CreateObject("Microsoft.XMLHTTP")
- >>iget.vbs echo xPost.Open "GET",y,0
- >>iget.vbs echo xPost.Send()
- >>iget.vbs echo Set sGet=CreateObject("ADODB.Stream")
- >>iget.vbs echo sGet.Mode=3
- >>iget.vbs echo sGet.Type=1
- >>iget.vbs echo sGet.Open()
- >>iget.vbs echo sGet.Write(xPost.responseBody)
- >>iget.vbs echo sGet.SaveToFile x,2
- goto :eof
Posted by BJSH on: 2007-04-25 14:59
|
|
2007-4-26 04:12 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
『第 21 楼』:
使用 LLM 解释/回答一下
bjsh 兄
我用copy + + 完全是为了多方发送,因为多方发送的时候只是修改了rcpt to: ,其他的完全没有变,我用copy ++ 你发信的时候试试 start nc -nvv ...看看那样更快,呵呵
19楼的解释太精彩了,佩服
在:交互模式中
if not defined user (set/p=用户名:<nul&set/p "user= ")
完全可以简写为:if not defined user (set/p "user=用户名: ")
依次类推
我刚刚试了set/p "user=用户名: " 和set/p=用户名:<nul&set/p "user= "一样,谢谢兄指点
bjsh brother
I use copy + + entirely for multi-party sending, because when sending to multiple parties, only the rcpt to: is modified, and nothing else changes at all. Try start nc -nvv... when you send an email with copy ++, hehe
The explanation on floor 19 is wonderful,佩服
In interactive mode
if not defined user (set/p=用户名:<nul&set/p "user= ")
Can be completely abbreviated as: if not defined user (set/p "user=用户名: ")
And so on
I just tried set/p "user=用户名: " and set/p=用户名:<nul&set/p "user= " are the same, thank you brother for the guidance
|
|
2007-4-26 07:41 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
『第 22 楼』:
使用 LLM 解释/回答一下
还有看来bjsh 兄这么有意研究这个,再说说吧!
>>post echo mail from: ^<%user%@%server%^>
>>post echo rcpt to: ^<%to%^>
mail from:可以把这去掉,也可以写别的邮箱,应该也可以写文字之类的,类似匿名,哈哈
rcpt to: 可以把这去掉,这样别人就看不到你同时都给谁发了,我相信到mail.163.com是做不到这样的
还有看来bjsh 兄这么有意研究这个,再说说吧!
>>post echo mail from: ^<%user%@%server%^>
>>post echo rcpt to: ^<%to%^>
mail from: can remove this, or can write other email boxes, should also be able to write text and so on, similar to anonymous, haha
rcpt to: can remove this, so others can't see who you are sending to at the same time, I believe it's impossible to do this at mail.163.com
|
|
2007-4-26 07:44 |
|
|
bjsh
银牌会员
    
积分 2000
发帖 621
注册 2007-1-1
状态 离线
|
『第 23 楼』:
使用 LLM 解释/回答一下
bjsh 兄
我用copy + + 完全是为了多方发送,因为多方发送的时候只是修改了rcpt to: ,其他的完全没有变,我用copy ++ 你发信的时候试试 start nc -nvv ...看看那样更快,呵呵
原来如此啊!还真没想到多方发送;确实
Brother bjsh
I use copy ++ completely for multi-recipient sending. Because when sending to multiple recipients, only the rcpt to: is modified, and nothing else changes. Try start nc -nvv... when you send a message using copy ++, heh heh, that's faster.
Oh, I see! I really didn't expect multi-recipient sending; indeed
|
|
2007-4-26 07:44 |
|
|
bjsh
银牌会员
    
积分 2000
发帖 621
注册 2007-1-1
状态 离线
|
『第 24 楼』:
使用 LLM 解释/回答一下
我还想把他做成校内通用的;
可惜想了半天也没明白学校的邮件服务器用的是什么;
看了看似乎是80;
至于smtp完全是模仿你的;
至于含义真的是不懂;
有空真得去学学网络协议了;
如果vkill兄不嫌我郁闷;
帮我搞定学校内的邮件发送;真是感激不尽了;
I still want to make it universal within the school;
Unfortunately, after thinking for a long time, I didn't understand what the school's email server uses;
It seems to be 80;
As for smtp, it's completely imitating yours;
As for the meaning, I really don't understand;
I really need to learn network protocols when I have time;
If Brother vkill doesn't mind my being depressed;
Help me get the email sending done within the school; I'm really grateful;
|
|
2007-4-26 07:48 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
|
2007-4-26 07:51 |
|
|
bjsh
银牌会员
    
积分 2000
发帖 621
注册 2007-1-1
状态 离线
|
『第 26 楼』:
使用 LLM 解释/回答一下
25端口不开的;
问了学校的一些人
说smtp和pop3都不开放的;
Port 25 is not open;
Asked some people in the school
Said that both smtp and pop3 are not open;
|
|
2007-4-26 08:00 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
『第 27 楼』:
使用 LLM 解释/回答一下
bjsh 兄
可否有意一起写那?我想写为 p-mailsend ,支持更多的邮箱,最起码我想支持现在几个大站的,163 yahoo qq hotmail gmail 56 sina sohu 21cn ==
Usage: p-163ms.cmd /u 用户名@服务器 /p 密码 /t 收件人 /s 主题
Brother bjsh
Are you interested in writing together? I want to write p-mailsend to support more email boxes, at least I want to support several major ones now, 163 yahoo qq hotmail gmail 56 sina sohu 21cn ==
Usage: p-163ms.cmd /u username@server /p password /t recipient /s subject
|
|
2007-4-26 08:01 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
『第 28 楼』:
使用 LLM 解释/回答一下
Originally posted by bjsh at 2007-4-26 08:00:
25端口不开的;
问了学校的一些人
说smtp和pop3都不开放的;
这个不开放那用telnet就没有办法了,用foxmail OE ==也不可以,只有通过网页形式发了,你可以用vbs写个登陆邮箱发邮件的,呵呵,量体财衣了
Originally posted by bjsh at 2007-4-26 08:00:
Port 25 is not open;
Asked some people in the school
Said that SMTP and POP3 are not open;
If this is not open, then there is no way to use telnet. Using Foxmail, OE, etc. is also not possible. Only sending emails through the web form is possible. You can write a VBS to log in to the email and send an email. Hehe, it's customized.
|
|
2007-4-26 08:03 |
|
|
bjsh
银牌会员
    
积分 2000
发帖 621
注册 2007-1-1
状态 离线
|
『第 29 楼』:
使用 LLM 解释/回答一下
他的端口只有这些
80(HTTP)
21(FTP Control)
3306(MYSQL)
22(SSH)
389(LDAP)
确实得用vbs了;
五一写
He only has these ports:
80(HTTP)
21(FTP Control)
3306(MYSQL)
22(SSH)
389(LDAP)
Really need to use vbs;
Write in May Day
|
|
2007-4-26 08:14 |
|
|
bjsh
银牌会员
    
积分 2000
发帖 621
注册 2007-1-1
状态 离线
|
『第 30 楼』:
使用 LLM 解释/回答一下
Originally posted by vkill at 2007-4-25 07:01 PM:
bjsh 兄
可否有意一起写那?我想写为 p-mailsend ,支持更多的邮箱,最起码我想支持现在几个大站的,163 yahoo qq hotmail gmail 56 sina sohu 21cn ==
Usage: p-163m ...
好啊!
这样就可以和兄学习到好东西了;呵呵
Originally posted by vkill at 2007-4-25 07:01 PM:
Brother bjsh
Are you interested in writing together? I want to write p-mailsend to support more email boxes, at least I want to support several major sites now, 163 yahoo qq hotmail gmail 56 sina sohu 21cn ==
Usage: p-163m ...
Okay!
This way I can learn good things from you; hehe
|
|
2007-4-26 08:15 |
|