Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.94 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.IO.Pipes;
  4. using System.Runtime.InteropServices;
  5. using System.Windows.Forms;
  6.  
  7. namespace GR3NY_V4
  8. {
  9. // Token: 0x02000007 RID: 7
  10. internal class NamedPipes
  11. {
  12. // Token: 0x0600001C RID: 28
  13. [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
  14. [return: MarshalAs(UnmanagedType.Bool)]
  15. private static extern bool WaitNamedPipe(string name, int timeout);
  16.  
  17. // Token: 0x0600001D RID: 29 RVA: 0x00002D28 File Offset: 0x00000F28
  18. public static bool NamedPipeExist(string pipeName)
  19. {
  20. bool result;
  21. try
  22. {
  23. int timeout = 0;
  24. if (!NamedPipes.WaitNamedPipe(Path.GetFullPath(string.Format("\\\\\\\\.\\\\pipe\\\\{0}", pipeName)), timeout))
  25. {
  26. int lastWin32Error = Marshal.GetLastWin32Error();
  27. if (lastWin32Error == 0)
  28. {
  29. result = false;
  30. return result;
  31. }
  32. if (lastWin32Error == 2)
  33. {
  34. result = false;
  35. return result;
  36. }
  37. }
  38. result = true;
  39. }
  40. catch (Exception)
  41. {
  42. result = false;
  43. }
  44. return result;
  45. }
  46.  
  47. // Token: 0x0600001E RID: 30 RVA: 0x00002D84 File Offset: 0x00000F84
  48. public static void LuaPipe(string script)
  49. {
  50. if (NamedPipes.NamedPipeExist(NamedPipes.luapipe))
  51. {
  52. try
  53. {
  54. using (NamedPipeClientStream namedPipeClientStream = new NamedPipeClientStream(".", NamedPipes.luapipe, PipeDirection.Out))
  55. {
  56. namedPipeClientStream.Connect();
  57. using (StreamWriter streamWriter = new StreamWriter(namedPipeClientStream))
  58. {
  59. streamWriter.Write(script);
  60. streamWriter.Dispose();
  61. }
  62. namedPipeClientStream.Dispose();
  63. }
  64. return;
  65. }
  66. catch (IOException)
  67. {
  68. MessageBox.Show("Connection to pipe", "Connection Error!", MessageBoxButtons.OK, MessageBoxIcon.Hand);
  69. return;
  70. }
  71. catch (Exception ex)
  72. {
  73. MessageBox.Show(ex.Message.ToString());
  74. return;
  75. }
  76. }
  77. MessageBox.Show("Please inject" + Functions.exploitdll + "!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  78. }
  79.  
  80. // Token: 0x04000019 RID: 25
  81. public static string luapipe = "GR3NY";
  82. }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement