Skip to content

Commit

Permalink
C# alternative to the linux \"cat\" command... Prints file contents t…
Browse files Browse the repository at this point in the history
…o console. For use with Cobalt Strike's Execute-Assembly
  • Loading branch information
SadPanda committed Jul 15, 2021
0 parents commit c459398
Show file tree
Hide file tree
Showing 14 changed files with 855 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
Binary file added .vs/SharpCat/v16/.suo
Binary file not shown.
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

60 changes: 60 additions & 0 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using System;
using System.IO;

namespace SharpCat
{
class Program
{
static void Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine(@"
_____ _ _____ _
/ ___| | / __ \ | |
\ `--.| |__ __ _ _ __ _ __ | / \/ __ _| |_
`--. \ '_ \ / _` | '__| '_ \| | / _` | __|
/\__/ / | | | (_| | | | |_) | \__/\ (_| | |_
\____/|_| |_|\__,_|_| | .__/ \____/\__,_|\__|
| |
|_|
" +
"" +
"Developed By: @sadpanda_sec\n\n" +
"Description: C# alternative to the linux \"cat\" command... Prints file contents to console.\n\n" +
"Usage: SharpCat.exe C:\\Some\\Path\\To\\File");
System.Environment.Exit(0);

}
else if (args.Length == 1)
{
if (File.Exists(args[0]))
{
string path = Path.GetFullPath(args[0]);
string text = File.ReadAllText(path);
DateTime date = DateTime.Now;
Console.WriteLine("\n" + date + ": " + "Reading File: " + path + "\n\n");
Console.WriteLine(text);
System.Environment.Exit(0);

}
else
{
Console.WriteLine("File Does Not Exist");
System.Environment.Exit(0);

}
}
else
{
if (args.Length > 1)
{
Console.WriteLine("Error...Provided more than one command line argument\n\n" +
"Usage: SharpCat.exe C:\\Some\\Path\\To\\File");
System.Environment.Exit(0);
}
}
}
}
}

36 changes: 36 additions & 0 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SharpCat")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SharpCat")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("469f4a56-2d36-4e36-8892-cc4b0cebfbb8")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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")]
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# SharpCat
C# alternative to the linux "cat" command... Prints file contents to console. For use with Cobalt Strike's Execute-Assembly
48 changes: 48 additions & 0 deletions SharpCat.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{469F4A56-2D36-4E36-8892-CC4B0CEBFBB8}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>SharpCat</RootNamespace>
<AssemblyName>SharpCat</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
25 changes: 25 additions & 0 deletions SharpCat.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31205.134
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpCat", "SharpCat.csproj", "{469F4A56-2D36-4E36-8892-CC4B0CEBFBB8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{469F4A56-2D36-4E36-8892-CC4B0CEBFBB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{469F4A56-2D36-4E36-8892-CC4B0CEBFBB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{469F4A56-2D36-4E36-8892-CC4B0CEBFBB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{469F4A56-2D36-4E36-8892-CC4B0CEBFBB8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {940926AF-DA52-4525-972A-3C3A151F7349}
EndGlobalSection
EndGlobal
4 changes: 4 additions & 0 deletions obj/Debug/.NETFramework,Version=v4.0.AssemblyAttributes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.0", FrameworkDisplayName = ".NET Framework 4")]
Binary file not shown.
Binary file added obj/Debug/SharpCat.csprojAssemblyReference.cache
Binary file not shown.
4 changes: 4 additions & 0 deletions obj/Release/.NETFramework,Version=v4.0.AssemblyAttributes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.0", FrameworkDisplayName = ".NET Framework 4")]
Binary file not shown.
Empty file.

0 comments on commit c459398

Please sign in to comment.