Skip to content

Commit

Permalink
添加项目文件。
Browse files Browse the repository at this point in the history
  • Loading branch information
yggo committed Feb 1, 2021
1 parent 1eff8f0 commit 981620d
Show file tree
Hide file tree
Showing 88 changed files with 7,956 additions and 0 deletions.
66 changes: 66 additions & 0 deletions App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="PacketDotNet" publicKeyToken="451414c7667b2a58" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.0.5.0" newVersion="1.0.5.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-3.1.4.0" newVersion="3.1.4.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging" publicKeyToken="adb9793829ddae60" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-3.1.4.0" newVersion="3.1.4.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.2.5.0" newVersion="1.2.5.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="adb9793829ddae60" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-3.1.4.0" newVersion="3.1.4.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-3.1.4.0" newVersion="3.1.4.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-3.1.4.0" newVersion="3.1.4.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Options" publicKeyToken="adb9793829ddae60" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-3.1.4.0" newVersion="3.1.4.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection" publicKeyToken="adb9793829ddae60" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-3.1.4.0" newVersion="3.1.4.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.2.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
17 changes: 17 additions & 0 deletions Attributes/CustomEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;

namespace YgAndroidQQSniffer.Attributes
{
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public class CustomEvent : Attribute
{
private readonly string windowName;

public string WindowName { get { return windowName; } }

public CustomEvent(string windowName)
{
this.windowName = windowName;
}
}
}
16 changes: 16 additions & 0 deletions Attributes/TLVParser.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;

namespace YgAndroidQQSniffer.Attributes
{
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public class TLVParser : Attribute
{
private readonly short cmd;

public short Cmd { get { return cmd; } }
public TLVParser(short cmd)
{
this.cmd = cmd;
}
}
}
84 changes: 84 additions & 0 deletions Common/Common.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
using App.Metrics.Concurrency;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using YgAndroidQQSniffer.Extension;

namespace YgAndroidQQSniffer
{
public enum KeyType
{
[Display(Description = "share_key")]
SHARE_KEY,

[Display(Description = "zero_key")]
ZERO_KEY,

[Display(Description = "d2_key")]
D2_KEY,

[Display(Description = "rand_tgt_key")]
RAND_TGT_KEY,

[Display(Description = "custom_key")]
CUSTOM_KEY,

[Display(Description = "cached_key")]
CACHED_SHAKEY,
}
public class DecryptionKey
{
public string Key { get; set; }
public KeyType KeyType { get; set; }
public string PrivateKey { get; set; }
public string PublicKey { get; set; }
}
public class Common
{
public static AtomicInteger Index;

public static LinkedList<DecryptionKey> Keys { get; set; } = new LinkedList<DecryptionKey>();

static Common()
{
Keys.AddLast(new DecryptionKey() { Key = new byte[16].HexDump(), KeyType = KeyType.ZERO_KEY });
}

public static byte[] TeaKeyLogDecrypt(byte[] In, out DecryptionKey decryptionKey)
{
decryptionKey = null;
List<DecryptionKey> keys = Keys.ToList();
for (int i = 0; i < keys.Count; i++)
{
var d = Tea.Decrypt(In, HexUtil.DecodeHex(keys[i].Key));
if (d != null)
{
decryptionKey = keys[i];
return d;
}
}
return null;
}

public static string PrettyKeyDecryptDump(byte[] decrypt_data, DecryptionKey decryption_key)
{
string decryption_key_str = $"{decryption_key.Key} keyType={decryption_key.KeyType.GetDisplayDescription()}";
if (decryption_key.KeyType == KeyType.SHARE_KEY)
{
decryption_key_str += $" prikey={decryption_key.PrivateKey}";
decryption_key_str += $" pubkey={decryption_key.PublicKey}";
}
return $"\n\n[key={decryption_key_str}\n{decrypt_data.HexDump()}]\n\n";
}

public static List<DecryptionKey> GetTeaKeyLogSetList()
{
List<DecryptionKey> decryptionKeys = new List<DecryptionKey>();
Keys.ToList().ForEach(k =>
{
if (decryptionKeys.Find(d => d.Key == k.Key) == null) decryptionKeys.Add(k);
});
return decryptionKeys;
}
}
}
49 changes: 49 additions & 0 deletions Common/HookData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
namespace YgAndroidQQSniffer
{
public static class HookData
{
private static FormMain Frm { get => FormMain.Form; }

#region Hook Data
public static string _androidId = string.Empty;
public static string AndroidId { get => _androidId; set { if (_androidId == value) return; _androidId = value; Frm.ThreadSafeUpdate(() => Frm.txt_tool_hookdata_androidId.Text = _androidId); } }

public static string _mac = string.Empty;
public static string Mac { get => _mac; set { if (_mac == value) return; _mac = value; Frm.ThreadSafeUpdate(() => Frm.txt_tool_hookdata_mac.Text = _mac); } }

public static string _imsi = string.Empty;
public static string IMSI { get => _imsi; set { if (_imsi == value) return; _imsi = value; Frm.ThreadSafeUpdate(() => Frm.txt_tool_hookdata_imsi.Text = _imsi); } }

public static string _imei = string.Empty;
public static string IMEI { get => _imei; set { if (_imei == value) return; _imei = value; Frm.ThreadSafeUpdate(() => Frm.txt_tool_hookdata_imei.Text = _imei); } }

public static string _bssid = string.Empty;
public static string BSSID { get => _bssid; set { if (_bssid == value) return; _bssid = value; Frm.ThreadSafeUpdate(() => Frm.txt_tool_hookdata_bssid.Text = _bssid); } }

public static string _d2key = string.Empty;
public static string D2KEY { get => _d2key; set { if (_d2key == value) return; _d2key = value; Frm.ThreadSafeUpdate(() => Frm.txt_tool_hookdata_d2key.Text = _d2key); } }

public static string _a1 = string.Empty;
public static string A1 { get => _a1; set { if (_a1 == value) return; _a1 = value; Frm.ThreadSafeUpdate(() => Frm.txt_tool_hookdata_A1.Text = _a1); } }

public static string _a2 = string.Empty;
public static string A2 { get => _a2; set { if (_a2 == value) return; _a2 = value; Frm.ThreadSafeUpdate(() => Frm.txt_tool_hookdata_A2.Text = _a2); } }

public static string _a3 = string.Empty;
public static string A3 { get => _a3; set { if (_a3 == value) return; _a3 = value; Frm.ThreadSafeUpdate(() => Frm.txt_tool_hookdata_A3.Text = _a3); } }

public static string _tgtkey = string.Empty;
public static string TGTKEY { get => _tgtkey; set { if (_tgtkey == value) return; _tgtkey = value; Frm.ThreadSafeUpdate(() => Frm.txt_tool_hookdata_tgtkey.Text = _tgtkey); } }

public static string _nick = string.Empty;
public static string Nick { get => _nick; set { if (_nick == value) return; _nick = value; Frm.ThreadSafeUpdate(() => Frm.txt_tool_hookdata_nick.Text = _nick); } }

public static string _uin = string.Empty;
public static string Uin { get => _uin; set { if (_uin == value) return; _uin = value; Frm.ThreadSafeUpdate(() => Frm.txt_tool_hookdata_uin.Text = _uin); } }

public static string _pwd = string.Empty;
public static string Pwd { get => _pwd; set { if (_pwd == value) return; _pwd = value; Frm.ThreadSafeUpdate(() => Frm.txt_tool_hookdata_pwd.Text = _pwd); } }

#endregion
}
}
7 changes: 7 additions & 0 deletions Common/ICustomControlEvents.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace YgAndroidQQSniffer
{
interface ICustomControlEvents
{
void Register();
}
}
42 changes: 42 additions & 0 deletions Component/DeviceItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using SharpPcap.LibPcap;
using System.Collections.Generic;

namespace YgAndroidQQSniffer.Component
{
public class DeviceItem
{
public PcapDevice Device { get; set; }
public string IpAddr { get => GetNetworkAdapterIpAddr(Device); }

private string GetNetworkAdapterIpAddr(PcapDevice device)
{
List<PcapAddress> addresses = device.Interface.Addresses;
for (int i = 0; i < addresses.Count; i++)
{
if (addresses[i].Netmask != null && addresses[i].Broadaddr != null)
{
if (!string.IsNullOrEmpty(addresses[i].Netmask.ToString()) && !string.IsNullOrEmpty(addresses[i].Broadaddr.ToString()))
{
return addresses[i].Addr.ipAddress.ToString();
}
}
}
return string.Empty;
}

public override string ToString()
{
string device_name = Device.Interface.FriendlyName;
if (string.IsNullOrEmpty(Device.Interface.FriendlyName))
{
device_name = Device.Description;
}
string str = $"{device_name}";
if (!string.IsNullOrEmpty(IpAddr))
{
str += $"({IpAddr})";
}
return str;
}
}
}
Loading

0 comments on commit 981620d

Please sign in to comment.