2014-10-26 15:05:51 +00:00
|
|
|
|
#pragma once
|
2014-09-07 18:54:46 +00:00
|
|
|
|
#include "base64.h"
|
2014-10-26 15:05:51 +00:00
|
|
|
|
|
2014-09-07 18:54:46 +00:00
|
|
|
|
#if defined(Q_OS_WIN32)
|
|
|
|
|
#pragma once
|
|
|
|
|
#include "iostream"
|
|
|
|
|
#include <time.h>
|
|
|
|
|
#include <process.h>
|
|
|
|
|
#include <conio.h>
|
|
|
|
|
#include <openssl/ssl.h>
|
|
|
|
|
#endif
|
|
|
|
|
#if defined(Q_OS_LINUX)
|
|
|
|
|
#pragma once
|
|
|
|
|
#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))
|
|
|
|
|
#define Sleep(secs) usleep((secs)*1000)
|
|
|
|
|
#define WSAGetLastError() errno
|
|
|
|
|
#define closesocket(sock) ::close((sock))
|
|
|
|
|
|
|
|
|
|
typedef unsigned int UINT;
|
|
|
|
|
typedef const char * LPCSTR;
|
|
|
|
|
typedef int SOCKET;
|
|
|
|
|
typedef hostent HOSTENT;
|
|
|
|
|
typedef struct linger LINGER;
|
|
|
|
|
typedef int BOOL;
|
|
|
|
|
#define INVALID_SOCKET (SOCKET)(~0)
|
|
|
|
|
#define SOCKET_ERROR (-1)
|
|
|
|
|
#define SD_BOTH 0x02
|
|
|
|
|
#define FAR far
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#define MAX_ADDR_LEN 128
|
2014-09-19 19:27:28 +00:00
|
|
|
|
#define TITLE_MAX_SIZE 512
|
|
|
|
|
#define COOKIE_MAX_SIZE 1024
|
|
|
|
|
|
2014-09-07 18:54:46 +00:00
|
|
|
|
struct PathStr{
|
|
|
|
|
char codepage[32];
|
2014-09-19 19:27:28 +00:00
|
|
|
|
char headr[TITLE_MAX_SIZE];
|
2014-09-07 18:54:46 +00:00
|
|
|
|
char path[1024];
|
|
|
|
|
int flag;
|
|
|
|
|
int port;
|
2014-09-19 19:27:28 +00:00
|
|
|
|
char ip[MAX_ADDR_LEN];
|
|
|
|
|
char cookie[COOKIE_MAX_SIZE];
|
2014-09-07 18:54:46 +00:00
|
|
|
|
};
|
2014-10-26 15:05:51 +00:00
|
|
|
|
|
2014-09-07 18:54:46 +00:00
|
|
|
|
struct lopaStr{
|
|
|
|
|
char login[128];
|
|
|
|
|
char pass[32];
|
|
|
|
|
char other[128];
|
|
|
|
|
};
|
2014-10-26 15:05:51 +00:00
|
|
|
|
|
|
|
|
|
struct conSTR{
|
|
|
|
|
char *lowerBuff;
|
|
|
|
|
int size;
|
|
|
|
|
};
|
|
|
|
|
|
2014-09-07 18:54:46 +00:00
|
|
|
|
class Lexems
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
int iterationCount, flag;
|
|
|
|
|
|
|
|
|
|
Lexems()
|
|
|
|
|
{
|
|
|
|
|
iterationCount = 0;
|
|
|
|
|
flag = 0;
|
|
|
|
|
};
|
|
|
|
|
~Lexems()
|
|
|
|
|
{
|
|
|
|
|
iterationCount = 0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int _header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std::vector<std::string> *lst, char *rBuff);
|
|
|
|
|
int _filler(int p, char* buffcpy, char* ipi, int recd, Lexems *lx, char *hl);
|
|
|
|
|
int globalSearchNeg(const char *buffcpy, char *ip, int port);
|
|
|
|
|
};
|
|
|
|
|
|
2014-10-26 15:05:51 +00:00
|
|
|
|
|
2014-09-07 18:54:46 +00:00
|
|
|
|
class Connector
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
int _Updater();
|
|
|
|
|
|
|
|
|
|
lopaStr _FTPLobby(char *ip, int port, PathStr *ps);
|
|
|
|
|
lopaStr _BALobby(char *cookie, char *ip, int port, char *path, char *method, char *data);
|
|
|
|
|
lopaStr _WFLobby(char *cookie, char *ip, int port, char *methodVal, char *actionVal, char *userVal, char *passVal, char *formVal);
|
|
|
|
|
lopaStr _IPCameraBLobby(char *ip, int port, char *SPEC);
|
2014-11-01 18:31:40 +00:00
|
|
|
|
int _SSHLobby(char *ip, int port, conSTR *CSTR);
|
2014-09-07 18:54:46 +00:00
|
|
|
|
|
|
|
|
|
int _EstablishConnection(char *ip, int port, char *request, conSTR *cstr, int force = 0);
|
|
|
|
|
int _EstablishSSLConnection(char *ip, int port, char *request, conSTR *cstr);
|
|
|
|
|
void _Connect(void *s);
|
2014-10-19 10:39:27 +00:00
|
|
|
|
int _ConnectToPort(char *ip, const char *port, char *hl);
|
2014-09-07 18:54:46 +00:00
|
|
|
|
};
|
|
|
|
|
|