[
],老问题了,是不是要写木马啊?
直接用API来写就可以了.
下面是某程序的部分片段,看懂后相信你的问题就OK了.
--------------------------------------------------
program XXXX;
uses
windows,messages,winsock,sysutils;
{$R *.RES}
const
CRLF=#13#10;
var
thd:array[1..1000] of integer;
tid:array[1..1000] of dword;
faint,hMutex,mcount,speed,newtime,oldtime,num,count,err:integer;
s1:string;
sbuf:array[0..1024] of char;
dest:string;
allstart:boolean;
//以下是网络连接的过程
function StartNet(host:string;port:integer):integer;
var
wsadata:twsadata;
fsocket:integer;
SockAddrIn:TSockAddrIn;
mct,err:integer;
begin
//为网络连接作好准备(用winsock1.1以上版本)
err:=WSAStartup($0101,WSAData);
//创建一个客户端套接字(Client Socket,用SOCK_STREAM,即TCP协义)
FSocket := socket(PF_INET, SOCK_STREAM,IPPROTO_IP);
//初始化网络数据
SockAddrIn.sin_addr.s_addr:=inet_addr(PChar(host));
SockAddrIn.sin_family := PF_INET;
SockAddrIn.sin_port :=htons(port);
//客户端向smtp进行连接
mct:=0;
repeat
err:=connect(FSocket,SockAddrIn, SizeOf(SockAddrIn));
inc(mct);
if mct>0 then break;
until err=0;
Result:=FSocket;
end;
//以下是网络关闭的过程
procedure StopNet(Fsocket:integer);
var
err:integer;
begin
//发信结束,关闭客户端套接字(Close Client Socket)
err:=closesocket(FSocket);
//清除网络参数
err:=WSACleanup;
end;
function PostData(uid,pid:string):integer;
const
MaxSize=1024;
var
FSocket:integer;
HeadStr,PostStr:string;
DataBuf:array[0..MaxSize*60] of char;
TmpBuf:array[0..MaxSize*16] of char;
SubStr:array[0..MaxSize] of char;
err,cut:integer;
begin
// repeat
FSocket:=StartNet('202.104.32.236',80);
// PostData(FSocket,dest);
//--------------------申请第一步-------------------------------------
PostStr:=//下面是POST数据部分
'FullName=&NewUserName='+uid+'&DomainName=21cn.com&submit.x=33&submit.y=10';
HeadStr:=//下面是HEAD数据部分
'POST /extend/gb/std/NULL/NULL/register.gen HTTP/1.1'+CRLF+
'Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, application/vnd.ms-powerpoint, */*'+CRLF+
'Accept-Language: zh-cn'+CRLF+
'Content-Type: application/x-www-form-urlencoded'+CRLF+
'Accept-Encoding: gzip, deflate'+CRLF+
'User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)'+CRLF+
'Host: webmail.21cn.com'+CRLF+ //webmail.21cn.com=202.104.32.236
'Connection: Keep-Alive'+CRLF+
'Referer: http://webmail.21cn.com/extend/gb/UserName.htm'+CRLF+
'Content-Length: '+inttostr(length(PostStr))+CRLF+CRLF;
strcopy(DataBuf,pchar(HeadStr+PostStr+CRLF));
err:=send(FSocket,DataBuf,strlen(DataBuf),MSG_DONTROUTE);
strcopy(DataBuf,pchar(''));
repeat
err:=recv(FSocket,TmpBuf,MaxSize,0);
strcopy(DataBuf,pchar(strpas(DataBuf)+strpas(TmpBuf)));
until err<=0;
strcopy(SubStr,pchar('已经被占用了'));
if AnsiStrPos(DataBuf,SubStr)<>nil then
WriteCaption(hEditEMail,pchar('用户已存在'));
strcopy(SubStr,pchar('用户名太短'));
if AnsiStrPos(DataBuf,SubStr)<>nil then
WriteCaption(hEditEMail,pchar('用户名太短'));
strcopy(SubStr,pchar('非法字符'));
if AnsiStrPos(DataBuf,SubStr)<>nil then
WriteCaption(hEditEMail,pchar('非法字符'));
WriteCaption(handle,pchar(inttostr(strlen(DataBuf))));
StopNet(Fsocket);
// WriteCaption(hEditCount,pchar(inttostr(strlen(DataBuf))));
// until err>0;
//------------------------------
FSocket:=StartNet('202.104.32.236',80);
//--------------------申请第二步-------------------------------------
PostStr:=//下面是POST数据部分
'Agree=Agree&DomainName=21cn.com&NewUserName='+uid+'&Version=2&'+
'LastName=xxx&CommonName=xxx&Password='+pid+'&ConfirmPassword='+pid+'&PasswordReminderQuestion=xxx&PasswordReminderAnswer=xxx'+
'&PersonalID=&Gender=0&birth_year=1999&birth_month=1&birth_day=1&MailBox=&PasswordReminderAnswer3=&Country=Null&Province=Null&City=';
HeadStr:=//下面是HEAD数据部分
'POST /extend/gb/std/NULL/NULL/AddUser1.gen HTTP/1.1'+CRLF+
'Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, application/vnd.ms-powerpoint, */*'+CRLF+
'Accept-Language: zh-cn'+CRLF+
'Content-Type: application/x-www-form-urlencoded'+CRLF+
'Accept-Encoding: gzip, deflate'+CRLF+
'User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)'+CRLF+
'Host: webmail.21cn.com'+CRLF+ //webmail.21cn.com=202.104.32.236
'Connection: Keep-Alive'+CRLF+
'Referer: http://webmail.21cn.com/extend/gb/std/NULL/NULL/register.gen?FullName=&NewUserName='+uid+'&DomainName=21cn.com&submit.x=33&submit.y=10'+CRLF+
'Content-Length: '+inttostr(length(PostStr))+CRLF+CRLF;
strcopy(DataBuf,pchar(HeadStr+PostStr+CRLF));
err:=send(FSocket,DataBuf,strlen(DataBuf),MSG_DONTROUTE);
strcopy(DataBuf,pchar(''));
repeat
err:=recv(FSocket,TmpBuf,MaxSize,0);
strcopy(DataBuf,pchar(strpas(DataBuf)+strpas(TmpBuf)));
until err<=0;
strcopy(SubStr,pchar('你已经成功'));
if AnsiStrPos(DataBuf,SubStr)<>nil then WriteCaption(hEditEMail,pchar('申请成功!'));
//WriteCaption(hEditCount,pchar(inttostr(strlen(DataBuf))));
StopNet(Fsocket);
end;
//------------------------------------
//以下是线程创建时调用的线程函数
function fun(Parameter: Pointer): Integer; stdcall;
var
uid,pid:string;
begin
ReadCaption(hEditEmail,sbuf);uid:=strpas(sbuf);
ReadCaption(hEditCount,sbuf);pid:=strpas(sbuf);
PostData(uid,pid);
result:=0;
end;