-
Notifications
You must be signed in to change notification settings - Fork 4
/
mainform.cs
386 lines (369 loc) · 13.7 KB
/
mainform.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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
using System;
using System.Collections.Generic;
using System.IO;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
using Leaf.xNet;
using System.Text.RegularExpressions;
using System.Diagnostics;
using Newtonsoft.Json.Linq;
namespace ViperDehasher
{
public partial class mainform : Form
{
static string Date = DateTime.Now.ToString("MM-dd-yyyy-hh-mm-ss").ToString();
public static ReaderWriterLockSlim Lock = new ReaderWriterLockSlim();
int hashsplit;
int itemsplit;
int progress;
int yes; //lazy name sry :/ but its to know if the hash was found or not and it counts it :D
int MD5;
int DMD5;
int SHA1;
int SHA3;
int SHA256;
int SHA384;
int SHA512;
int MYSQL5;
int MYSQL3;
public mainform()
{
InitializeComponent();
comboBox1.SelectedIndex = 0;
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
Clipboard.SetText(textBox2.Text);
}
private void button2_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog
{
Filter = "Text Files (*.txt)|*.txt",
Multiselect = false
};
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
try
{
textBox1.Lines = File.ReadAllLines(openFileDialog.FileName);
}
catch (Exception ex)
{
MessageBox.Show("Error while reading the file: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void UpdateValues()
{
BeginInvoke((MethodInvoker)delegate
{
listBox1.Items[0] = progress.ToString() + "/" + textBox1.Lines.Count().ToString();
listBox1.Items[1] = "Found: " + yes.ToString();
listBox1.Items[3] = "MD5: " + MD5.ToString();
listBox1.Items[4] = "Double MD5: " + DMD5.ToString();
listBox1.Items[5] = "SHA1: " + SHA1.ToString();
listBox1.Items[6] = "SHA3: " + SHA3.ToString();
listBox1.Items[7] = "SHA256: " + SHA256.ToString();
listBox1.Items[8] = "SHA384: " + SHA384.ToString();
listBox1.Items[9] = "SHA512: " + SHA512.ToString();
listBox1.Items[10] = "MYSQL5: " + MYSQL5.ToString();
listBox1.Items[11] = "MYSQL3: " + MYSQL3.ToString();
});
}
private async void startbttn_Click(object sender, EventArgs e)
{
progress = 0;
yes = 0;
MD5 = 0;
DMD5 = 0;
SHA1 = 0;
SHA3 = 0;
SHA256 = 0;
SHA384 = 0;
SHA512 = 0;
MYSQL5 = 0;
MYSQL3 = 0;
startbttn.Text = "Running";
startbttn.Enabled = false;
textBox1.Enabled = false;
updatetimer.Start();
await Task.Factory.StartNew(delegate () { UpdateValues(); });
var options = new ParallelOptions { MaxDegreeOfParallelism = (int)threads.Value };
await Task.Run(() =>
{
Parallel.ForEach(textBox1.Lines.ToList(), options, line =>
{
Dehash(line);
});
});
startbttn.Enabled = true;
textBox1.Enabled = true;
startbttn.Text = "Start";
updatetimer.Stop();
}
private void SafeWrite(string line)
{
if (textBox2.InvokeRequired)
{
textBox2.Invoke(new Action<string>(SafeWrite), line);
}
else
{
textBox2.AppendText(line + Environment.NewLine);
}
}
private void SortSave(string type, string dehashed, string item)
{
SafeWrite(item + ":" + dehashed);
Export("all.txt", item + ":" + dehashed);
if (type == "md5")
{
MD5++;
Export("md5.txt", item + ":" + dehashed);
}
else if (type == "double_md5")
{
DMD5++;
Export("double_md5.txt", item + ":" + dehashed);
}
else if (type == "sha1")
{
SHA1++;
Export("sha1.txt", item + ":" + dehashed);
}
else if (type == "sha3")
{
SHA3++;
Export("sha3.txt", item + ":" + dehashed);
}
else if (type == "sha256")
{
SHA256++;
Export("sha256.txt", item + ":" + dehashed);
}
else if (type == "sha384")
{
SHA384++;
Export("sha384.txt", item + ":" + dehashed);
}
else if (type == "sha512")
{
SHA512++;
Export("sha512.txt", item + ":" + dehashed);
}
else if (type == "mysql5")
{
MYSQL5++;
Export("mysql5.txt", item + ":" + dehashed);
}
else if (type == "mysql3")
{
MYSQL3++;
Export("mysql3.txt", item + ":" + dehashed);
}
else
{
Export("unknowntype.txt", item + ":" + dehashed);
}
}
private static (string, string) HashToolKit(string hash)
{
try
{
HttpRequest request = new HttpRequest();
request.IgnoreProtocolErrors = true;
request.UserAgent = Http.ChromeUserAgent();
string req = request.Get("https://hashtoolkit.com/decrypt-hash/?hash=" + hash).ToString();
Match match = Regex.Match(req, @"(?<=<div class=""panel-heading""><h1 class=""res-header"">Hashes for: <code>).+?(?=</code></h1></div>)");
if (match.Success)
{
string dehashed = match.Groups[0].Value;
if (dehashed != hash)
{
string type = Regex.Match(req, @"(?<=<span title=""decrypted ).+?(?= hash)").Groups[0].Value;
return (type, dehashed);
}
}
return ("", "");
}
catch
{
return ("", "");
}
}
private static (string, string) BlueCode(string hash)
{
List<(Regex, string)> identify = new List<(Regex, string)>
{
(new Regex(@"^[a-fA-F0-9]{32}$"), "md5"),
(new Regex(@"^[a-fA-F0-9]{40}$"), "sha1"),
(new Regex(@"^\*[a-fA-F0-9]{40}$"), "mysql5"),
(new Regex(@"^[a-fA-F0-9]{16}$"), "mysql3"),
(new Regex(@"^[a-fA-F0-9]{64}$"), "sha256"),
(new Regex(@"^[a-fA-F0-9]{128}$"), "sha512")
};
string type = "";
foreach ((Regex ex, string t) in identify)
{
if (ex.IsMatch(hash)) { type = t; }
}
if (!string.IsNullOrEmpty(type))
{
try
{
HttpRequest request = new HttpRequest();
request.IgnoreProtocolErrors = true;
request.UserAgent = "MD5 LITE 2.4.5";
string req = request.Get("http://lite.bluecode.info/?search%5B%5D=" + hash).ToString();
Match match = Regex.Match(req, @"(?<="":"").+?(?=""})");
return (type, match.Groups[0].Value);
}
catch { }
}
return ("", "");
}
private void Dehash(string line)
{
try
{
string[] com = line.Split(textBox3.Text.ToCharArray());
string hash = com[hashsplit];
string item = com[itemsplit];
bool found = false;
if (hash.Length >= 16)
{
var output = HashToolKit(hash);
if (!string.IsNullOrEmpty(output.Item1))
{
SortSave(output.Item1.ToLower(), output.Item2, item);
found = true;
}
if (!found)
{
(string type, string dehashed) = BlueCode(hash);
if (!string.IsNullOrEmpty(dehashed))
{
SortSave(type, dehashed, item);
found = true;
}
}
if (!found & hash.Length == 16)
{
try
{
HttpRequest request = new HttpRequest();
request.IgnoreProtocolErrors = true;
request.UserAgent = Http.ChromeUserAgent();
string req = request.Get("https://www.nitrxgen.net/md5db/" + hash).ToString();
if (!string.IsNullOrEmpty(req))
{
SortSave("md5", req, item);
found = true;
}
}
catch { }
if (!found)
{
try
{
HttpRequest request = new HttpRequest();
request.IgnoreProtocolErrors = true;
request.UserAgent = Http.ChromeUserAgent();
string req = request.Get("https://md5.gromweb.com/?md5=" + hash).ToString();
Match match = Regex.Match(req, @"(?<=<em class=""long-content string"">).+?(?=</em></p>)");
string dehashed = match.Groups[0].Value;
if (!string.IsNullOrEmpty(dehashed))
{
SortSave("md5", dehashed, item);
found = true;
}
}
catch { }
}
}
if (!found)
{
try
{
HttpRequest request = new HttpRequest();
request.IgnoreProtocolErrors = true;
request.UserAgent = Http.ChromeUserAgent();
string req = request.Get("https://sha1.gromweb.com/?hash=" + hash).ToString();
Match match = Regex.Match(req, @"(?<=<em class=""long-content string"">).+?(?=</em></p>)");
string dehashed = match.Groups[0].Value;
if (!string.IsNullOrEmpty(dehashed))
{
SortSave("sha1", dehashed, item);
found = true;
}
}
catch { }
}
}
progress++;
if (found) { yes++; }
}
catch { progress++; }
}
public static void Export(string fileName, string DataToSave)
{
Lock.EnterWriteLock();
if (!Directory.Exists("Results"))
{
Directory.CreateDirectory("Results");
}
if (!Directory.Exists("Results\\" + Date))
{
Directory.CreateDirectory("Results\\" + Date);
}
try
{
using (StreamWriter streamWriter = File.AppendText(string.Concat(new string[]
{
"Results\\", Date, "\\", fileName
})))
{
streamWriter.WriteLine(DataToSave);
streamWriter.Close();
}
}
finally
{
Lock.ExitWriteLock();
}
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
//0 Item:Hash
//1 Hash:Item
int selectedIndex = comboBox1.SelectedIndex;
if (selectedIndex == 0)
{
hashsplit = 1;
itemsplit = 0;
}
if (selectedIndex == 1)
{
hashsplit = 0;
itemsplit = 1;
}
}
private void label3_Click(object sender, EventArgs e)
{
Process.Start("https://github.com/machinekillin");
}
private void updatetimer_Tick(object sender, EventArgs e)
{
UpdateValues();
}
}
}