Compare commits

...
2 Commits
3 changed files with 36 additions and 3 deletions

No files matched your search

+9 -1
View File
@@ -76,8 +76,16 @@ namespace ForwardingServerUI.Class
Application.Current.Dispatcher.Invoke(() => {
MainWindowViewModel._userTable.Rows.Add(client.Id, client.IP, deserializedPerson.User,
"", deserializedPerson.Terminal, "", "");
URL, deserializedPerson.Terminal, "", "");
});
//记录请求指令
LogGing.LINKDATA(URL, "[COMMAND]" + deserializedPerson.User, Regex.Replace(
AES.AesDecrypt(deserializedPerson.Terminal, deserializedPerson.Dat)
, @"\\u[0-9A-Fa-f]{4}", match =>
{
return Regex.Unescape(match.Value);
}));
// 创建一个 秒的延时任务
Task delayTask = Task.Delay(15000);
// 创建一个监测任务,不断检查变量
+8 -2
View File
@@ -4,6 +4,7 @@ using System.Data;
using System.Security.Cryptography.Pkcs;
using System.Text;
using System.Text.Json;
using System.Text.RegularExpressions;
using System.Threading.Channels;
using System.Windows;
using System.Windows.Markup;
@@ -91,8 +92,13 @@ namespace ForwardingServerUI.Class
drEmployee.AcceptChanges();
PersonUser deserializedPersonuser = JsonSerializer.Deserialize<PersonUser>(trimmedDat)!;
var data = JsonSerializer.Deserialize<Dictionary<string, object>>
(AES.AesDecrypt(deserializedPersonuser.Terminal, deserializedPersonuser.Dat));
string data = AES.AesDecrypt(deserializedPersonuser.Terminal, deserializedPersonuser.Dat);
string decodedData = Regex.Replace(data, @"\\u[0-9A-Fa-f]{4}", match =>
{
return Regex.Unescape(match.Value);
});
LogGing.LINKDATA(drEmployee["Enterprise"].ToString()!,"[REPLY]"+ drEmployee["User"].ToString()!, decodedData);
}
}
}
+19
View File
@@ -7,6 +7,25 @@ namespace ForwardingServerUI.Class
{
public class LogGing
{
public static void LINKDATA(string path,string User, string dat)
{
string logpath = System.Environment.CurrentDirectory + "\\DB\\"+path;//日志文件目录
string logPath = logpath +"\\" + DateTime.Now.ToString(" yyyy-MM-dd HH-mm-ss-ffff") + User + ".txt";//日志文件
if (Directory.Exists(logpath))//检查日志路径
{
FileStream fs = new FileStream(logPath, FileMode.CreateNew, FileAccess.Write);//创建写入文件
StreamWriter wr = new StreamWriter(fs);//创建文件
wr.WriteLine(dat);
wr.Close();
}
else
{
DirectoryInfo directoryInfo = new DirectoryInfo(logpath);
directoryInfo.Create();//创建日志路径
}
}
public static void LogGingDATA(string dat)
{
string logpath = System.Environment.CurrentDirectory + "\\Log";//日志文件目录