Initial commit.
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
using System;
|
||||
using DearFTP.Utils;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DearFTP
|
||||
{
|
||||
@@ -6,7 +12,47 @@ namespace DearFTP
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello World!");
|
||||
if (args.Length != 0)
|
||||
{
|
||||
ProceedArguments(args);
|
||||
}
|
||||
|
||||
// Make sure to use unique format
|
||||
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
|
||||
|
||||
Console.WriteLine("Welcome to DearFTP !");
|
||||
Console.WriteLine();
|
||||
|
||||
var server = new FtpServer();
|
||||
|
||||
Task.Run(() => server.Start());
|
||||
|
||||
while (Console.ReadLine() != "stop") { }
|
||||
|
||||
server.Stop();
|
||||
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
private static void ProceedArguments(string[] args)
|
||||
{
|
||||
string command = args[0].ToLower().Replace("-", "");
|
||||
string[] arguments = args.Skip(1).ToArray();
|
||||
|
||||
if (command == "hash" && arguments.Length > 0)
|
||||
{
|
||||
foreach (string password in arguments)
|
||||
{
|
||||
Console.WriteLine(PasswordHash.GetHash(password));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Invalid usage.");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user