2015-03-22 00:43:15 +00:00
|
|
|
#pragma once
|
2015-02-24 14:00:19 +00:00
|
|
|
#include "base64.h"
|
|
|
|
|
2015-02-24 14:14:32 +00:00
|
|
|
#include <libssh/libssh.h>
|
2015-03-02 14:27:38 +00:00
|
|
|
#include <curl/curl.h>
|
2015-04-14 11:58:33 +00:00
|
|
|
#include <vector>
|
2015-02-24 14:14:32 +00:00
|
|
|
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
2015-02-24 14:00:19 +00:00
|
|
|
#include "iostream"
|
|
|
|
#include <time.h>
|
|
|
|
#include <process.h>
|
|
|
|
#include <conio.h>
|
2015-02-24 14:14:32 +00:00
|
|
|
#else
|
2015-02-24 14:00:19 +00:00
|
|
|
#include <string>
|
|
|
|
#include <iostream>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
#include <pthread.h>
|
|
|
|
#include <netdb.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <cstring>
|
|
|
|
|
|
|
|
#define ZeroMemory(Destination,Length) memset((Destination),0,(Length))
|
2015-03-10 14:35:50 +00:00
|
|
|
#define Sleep(msecs) usleep((msecs)*1000)
|
2015-02-24 14:00:19 +00:00
|
|
|
#define WSAGetLastError() errno
|
|
|
|
#define closesocket(sock) ::close((sock))
|
|
|
|
|
2015-02-24 14:14:32 +00:00
|
|
|
typedef unsigned int DWORD;
|
|
|
|
typedef void* LPVOID;
|
|
|
|
typedef void* HANDLE;
|
2015-02-24 14:00:19 +00:00
|
|
|
typedef unsigned int UINT;
|
|
|
|
typedef const char * LPCSTR;
|
|
|
|
typedef int SOCKET;
|
2015-02-26 14:20:37 +00:00
|
|
|
typedef hostent HOSTENT;
|
|
|
|
typedef struct linger LINGER;
|
2015-02-24 14:00:19 +00:00
|
|
|
typedef int BOOL;
|
2015-02-24 14:14:32 +00:00
|
|
|
|
2015-02-27 13:55:35 +00:00
|
|
|
#define SD_BOTH 0x02
|
|
|
|
#ifndef FAR
|
|
|
|
#define FAR far
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef INVALID_SOCKET
|
|
|
|
#define INVALID_SOCKET (SOCKET)(~0)
|
|
|
|
#endif
|
|
|
|
#ifndef SOCKET_ERROR
|
|
|
|
#define SOCKET_ERROR (-1)
|
|
|
|
#endif
|
2015-02-27 17:40:12 +00:00
|
|
|
#ifndef WSAEWOULDBLOCK
|
|
|
|
#define WSAEWOULDBLOCK EWOULDBLOCK //10035
|
2015-02-27 13:55:35 +00:00
|
|
|
#endif
|
2015-02-27 17:40:12 +00:00
|
|
|
#ifndef WSAEINPROGRESS
|
|
|
|
#define WSAEINPROGRESS EINPROGRESS //10036
|
2015-02-27 13:55:35 +00:00
|
|
|
#endif
|
2015-02-27 17:40:12 +00:00
|
|
|
#ifndef WSAENOTSOCK
|
|
|
|
#define WSAENOTSOCK ENOTSOCK //10038
|
2015-02-27 13:55:35 +00:00
|
|
|
#endif
|
2015-02-27 17:40:12 +00:00
|
|
|
#ifndef WSAEADDRNOTAVAIL
|
|
|
|
#define WSAEADDRNOTAVAIL EADDRNOTAVAIL //10049
|
2015-02-27 13:55:35 +00:00
|
|
|
#endif
|
2015-02-27 17:40:12 +00:00
|
|
|
#ifndef WSAECONNRESET
|
|
|
|
#define WSAECONNRESET ECONNRESET //10054
|
2015-02-27 13:55:35 +00:00
|
|
|
#endif
|
2015-02-27 17:40:12 +00:00
|
|
|
#ifndef WSAENOBUFS
|
|
|
|
#define WSAENOBUFS ENOBUFS //10055
|
2015-02-27 13:55:35 +00:00
|
|
|
#endif
|
2015-02-27 17:40:12 +00:00
|
|
|
#ifndef WSAETIMEDOUT
|
|
|
|
#define WSAETIMEDOUT ETIMEDOUT //10060
|
|
|
|
#endif
|
|
|
|
#ifndef WSAECONNREFUSED
|
|
|
|
#define WSAECONNREFUSED ECONNREFUSED //10061
|
2015-02-27 13:55:35 +00:00
|
|
|
#endif
|
|
|
|
|
2015-02-24 14:00:19 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define TITLE_MAX_SIZE 512
|
|
|
|
#define COOKIE_MAX_SIZE 1024
|
2015-03-17 14:30:53 +00:00
|
|
|
#define RESULT_DIR_NAME "./result_files-" __DATE__
|
|
|
|
|
2015-03-20 14:28:51 +00:00
|
|
|
#ifndef MAX_ADDR_LEN
|
|
|
|
#define MAX_ADDR_LEN 128
|
|
|
|
#endif
|
|
|
|
|
2015-02-24 14:00:19 +00:00
|
|
|
struct PathStr{
|
|
|
|
char codepage[32];
|
|
|
|
char headr[TITLE_MAX_SIZE];
|
|
|
|
char path[1024];
|
|
|
|
int flag;
|
|
|
|
int port;
|
|
|
|
char ip[MAX_ADDR_LEN];
|
|
|
|
char cookie[COOKIE_MAX_SIZE];
|
|
|
|
int directoryCount;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct lopaStr{
|
2015-03-22 00:43:15 +00:00
|
|
|
char login[128];
|
|
|
|
char pass[32];
|
2015-02-24 14:00:19 +00:00
|
|
|
char other[128];
|
|
|
|
};
|
|
|
|
|
|
|
|
class Lexems
|
2015-03-22 00:43:15 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
int iterationCount, flag;
|
|
|
|
|
|
|
|
Lexems()
|
|
|
|
{
|
|
|
|
iterationCount = 0;
|
|
|
|
flag = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
~Lexems()
|
2015-02-24 14:00:19 +00:00
|
|
|
{
|
2015-03-22 00:43:15 +00:00
|
|
|
iterationCount = 0;
|
|
|
|
}
|
|
|
|
|
2015-04-18 13:05:35 +00:00
|
|
|
int header(char *ip,
|
2015-04-01 12:39:14 +00:00
|
|
|
int port,
|
|
|
|
const char str[],
|
|
|
|
Lexems *l,
|
|
|
|
PathStr *ps,
|
|
|
|
std::vector<std::string> *lst, int size);
|
|
|
|
|
2015-04-18 13:05:35 +00:00
|
|
|
int filler(char* ip,
|
|
|
|
int port,
|
|
|
|
const std::string *buffcpy,
|
2015-04-01 12:39:14 +00:00
|
|
|
int size,
|
|
|
|
Lexems *lx);
|
2015-03-22 00:43:15 +00:00
|
|
|
};
|