public static void CreateLNK(string path, string args, string iconpath, int iconindex) { Console.WriteLine("[+] Creating .LNK with arguments `{0} {1}'.", path, args); Console.WriteLine("[+] Will reference icon at `{0}`.", iconpath); Shortcut.CreateShortcut(path, args, iconpath, iconindex).WriteToFile(@"payload.lnk"); Console.WriteLine("[+] Payload written to 'payload.lnk'.", iconpath); // Modifying access, write, creation times string[] files = System.IO.Directory.GetFiles(System.AppDomain.CurrentDomain.BaseDirectory, "*.lnk"); string lnkPath = @files[0]; Console.WriteLine("[+] Modifying lnkPath '{0}' with modified access/write/creation times", lnkPath); Shortcut Lnk = Shortcut.ReadFromFile(lnkPath); Lnk.AccessTime = DateTime.Now.ToFileTime(); Lnk.WriteTime = DateTime.Now.ToFileTime(); var myDate = DateTime.Now; var fakeYear = myDate.AddYears(-2); Random r = new Random(); int rInt = r.Next(0, 356); var fakeDay = fakeYear.AddDays(rInt); var fakeHour = fakeDay.AddHours(-5); var fakeMinute = fakeHour.AddMinutes(-20); var fakeSecond = fakeMinute.AddSeconds(-25); Lnk.CreationTime = fakeSecond.ToFileTime(); Lnk.WriteToFile(lnkPath); }
private string GenLnkFile() { var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Test.lnk"); Shortcut.CreateShortcut(@"%SystemRoot%\System32\calc.exe") .WriteToFile(path); return(path); }
private void Shortcuts() { Shortcut.CreateShortcut(install.DestinationPath + "\\Mso-Backup.exe", Environment.GetFolderPath(Environment.SpecialFolder.Desktop)); logger.Info("Programın kısayolu, Kullanıcının masaüstü klasörüne oluşturuldu."); if (install.StartOnStartup) { Shortcut.CreateStartupShortcut(install.DestinationPath + "\\Mso-Backup.exe"); logger.Info("Windows başlangıcında çalıştırılması için gerekli kısayol oluşturuldu."); } }