-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModules.cs
225 lines (224 loc) · 5.67 KB
/
Modules.cs
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
using MSC.Brute;
using System.Collections.Generic;
namespace MSC.Script
{
public enum OpCode
{
Cookies,
URL,
KeepAlive,
Method,
SourcePage,
MemoryString,
Ret,
UserAgent,
TimeOut,
Gzip,
Headers,
AddHeader,
Redirect,
ContectType,
Referer,
DataSet,
PostData,
RequestManage,
AllowAutoRedirect,
AddAuthorization,
SetConfig,
Unkown
}
public enum MethodType
{
Config,
Request,
Print,
Base,
Unkown
}
public class MemoryString
{
List<string> ListM { set; get; }
public void Creat()
{
ListM = new List<string>();
}
public void AddString(string Input)
{
ListM.Add(Input);
}
public string GetString(int Index)
{
return ListM[Index];
}
}
public class RequestDef
{
RequestManage Request { set; get; }
public RequestDef Helper { set; get; }
public ConfigDef configdef { set; get; }
Requester Rr = new Requester();
public RequestManage GetManage()
{
return Request;
}
public void Create()
{
Request = new RequestManage();
}
public string GetLocation()
{
return Request.Location;
}
public string GetSourcePage()
{
return Request.SourcePage;
}
public string GetCookies()
{
return Request.CookiesString;
}
public void GetData()
{
try {
Request = Rr.GETData(configdef.GetConfig(), Helper.Request);
}
catch {
try {
Request = Rr.GETData(configdef.GetConfig());
}
catch { }
}
}
public void PostData()
{
try {
Request = Rr.POSTData(configdef.GetConfig(), Helper.Request); }
catch {
try {
Request = Rr.POSTData(configdef.GetConfig());
}
catch { }
}
}
}
public class ConfigDef
{
Config config { set; get; }
public void Create()
{
config = new Config();
}
public void SetConfig(Config _config)
{
config = _config;
}
public Config GetConfig()
{
return config;
}
public void SetDataSet(string Value)
{
config.DataSet = Value;
}
public void SetPostData(string Value)
{
config.PostData = Value;
}
public void SetCookes(string Value)
{
config.Cookies = Value;
}
public void SetUserAgent(string Value)
{
config.UserAgent = Value;
}
public void AddAuthorization(string Value)
{
config.AddAuthorization(Value);
}
public void SetURL(string Value)
{
config.LoginURL = Value;
}
public void SetURL(string Value,bool SetReferer)
{
config.LoginURL = Value;
if (SetReferer)
config.Referer = Value;
}
public void SetReferer(string Value)
{
config.Referer = Value;
}
public void SetContectType(string Value)
{
config.ContectType = Value;
}
public void SetHeaders(string Value)
{
config.Headers = Value;
}
public void AddHeaders(string Value)
{
config.AddHeader(Value);
}
public void SetGzipDecomprossor(string Value)
{
config.DecompressionGZip = ParseBool(Value);
}
public void SetAllowAutoRedirect(string Value)
{
config.AllowAutoRedirect = ParseBool(Value);
}
public void SetTimeOut(string Value)
{
config.TimeOut = int.Parse(Value);
}
public void SetMethod(string Value)
{
MSC.Method method;
switch (Value.ToString().ToLower())
{
case "get":
method = MSC.Method.GET;
break;
case "post":
method = MSC.Method.POST;
break;
case "put":
method = MSC.Method.PUT;
break;
default:
throw new System.Exception("Unkown Method!");
}
config.Method = method;
}
public void SetKeepAlive(string Value)
{
config.KeepAlive = ParseBool(Value);
}
private static bool ParseBool(string Value)
{
bool flag;
switch (Value)
{
case "0":
flag = false;
break;
case "1":
flag = true;
break;
case "true":
flag = true;
break;
case "false":
flag = false;
break;
default:
flag = false;
break;
}
return flag;
}
}
}