public Filter(FilterList fList) { byte[] ipsecData = (byte[])fList.filterListSubKey.GetValue("ipsecData"); //Byte 20 = filter count. ipsecData[20] = 0x01; byte[] newIpsecData = ipsecData.Concat(new byte[] { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8a, 0xe6, 0x50, 0xd5, 0xbc, 0xa1, 0x5b, 0x48, 0x93, 0x58, 0x2b, 0x47, 0x5e, 0xb0, 0xae, 0x2f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0xaa, 0x00, 0x00, 0x00, 0x00 }).ToArray(); //byte 104 and 105 = port (little endian). newIpsecData[104] = 0x90; newIpsecData[105] = 0x1F; fList.filterListSubKey.SetValue("ipsecData", newIpsecData, RegistryValueKind.Binary); fList.filterListSubKey.SetValue("whenChanged", GetUnixTimeStamp(), RegistryValueKind.DWord); }
public Rule(string ipsecName, Policy.IpsecNegotiationPolicy ipsecNegPol, FilterList ipsecFilterList, Policy ipsecPolicy) { name += ipSecID; IpSecStoreKey.CreateSubKey(name); ruleSubKey = IpSecStoreKey.OpenSubKey(name, true); CreateRuleKey(ipsecName, ipsecNegPol, ipsecFilterList, ipsecPolicy); }
public void CreateRuleKey(string ipsecName, Policy.IpsecNegotiationPolicy ipsecNegPol, FilterList ipsecFilterList, IpSecPolicy.Policy ipsecPolicy) { WriteRegistryEntries(ruleSubKey, new object[, ] { { "className", "ipsecNFA", RegistryValueKind.String }, { "ipsecData", new byte[] { 0x00, 0xac, 0xbb, 0x11, 0x8d, 0x49, 0xd1, 0x11, 0x86, 0x39, 0x00, 0xa0, 0x24, 0x8d, 0x30, 0x21, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, RegistryValueKind.Binary }, { "ipsecDataType", IPSEC_DATA_TYPE_256, RegistryValueKind.DWord }, { "ipsecFilterReference", new string[] { ipsecFilterList.filterListSubKey.Name.Substring(ipsecFilterList.filterListSubKey.Name.IndexOf("\\")).Remove(0, 1) }, RegistryValueKind.MultiString }, { "ipsecID", ipSecID, RegistryValueKind.String }, { "ipsecName", ipsecName, RegistryValueKind.String }, { "ipsecNegotiationPolicyReference", ipsecNegPol.ipsecNegPolicyKey.Name.Substring(ipsecNegPol.ipsecNegPolicyKey.Name.IndexOf("\\")).Remove(0, 1), RegistryValueKind.String }, { "ipsecOwnersReference", new string[] { ipsecPolicy.policySubKey.Name.Substring(ipsecPolicy.policySubKey.Name.IndexOf("\\")).Remove(0, 1) }, RegistryValueKind.MultiString }, { "name", name, RegistryValueKind.String }, { "whenChanged", GetUnixTimeStamp(), RegistryValueKind.DWord } }); ipsecFilterList.filterListSubKey.SetValue("ipsecOwnersReference", new string[] { ruleSubKey.Name.Substring(ruleSubKey.Name.IndexOf("\\")).Remove(0, 1) }, RegistryValueKind.MultiString); ipsecPolicy.policySubKey.SetValue("ipsecNFAReference", new string[] { ruleSubKey.Name.Substring(ruleSubKey.Name.IndexOf("\\")).Remove(0, 1) }, RegistryValueKind.MultiString); }