-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathProgram.cs
60 lines (55 loc) · 1.84 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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);
}
}
}
}
}