Skip to content

Commit

Permalink
Fix hardcoded win32 executable filename in daemon mode
Browse files Browse the repository at this point in the history
  • Loading branch information
kero99 committed Aug 29, 2024
1 parent cd66cf5 commit 7781cef
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
32 changes: 19 additions & 13 deletions SPECTR3/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
using System.Threading;
using System.Diagnostics;
using static SPECTR3.SP3DSK;
using DiskAccessLibrary;
using System.Reflection;

namespace SPECTR3
Expand Down Expand Up @@ -62,7 +61,7 @@ private static int CreateISCSITarget(string drivename, List<Disk> m_disk, ISCSIS

private static void PrintHelp()
{
Console.WriteLine("SPECTR3 v0.7.4 - Remote acquisition and forensic tool by Alpine Security");
Console.WriteLine("SPECTR3 v0.7.5 - Remote acquisition and forensic tool by Alpine Security");
Console.WriteLine("Usage: SPECTR3.exe [options]");
Console.WriteLine("Options:");
Console.WriteLine(" -l, --list");
Expand Down Expand Up @@ -431,29 +430,36 @@ static int Main(string[] args)
Console.WriteLine(" - Funny MOTD: " + SP3UTILS.GetRandomMessage());
}

//Daemon mode
// Daemon mode
if (daemon)
{
string argsString = string.Join(" ", args);
if (argsString.Contains("--daemon"))
{
argsString = argsString.Replace("--daemon", "");
}
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "SPECTR3.exe";
startInfo.Arguments = argsString;
startInfo.CreateNoWindow = true;
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.RedirectStandardOutput = true;
startInfo.UseShellExecute = false;

string executablePath = Assembly.GetExecutingAssembly().Location;
string executableName = System.IO.Path.GetFileName(executablePath);

ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = executableName,
Arguments = argsString,
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden,
RedirectStandardOutput = true,
UseShellExecute = false
};

Process process = Process.Start(startInfo);
//Get PID of the background process
// Get PID of the background process
pid = process.Id;

//Print Server Info
// Print Server Info
Console.WriteLine();
Console.WriteLine(" - SPECTR3 Server running in background PID (" + pid + ") at "
+ serverAddress + ":" + port);
+ serverAddress + ":" + port);
Console.WriteLine(" + Target IQN: " + txtTargetIQN);
Console.WriteLine(" + Access Permited from: " + permitedAddress.ToString());
return 0;
Expand Down
6 changes: 3 additions & 3 deletions SPECTR3/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Alpine Security")]
[assembly: AssemblyProduct("SPECTR3 Forensic")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.7.4.0")]
[assembly: AssemblyFileVersion("0.7.4.0")]
[assembly: AssemblyVersion("0.7.5.0")]
[assembly: AssemblyFileVersion("0.7.5.0")]

0 comments on commit 7781cef

Please sign in to comment.