Skip to content

Commit

Permalink
Merge pull request #1 from im-hanzou/patch-1
Browse files Browse the repository at this point in the history
Update Form1.cs
  • Loading branch information
fdciabdul committed May 28, 2024
2 parents 14270ea + 0e075cf commit 4a7cde3
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
Expand All @@ -13,9 +16,21 @@ namespace WordPressLoginChecker
{
public partial class Form1 : Form
{
private static readonly HttpClient client = new HttpClient();
private static readonly HttpClient client;
private CancellationTokenSource cts;

static Form1()
{
// Create a handler that ignores SSL certificate errors
HttpClientHandler handler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => true
};

// Initialize HttpClient with the custom handler
client = new HttpClient(handler);
}

public Form1()

Check warning on line 34 in Form1.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

Non-nullable field 'cts' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.

Check warning on line 34 in Form1.cs

View workflow job for this annotation

GitHub Actions / build (Release)

Non-nullable field 'cts' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.
{
InitializeComponent();
Expand Down Expand Up @@ -60,12 +75,18 @@ await Task.Run(() =>
if (cts.Token.IsCancellationRequested)
break;
var match = Regex.Match(line, @"(https?:\/\/[^\s/]+\/(wp-login\.php|wp-admin)):([^:]+):([^:]+)");
var match = Regex.Match(line, @"(\b(https?:\/\/)?[^\s/]+\/(wp-login\.php|wp-admin)):([^:]+):([^:]+)");
if (match.Success)
{
string url = match.Groups[1].Value;
string username = match.Groups[3].Value;
string password = match.Groups[4].Value;
string username = match.Groups[4].Value;
string password = match.Groups[5].Value;
// Ensure the URL has a proper scheme
if (!url.StartsWith("http://") && !url.StartsWith("https://"))
{
url = "https://" + url;
}
CheckLogin(url, username, password, cts.Token).Wait();
}
Expand Down

0 comments on commit 4a7cde3

Please sign in to comment.