|
| 1 | +using System.Diagnostics; |
| 2 | +using System.Text.RegularExpressions; |
| 3 | +using Mono.Cecil; |
| 4 | + |
| 5 | +namespace WebhookLookup |
| 6 | +{ |
| 7 | + public partial class Form1 : Form |
| 8 | + { |
| 9 | + public Form1() |
| 10 | + { |
| 11 | + InitializeComponent(); |
| 12 | + this.AllowDrop = true; |
| 13 | + this.DragEnter += new DragEventHandler(Form1_DragEnter); |
| 14 | + this.DragDrop += new DragEventHandler(Form1_DragDrop); |
| 15 | + textBox1.ReadOnly = true; |
| 16 | + } |
| 17 | + |
| 18 | + private void Form1_DragEnter(object sender, DragEventArgs e) |
| 19 | + { |
| 20 | + if (e.Data.GetDataPresent(DataFormats.FileDrop)) |
| 21 | + { |
| 22 | + e.Effect = DragDropEffects.Copy; |
| 23 | + } |
| 24 | + else |
| 25 | + { |
| 26 | + e.Effect = DragDropEffects.None; |
| 27 | + } |
| 28 | + } |
| 29 | + |
| 30 | + private void Form1_DragDrop(object sender, DragEventArgs e) |
| 31 | + { |
| 32 | + string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); |
| 33 | + foreach (string file in files) |
| 34 | + { |
| 35 | + AnalyzeFile(file); |
| 36 | + } |
| 37 | + } |
| 38 | + |
| 39 | + private void AnalyzeFile(string filePath) |
| 40 | + { |
| 41 | + if (filePath.EndsWith(".exe")) |
| 42 | + { |
| 43 | + ExtractWebhookFromExe(filePath); |
| 44 | + } |
| 45 | + |
| 46 | + else |
| 47 | + { |
| 48 | + MessageBox.Show("u can only use .exe files!", "if you have any problems contact my discord: tuccarironnn"); |
| 49 | + } |
| 50 | + } |
| 51 | + |
| 52 | + private void ExtractWebhookFromExe(string filePath) |
| 53 | + { |
| 54 | + try |
| 55 | + { |
| 56 | + var assembly = Mono.Cecil.AssemblyDefinition.ReadAssembly(filePath); |
| 57 | + |
| 58 | + string pattern = @"https://discord\.com/api/webhooks/[a-zA-Z0-9-_]+/[a-zA-Z0-9-_]+"; |
| 59 | + |
| 60 | + List<string> webhooks = new List<string>(); |
| 61 | + |
| 62 | + foreach (var module in assembly.Modules) |
| 63 | + { |
| 64 | + foreach (var type in module.Types) |
| 65 | + { |
| 66 | + foreach (var method in type.Methods) |
| 67 | + { |
| 68 | + foreach (var body in method.Body.Instructions) |
| 69 | + { |
| 70 | + if (body.OpCode.Name == "ldstr") |
| 71 | + { |
| 72 | + string str = body.Operand as string; |
| 73 | + if (str != null && Regex.IsMatch(str, pattern)) |
| 74 | + { |
| 75 | + webhooks.Add(str); |
| 76 | + } |
| 77 | + } |
| 78 | + } |
| 79 | + } |
| 80 | + } |
| 81 | + } |
| 82 | + |
| 83 | + ShowResults(webhooks); |
| 84 | + } |
| 85 | + catch (Exception ex) |
| 86 | + { |
| 87 | + MessageBox.Show($"Error: {ex.Message}", "an error has occurred."); |
| 88 | + } |
| 89 | + } |
| 90 | + |
| 91 | + private void ExtractWebhookFromPy(string filePath) |
| 92 | + { |
| 93 | + string fileContent = File.ReadAllText(filePath); |
| 94 | + |
| 95 | + string pattern = @"https://discord\.com/api/webhooks/[a-zA-Z0-9-_]+/[a-zA-Z0-9-_]+"; |
| 96 | + |
| 97 | + List<string> webhooks = new List<string>(); |
| 98 | + |
| 99 | + foreach (Match match in Regex.Matches(fileContent, pattern)) |
| 100 | + { |
| 101 | + webhooks.Add(match.Value); |
| 102 | + } |
| 103 | + |
| 104 | + ShowResults(webhooks); |
| 105 | + } |
| 106 | + |
| 107 | + private void ShowResults(List<string> webhooks) |
| 108 | + { |
| 109 | + if (webhooks.Count > 0) |
| 110 | + { |
| 111 | + foreach (string webhook in webhooks) |
| 112 | + { |
| 113 | + textBox1.AppendText(webhook + Environment.NewLine); |
| 114 | + } |
| 115 | + } |
| 116 | + else |
| 117 | + { |
| 118 | + MessageBox.Show("no webhook found in the file.", "if you have any problems contact my discord: tuccarironnn"); |
| 119 | + } |
| 120 | + } |
| 121 | + |
| 122 | + private void Form1_Load(object sender, EventArgs e) |
| 123 | + { |
| 124 | + } |
| 125 | + |
| 126 | + private void button1_Click(object sender, EventArgs e) |
| 127 | + { |
| 128 | + if (!string.IsNullOrEmpty(textBox1.Text)) |
| 129 | + { |
| 130 | + Clipboard.SetText(textBox1.Text); |
| 131 | + textBox1.Clear(); |
| 132 | + MessageBox.Show("Copied"); |
| 133 | + } |
| 134 | + else |
| 135 | + { |
| 136 | + } |
| 137 | + } |
| 138 | + |
| 139 | + private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) |
| 140 | + { |
| 141 | + Process.Start(new ProcessStartInfo |
| 142 | + { |
| 143 | + FileName = "https://demirr2.github.io/webhookfucker/", |
| 144 | + UseShellExecute = true |
| 145 | + }); |
| 146 | + } |
| 147 | + } |
| 148 | +} |
0 commit comments