2015-03-05 14:29:05 +00:00
|
|
|
#ifndef CONNECTOR_H
|
|
|
|
#define CONNECTOR_H
|
|
|
|
|
2015-03-13 14:27:21 +00:00
|
|
|
#include "STh.h"
|
2015-03-23 17:11:00 +00:00
|
|
|
#include "BruteUtils.h"
|
2015-03-07 17:31:48 +00:00
|
|
|
|
|
|
|
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
|
|
|
#include <iphlpapi.h>
|
|
|
|
#include <icmpapi.h>
|
|
|
|
#pragma comment(lib, "iphlpapi.lib")
|
|
|
|
#pragma comment(lib,"curllib.lib")
|
|
|
|
#endif
|
2015-08-07 22:37:28 +00:00
|
|
|
|
|
|
|
#include <openssl/err.h>
|
|
|
|
|
|
|
|
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
|
|
|
#define MUTEX_TYPE HANDLE
|
|
|
|
#define MUTEX_SETUP(x) (x) = CreateMutex(NULL, FALSE, NULL)
|
|
|
|
#define MUTEX_CLEANUP(x) CloseHandle(x)
|
|
|
|
#define MUTEX_LOCK(x) WaitForSingleObject((x), INFINITE)
|
|
|
|
#define MUTEX_UNLOCK(x) ReleaseMutex(x)
|
|
|
|
#define THREAD_ID GetCurrentThreadId()
|
|
|
|
#else
|
|
|
|
#include <pthread.h>
|
|
|
|
#define MUTEX_TYPE pthread_mutex_t
|
|
|
|
#define MUTEX_SETUP(x) pthread_mutex_init(&(x), NULL)
|
|
|
|
#define MUTEX_CLEANUP(x) pthread_mutex_destroy(&(x))
|
|
|
|
#define MUTEX_LOCK(x) pthread_mutex_lock(&(x))
|
|
|
|
#define MUTEX_UNLOCK(x) pthread_mutex_unlock(&(x))
|
|
|
|
#define THREAD_ID pthread_self()
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2015-03-06 14:32:36 +00:00
|
|
|
class Connector {
|
2015-03-05 14:29:05 +00:00
|
|
|
|
|
|
|
public:
|
2015-04-28 23:27:54 +00:00
|
|
|
int nConnect(const char* ip, const int port, std::string *buffer,
|
2015-03-16 14:29:34 +00:00
|
|
|
const char *postData = NULL,
|
|
|
|
const std::vector<std::string> *customHeaders = NULL,
|
2015-04-18 23:00:40 +00:00
|
|
|
const std::string *lpString = NULL,
|
|
|
|
bool digestMode = false);
|
2015-04-28 23:27:54 +00:00
|
|
|
int connectToPort(char *ip, int port);
|
2015-03-05 14:29:05 +00:00
|
|
|
};
|
|
|
|
#endif // CONNECTOR_H
|