0

Ok, so i want to make a loader, that injects a dll into a process based on hwid checked from a MySQL database, by modifing a sourcecode on the internet, however even though i type correct login creditentials it gives me an error that the username or password is invalid even though they are both correct

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ManualMapInjection.Injection;
using System.Net;
using System.IO;
using System.Diagnostics;
using MySql.Data.MySqlClient;

namespace WindowsFormsApp2
{
    public partial class Form1 : Form
    {
        private MySqlConnection conn;
        string HWID;
        public Form1()
        {
            HWID = System.Security.Principal.WindowsIdentity.GetCurrent().User.Value;
            string connString;
            connString = $"SERVER=sql7.freemysqlhosting.net;PORT=3306;DATABASE=sql2345678;UID=loader;PASSWORD=password1234";
            conn = new MySqlConnection(connString);
            InitializeComponent();
        }


        public bool IsLogin()
        {
            string trruu = "TRUE";
            string query = $"SELECT * FROM loader WHERE hwid='{HWID}' AND active_subscription='{trruu}';";

            try
            {
                if (OpenConnection())
                {
                    MySqlCommand cmd = new MySqlCommand(query, conn);
                    MySqlDataReader reader = cmd.ExecuteReader();

                    if (reader.Read())
                    {
                        MessageBox.Show("Logged In");
                        reader.Close();
                        conn.Close();
                        return true;
                    }
                    else
                    {
                        MessageBox.Show("Error Logging In");
                        reader.Close();
                        conn.Close();
                        return false;
                    }
                }
                else
                {
                    MessageBox.Show("Error Logging In");
                    conn.Close();
                    return false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error");
                conn.Close();
                return false;
            }
        }

        private bool OpenConnection()
        {
            try
            {
                conn.Open();
                return true;
            }
            catch (MySqlException ex)
            {
                MessageBox.Show("Server username or password is incorrect! " + ex.Number);
                return false;
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            HWID = System.Security.Principal.WindowsIdentity.GetCurrent().User.Value;
            textBox1.Text = HWID;
            textBox1.ReadOnly = true;
            checkonline();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            checkonline();
            WebClient wb = new WebClient();
            if (IsLogin()) 
            {
                string mainpath = "C:\\Windows\\random.dll";
                wb.DownloadFile("MY DIRECT DOWNLOADLINK URL", mainpath);
                var name = "process";
                var target = Process.GetProcessesByName(name).FirstOrDefault();
                var path = mainpath;
                var file = File.ReadAllBytes(path);

                //Checking if the DLL isn't found
                if (!File.Exists(path))
                {
                    MessageBox.Show("Error: DLL not found");
                    return;
                }

                //Injection
                var injector = new ManualMapInjector(target) { AsyncInjection = true };
                label2.Text = $"hmodule = 0x{injector.Inject(file).ToInt64():x8}";

                if (System.IO.File.Exists(mainpath))
                {
                    System.IO.File.Delete(mainpath);
                }
            }
            else
            {
                MessageBox.Show("HWID Incorrect");
            }
        }
5
  • 1
    Oh that query string.... Little Bobby Tables would be turning over in his grave. Commented May 6, 2018 at 13:09
  • Is the database called "loader" - I mean is the database name the same as the table name? Commented May 6, 2018 at 13:10
  • oops the code was the wrong one, i updated it (the other one didnt work either) Commented May 6, 2018 at 13:26
  • @john this is how the database looks like Commented May 6, 2018 at 13:32
  • It is unclear where your error is exactly. Not all MySqlExceptions mean the login failed. What is the exact line of code that fails, and if there is an exception, what are the complete exception details? Commented May 6, 2018 at 13:57

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.