Also, to prevent malicious use, I am adding simple passwords checks.
but there was a problem while doing this.
Code: Select all
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows.Forms;
class CheckEncodedKey
{
static void ChkKeynArg(string[] args)
{
Console.WriteLine("hello");
System.Environment.Exit(50);
}
}
// https://www.c-sharpcorner.com/forums/sendingenter-in-console-project
class TextSendKeys
{
[DllImport("user32.dll")]
static extern bool SetForegroundWindow(IntPtr hWnd);
static void Main()
{
Process[] procs = Process.GetProcessesByName("cmd");
foreach(Process proc in procs)
{
if (proc.MainWindowTitle == "a")
{
SetForegroundWindow(proc.MainWindowHandle);
SendKeys.SendWait("ab~cde~");
}
}
}
}
I want to put the code below to check the password in this part.
Code: Select all
if (args.Length > 1)
{
string EncodedKey = "password";
string EncodedArg = args[1];
if (String.Equals(EncodedKey, EncodedArg))
{
// Console.WriteLine(args.Length)
}
else
{Environment.Exit(1);}
}
else
Environment.Exit(1);