Skip to content

Commit

Permalink
1.0.0.28
Browse files Browse the repository at this point in the history
bug fix
  • Loading branch information
x-nas committed May 6, 2024
1 parent bceceb1 commit 5aceea2
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 42 deletions.
2 changes: 1 addition & 1 deletion ProcessInjector/ProcessInjector.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<PublisherName>X-NAS</PublisherName>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.htm</WebPage>
<ApplicationRevision>28</ApplicationRevision>
<ApplicationRevision>29</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
Expand Down
2 changes: 1 addition & 1 deletion ProcessInjector/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
[assembly: AssemblyVersion("1.0.0.27")]
[assembly: AssemblyVersion("1.0.0.28")]
//[assembly: AssemblyVersion("1.0.0.21")]
//[assembly: AssemblyFileVersion("1.0.0.21")]
99 changes: 60 additions & 39 deletions WPELibrary/Lib/Socket_Cache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
namespace WPELibrary.Lib
{
public static class Socket_Cache
{
{
private static string sLanguage_UI = "";
public static bool Interecept_Recv, Interecept_RecvFrom, Interecept_Send, Interecept_SendTo;
public static bool Display_Recv, Display_RecvFrom, Display_Send, Display_SendTo;

Expand Down Expand Up @@ -440,41 +441,50 @@ public static int GetFilterNum_ByFilterIndex(int FIndex)
#region//执行滤镜
public static void DoFilter(IntPtr ipBuff, int iLen)
{
int iFNum = 0;
string sFName = "", sFSearch = "", sModify = "";

try
{
byte[] bBuff = Socket_Operation.GetByteFromIntPtr(ipBuff, iLen);

foreach (Socket_Filter_Info sfi in lstFilter)
if (bBuff.Length > 0)
{
bool bCheck = sfi.IsCheck;

if (bCheck)
foreach (Socket_Filter_Info sfi in lstFilter)
{
int iFNum = sfi.FNum;
string sFName = sfi.FName;
string sFSearch = sfi.FSearch;
string sModify = sfi.FModify;
bool bCheck = sfi.IsCheck;

if (CheckFilterSearch_ByBuff(sFSearch, bBuff))
if (bCheck)
{
if (!string.IsNullOrEmpty(sModify))
{
string[] ssModify = sModify.Split(',');
iFNum = sfi.FNum;
sFName = sfi.FName;
sFSearch = sfi.FSearch;
sModify = sfi.FModify;

foreach (string sTemp in ssModify)
if (!string.IsNullOrEmpty(sFSearch) && !string.IsNullOrEmpty(sModify))
{
if (CheckFilterSearch_ByBuff(sFSearch, bBuff))
{
string[] sModifyValue = sTemp.Split('|');
int iIndex = int.Parse(sModifyValue[0].ToString().Trim());
string sValue = sModifyValue[1].ToString().Trim();
string[] ssModify = sModify.Split(',');

bBuff[iIndex] = Socket_Operation.Hex_To_Byte(sValue)[0];
}
foreach (string sTemp in ssModify)
{
string[] sModifyValue = sTemp.Split('-');
int iIndex = int.Parse(sModifyValue[0].ToString().Trim());
string sValue = sModifyValue[1].ToString().Trim();

bool bSetOK = Socket_Operation.SetByteToIntPtr(bBuff, ipBuff, iLen);
bBuff[iIndex] = Socket_Operation.Hex_To_Byte(sValue)[0];
}

if (bSetOK)
{
break;
bool bSetOK = Socket_Operation.SetByteToIntPtr(bBuff, ipBuff, iLen);

if (bSetOK)
{
sLanguage_UI = MultiLanguage.GetDefaultLanguage("执行滤镜成功: ", "Filter execution successful: ");
Socket_Operation.DoLog(sLanguage_UI + sFName);

break;
}
}
}
}
Expand All @@ -483,37 +493,48 @@ public static void DoFilter(IntPtr ipBuff, int iLen)
}
catch (Exception ex)
{
Socket_Operation.DoLog(ex.Message);
sLanguage_UI = MultiLanguage.GetDefaultLanguage("执行滤镜出错: ", "Error executing filter: ");
Socket_Operation.DoLog(sLanguage_UI + sFName + " | " + ex.Message);
}
}
#endregion

#region//检查是否匹配滤镜
private static bool CheckFilterSearch_ByBuff(string FSearch, byte[] bBuff)
{
bool bResult = true;
bool bResult = true;

if (!string.IsNullOrEmpty(FSearch))
try
{
string[] ssSearch = FSearch.Split(',');

foreach (string sSearch in ssSearch)
if (!string.IsNullOrEmpty(FSearch))
{
string[] sSearchValue = sSearch.Split('|');
int iIndex = int.Parse(sSearchValue[0].ToString().Trim());
string sValue = sSearchValue[1].ToString().Trim();
string[] ssSearch = FSearch.Split(',');

foreach (string sSearch in ssSearch)
{
string[] sSearchValue = sSearch.Split('-');
int iIndex = int.Parse(sSearchValue[0].ToString().Trim());
string sValue = sSearchValue[1].ToString().Trim();

string sBufferValue = bBuff[iIndex].ToString("X2");
string sBufferValue = bBuff[iIndex].ToString("X2");

if (!sValue.Equals(sBufferValue))
{
bResult = false;
break;
if (!sValue.Equals(sBufferValue))
{
bResult = false;
break;
}
}
}
else
{
bResult = false;
}
}
else
{
catch (Exception ex)
{
sLanguage_UI = MultiLanguage.GetDefaultLanguage("匹配滤镜出错: ", "Matching filter error: ");
Socket_Operation.DoLog(sLanguage_UI + ex.Message);

bResult = false;
}

Expand Down
4 changes: 3 additions & 1 deletion WPELibrary/Socket_Form.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private void InitSocketForm()
this.tlSystemInfo.Text = sInjectInfo;

Socket_Cache.SocketSendList.InitSendList();
Socket_Cache.SocketFilterList.InitFilterList(FilterMAXNum);
Socket_Cache.SocketFilterList.InitFilterList(FilterMAXNum);

Socket_Operation.DoLog(sInjectInfo);
}
Expand Down Expand Up @@ -319,6 +319,8 @@ private void tSocketInfo_Tick(object sender, EventArgs e)
this.tlInterecept_CNT.Text = Socket_Cache.SocketQueue.Interecept_CNT.ToString();
this.tlCheck_CNT.Text = Socket_Operation.CheckCNT.ToString();

this.dgvFilterList.Refresh();

if (!bgwSocketList.IsBusy)
{
if (Socket_Cache.SocketQueue.qSocket_Packet.Count > 0)
Expand Down

0 comments on commit 5aceea2

Please sign in to comment.