Skip to content

Commit

Permalink
Fix to support dns names in sshhost parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
kero99 committed Dec 21, 2023
1 parent fb8b662 commit 9daac00
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 7 deletions.
6 changes: 3 additions & 3 deletions SPECTR3/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private static int CreateISCSITarget(string drivename, List<Disk> m_disk, ISCSIS

private static void PrintHelp()
{
Console.WriteLine("SPECTR3 v0.7.3 - Remote acquisition and forensic tool by Alpine Security");
Console.WriteLine("SPECTR3 v0.7.4 - 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 @@ -259,9 +259,9 @@ static int Main(string[] args)
return 1;
}

if (!SP3NET.ValidateIPv4(args[i + 1]))
if (!SP3NET.ValidateIPv4(args[i + 1]) && !SP3NET.ValidateDNS(args[i + 1]))
{
Console.WriteLine(" - ERROR: Invalid SSH IP address");
Console.WriteLine(" - ERROR: Invalid SSH IP address or Hostname");
return 1;
}
sshhost = args[i + 1];
Expand Down
8 changes: 4 additions & 4 deletions SPECTR3/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SPECTR3")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyDescription("Remote Acquisition Software")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCompany("Alpine Security")]
[assembly: AssemblyProduct("SPECTR3 Forensic")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
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("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.7.4.0")]
[assembly: AssemblyFileVersion("0.7.4.0")]
39 changes: 39 additions & 0 deletions SPECTR3/SPECTR3.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -37,6 +52,9 @@
<PropertyGroup>
<ApplicationIcon>Spectr3.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<SignManifests>false</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="Renci.SshNet, Version=2020.0.2.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">
<HintPath>..\packages\SSH.NET.2020.0.2\lib\net40\Renci.SshNet.dll</HintPath>
Expand All @@ -53,13 +71,22 @@
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="sp3server.cs" />
<Compile Include="sp3utils.cs" />
<Compile Include="sshutils.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DiskAccessLibrary.Win32\DiskAccessLibrary.Win32.csproj">
Expand All @@ -82,6 +109,18 @@
<ItemGroup>
<Content Include="Spectr3.ico" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
Expand Down
16 changes: 16 additions & 0 deletions SPECTR3/sp3utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -395,5 +395,21 @@ public static bool ValidateIPv4(string ip)
return ip != null && ip.Count(c => c == '.') == 3 &&
IPAddress.TryParse(ip, out address);
}

// Check if a dns like "shaw.alpinesec.cloud" is valid
public static bool ValidateDNS(string dns)
{
bool isValid = false;
try
{
IPHostEntry host = Dns.GetHostEntry(dns);
isValid = true;
}
catch (Exception)
{
isValid = false;
}
return isValid;
}
}
}

0 comments on commit 9daac00

Please sign in to comment.