-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathWebShell.h
83 lines (72 loc) · 2.32 KB
/
WebShell.h
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/**************************************************************************
Copyright:Image
Author: Image
Date:2017-09-10
Description:phpwebshell main class
***************************************************************************/
#pragma once
#include"curlhelper.h"
#include"cryptohelper.h"
using namespace std;
enum PLACE { PLACE_POST,PLACE_GET,HEADER,COOKIE };
class WebShell
{
private:
string url;
METHOD Method;
string pass;
bool enabled;
string php_version;
string kernel_version;
string webroot;
vector<string> disabled_functions;
vector<pair<ENCRYPT_METHOD,string>> EncryptMethod;
pair<PLACE,string> place;
map<string, string>addon_post;
map<string, string>addon_get;
map<string,string>customCookies;
map<string,string>customHeaders;
string SQLhost;
string SQLuser;
string SQLpass;
string SQLport;
bool initialized;
public:
WebShell() {};
WebShell(string addr, METHOD meth, string password, PLACE paramplace=PLACE_GET, string paramvalue = "Image");
//WebShell(string json_obb);
string getUrl() { return this->url; }
METHOD getMethod() { return this->Method; }
string get_webroot();
string get_php_version();
string get_kernel_version();
void initialize();
bool check_connection();
void ParseMethod(string meth);
void get_disabled_functions();
void addClientMethod(ENCRYPT_METHOD meth, string param);
void addAddonPost(string param, string value);
void addAddonGet(string param, string value);
void setPlace(string place, string paramvlue);
void setSQLconnection(string host, string user, string pass, string port = "3306");
void addHeader(string param,string paramvalue);
void addCookie(string param,string paramvalue);
CURLcode ShellCommandExec(string command,string&ans);
CURLcode php_exec(string command, string&ans, map<string, string>*addonparams=NULL);
CURLcode GetFileList(string&ans,string directory="");
CURLcode GetFile(string filename, string downname);
CURLcode UploadFile(string filename, string updir);
CURLcode ExecSQL(string sql, string db, string&ans);
//bool isFileExists(string filename);
string encode(string command);
string getAddress(){return url;}
~WebShell();
/*WebShell operator=(WebShell shell) {
this->url = shell.url;
this->pass = shell.pass;
this->place = shell.place;
this->EncryptMethod = shell.EncryptMethod;
this->Method = shell.Method;
return *this;
}*/
};