tnblog
首页
视频
资源
登录

.net Aspose.Words破解指南

3899人阅读 2024/7/16 16:13 总访问:3467559 评论:0 收藏:1 手机
分类: .net后台框架

.netcore

.net Aspose.Words破解指南

Aspose.Words破解流程


感谢壹佰大佬提供的技术指导。
核心代码由壹佰大佬提供。

安装Crane.MethodHook包


首先安装Crane.MethodHook包。

破解方式


主要通过过期的序列证书,篡改系统的验证License的时间,只要让Aspose.Word命名空间下的文件获取当前时间时改成未到期时候的时间就可以了。
方法肯定还是通过Hook的方式,下面是提供参考的证书。


定义一个HookManager类。

  1. namespace Aspose.Hook
  2. {
  3. [Flags]
  4. public enum HookMethods
  5. {
  6. Invoke = 1,
  7. ParseExact = 2,
  8. DateTimeOpGreaterThan = 4,
  9. StringCompare = 8,
  10. StringIndexOf = 16,
  11. XmlElementInnerText = 32
  12. }
  13. public class NewHookMethods
  14. {
  15. //将过期日期修改为
  16. private static readonly string DATE_CHANGED_TO = (DateTime.Today.Year + 1).ToString() + "1230";
  17. #region New hook methods
  18. public static object NewMethodInvoke(MethodBase method, object obj, object[] parameters)
  19. {
  20. if (Assembly.GetCallingAssembly() != null && Assembly.GetCallingAssembly().FullName.StartsWith("Aspose.") && method.Name == "ParseExact" && parameters.Length > 0 && parameters[0].ToString().Contains("0827"))
  21. {
  22. var ret = DateTime.ParseExact(DATE_CHANGED_TO, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
  23. ShowLog(method, ret, obj, parameters, true);
  24. return ret;
  25. }
  26. else if (Assembly.GetCallingAssembly() != null && Assembly.GetCallingAssembly().FullName.StartsWith("Aspose.") && method.Name == "ParseExact" && parameters.Length > 0 && System.Text.RegularExpressions.Regex.Match(parameters[0].ToString(), @"^\d{4}\.\d{2}\.\d{2}$").Success)
  27. {
  28. var ret = DateTime.ParseExact("20200501", "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
  29. ShowLog(method, ret, obj, parameters, true);
  30. return ret;
  31. }
  32. else if (Assembly.GetCallingAssembly() != null && Assembly.GetCallingAssembly().FullName.StartsWith("Aspose.") && method.Name == "get_InnerText" && obj is XmlElement && (obj as XmlElement).Name == "SubscriptionExpiry")
  33. {
  34. ////这里不能用,否则会出错。
  35. //ShowLog(method, DATE_CHANGED_TO, obj, parameters, true);
  36. //return DATE_CHANGED_TO;
  37. }
  38. else if (Assembly.GetCallingAssembly() != null && Assembly.GetCallingAssembly().FullName.StartsWith("Aspose.") && method.Name == "get_Ticks" && obj is DateTime && ((DateTime)obj).ToString("MMdd") == "0827")
  39. {
  40. var ret = DateTime.ParseExact(DATE_CHANGED_TO, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture).Ticks;
  41. ShowLog(method, ret, obj, parameters, true);
  42. return ret;
  43. }
  44. else if (Assembly.GetCallingAssembly() != null && Assembly.GetCallingAssembly().FullName.StartsWith("Aspose.") && method.DeclaringType != null && method.DeclaringType.Name == "String" && method.Name == "Compare")
  45. {
  46. if (parameters.Length == 2)
  47. {
  48. if (parameters[0].ToString() == "20200827")
  49. {
  50. var ret = 1;
  51. ShowLog(method, ret, obj, parameters, true);
  52. return ret;
  53. }
  54. else if (parameters[1].ToString() == "20200827")
  55. {
  56. var ret = -1;
  57. ShowLog(method, ret, obj, parameters, true);
  58. return ret;
  59. }
  60. }
  61. }
  62. else if (Assembly.GetCallingAssembly() != null && Assembly.GetCallingAssembly().FullName.StartsWith("Aspose.") && method.Name == "op_GreaterThan" && parameters.Length == 2 && parameters[1] is DateTime && ((DateTime)parameters[1]).ToString("MMdd") == "0827")
  63. {
  64. ShowLog(method, false, obj, parameters, true);
  65. return false;
  66. }
  67. else if (Assembly.GetCallingAssembly() != null && Assembly.GetCallingAssembly().FullName.StartsWith("Aspose.") && method.Name == "IndexOf" && parameters.Length > 0 && parameters[0].ToString().Contains("0827"))
  68. {
  69. ShowLog(method, 580, obj, parameters, true);
  70. return 580;
  71. }
  72. else if (Assembly.GetCallingAssembly() != null && Assembly.GetCallingAssembly().FullName.StartsWith("Aspose.") && method.Name == "Split" && System.Text.RegularExpressions.Regex.Match(obj.ToString(), @"^\d{4}\.\d{2}\.\d{2}$").Success
  73. && obj != null && obj.ToString().Substring(0, 4) == DateTime.Now.Year.ToString())
  74. {
  75. var ret = new string[] { "2019", "08", "27" };
  76. ShowLog(method, ret, obj, parameters, true);
  77. return ret;
  78. }
  79. else if (Assembly.GetCallingAssembly() != null && Assembly.GetCallingAssembly().FullName.StartsWith("Aspose.") && method.Name == "get_Now")
  80. {
  81. var ret = DateTime.ParseExact("20200518", "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
  82. ShowLog(method, ret, obj, parameters, true);
  83. return ret;
  84. }
  85. var hook = MethodHookManager.Instance.GetHook(System.Reflection.MethodBase.GetCurrentMethod());
  86. var result = hook.InvokeOriginal<object>(method, obj, parameters?.ToArray());
  87. ShowLog(method, result, obj, parameters);
  88. return result;
  89. }
  90. /// <summary>
  91. /// 获取类型
  92. /// </summary>
  93. /// <param name="obj"></param>
  94. /// <returns></returns>
  95. private static string Serialize(object obj)
  96. {
  97. if (obj is string) return obj?.ToString();
  98. if (obj is byte[])
  99. {
  100. return "byte[]";
  101. }
  102. if (obj is Stream)
  103. {
  104. return "<STREAM>...";
  105. }
  106. if (obj is IEnumerable<object>)
  107. {
  108. var arr = obj as IEnumerable<object>;
  109. if (arr.Any())
  110. {
  111. return "[" + (arr.Aggregate("", (a, b) => (a == "" ? "" : Serialize(a) + ",") + Serialize(b))) + "]";
  112. }
  113. else
  114. {
  115. return "[]";
  116. }
  117. }
  118. else if (obj is char[])
  119. {
  120. return string.Join(",", obj as char[]);
  121. }
  122. else
  123. {
  124. return obj?.ToString();
  125. }
  126. }
  127. /// <summary>
  128. /// 输出日志
  129. /// </summary>
  130. /// <param name="method"></param>
  131. /// <param name="ret"></param>
  132. /// <param name="obj"></param>
  133. /// <param name="parameters"></param>
  134. /// <param name="isImportant"></param>
  135. public static void ShowLog(MethodBase method, object ret, object obj, object[] parameters, bool isImportant = false)
  136. {
  137. try
  138. {
  139. if (isImportant == false)
  140. {
  141. // 只拦截字符串类型的和时间类型的元素
  142. if ((method.DeclaringType?.Name.Contains("DateTime") == false
  143. && method.DeclaringType?.Name.Contains("String.") == false)
  144. || method.Name.Contains("ToCharArray")
  145. || method.Name.Contains("IndexOf")
  146. || method.Name.Contains("get_Length")
  147. || method.Name.Contains("op_Equality")
  148. || method.Name.Contains("ToLower"))
  149. {
  150. //Utils.LogWriteLine($"Bob Is Not Important {method.DeclaringType?.Name}.{method.Name}", ConsoleColor.White);
  151. return;
  152. }
  153. }
  154. var paras = string.Empty;
  155. try
  156. {
  157. paras = Serialize(obj) + "," + Serialize(parameters);
  158. }
  159. catch (Exception)
  160. {
  161. paras = obj + "," + parameters;
  162. }
  163. var returns = string.Empty;
  164. try
  165. {
  166. returns = Serialize(ret);
  167. }
  168. catch (Exception)
  169. {
  170. returns = ret?.ToString();
  171. }
  172. Utils.LogWriteLine($"INVOKE method {method.DeclaringType?.Name}.{method.Name}({paras}) RETURN=> {returns}", isImportant ? ConsoleColor.Blue : ConsoleColor.DarkGray);
  173. }
  174. catch (Exception e)
  175. {
  176. Utils.LogWrite("Error:" + e.Message);
  177. }
  178. }
  179. public static int NewCompare(string s1, string s2)
  180. {
  181. if (Assembly.GetCallingAssembly() != null && Assembly.GetCallingAssembly().FullName.StartsWith("Aspose.") && s2 == "20200827")
  182. {
  183. Utils.LogWriteLine($"HOOK SUCCESS: From {Assembly.GetCallingAssembly().GetName().Name} String.Compare({s1},{s2}) return -1;", ConsoleColor.Green);
  184. return -1;
  185. }
  186. else
  187. {
  188. var hook = MethodHookManager.Instance.GetHook(MethodBase.GetCurrentMethod());
  189. var ret = hook.InvokeOriginal<int>(null, s1, s2);
  190. Utils.LogWriteLine($"NOT Aspose Call: From {Assembly.GetCallingAssembly().GetName().Name} String.Compare({s1},{s2}) return {ret};", ConsoleColor.DarkRed);
  191. return ret;
  192. }
  193. }
  194. public static bool NewGreaterThan(DateTime t1, DateTime t2)
  195. {
  196. if (Assembly.GetCallingAssembly() != null && Assembly.GetCallingAssembly().FullName.StartsWith("Aspose.") && t2.ToString("yyyyMMdd") == "20200827")
  197. {
  198. Utils.LogWriteLine($"HOOK SUCCESS: From {Assembly.GetCallingAssembly().GetName().Name} DateTime ({t1}>{t2}) return false;", ConsoleColor.Green);
  199. return false;
  200. }
  201. else
  202. {
  203. var hook = MethodHookManager.Instance.GetHook(MethodBase.GetCurrentMethod());
  204. var ret = hook.InvokeOriginal<bool>(null, t1, t2);
  205. return ret;
  206. }
  207. }
  208. public static DateTime NewParseExact(string s, string format, IFormatProvider provider)
  209. {
  210. if (Assembly.GetCallingAssembly() != null && Assembly.GetCallingAssembly().FullName.StartsWith("Aspose.") && s == "20200827")
  211. {
  212. Utils.LogWriteLine($"HOOK SUCCESS: From {Assembly.GetCallingAssembly().GetName().Name} DateTime.ParseExact({s},{format},{provider}) return {DATE_CHANGED_TO};", ConsoleColor.Green);
  213. var hook = MethodHookManager.Instance.GetHook(System.Reflection.MethodBase.GetCurrentMethod());
  214. return hook.InvokeOriginal<DateTime>(null, DATE_CHANGED_TO, format, provider);
  215. }
  216. else
  217. {
  218. var hook = MethodHookManager.Instance.GetHook(System.Reflection.MethodBase.GetCurrentMethod());
  219. return hook.InvokeOriginal<DateTime>(null, s, format, provider);
  220. }
  221. }
  222. public static string NewInnerText(XmlElement element)
  223. {
  224. if (Assembly.GetCallingAssembly() != null && Assembly.GetCallingAssembly().FullName.StartsWith("Aspose.") && Assembly.GetCallingAssembly().FullName.StartsWith("Aspose.Words") == false && Assembly.GetCallingAssembly().FullName.StartsWith("Aspose.Hook") == false && element.Name == "SubscriptionExpiry")
  225. {
  226. Utils.LogWriteLine($"HOOK SUCCESS: From {Assembly.GetCallingAssembly().GetName().Name} XmlElement.InnerText ({element.Name},{element.InnerXml}) return {DATE_CHANGED_TO};", ConsoleColor.Green);
  227. return DATE_CHANGED_TO;
  228. }
  229. else
  230. {
  231. var hook = MethodHookManager.Instance.GetHook(System.Reflection.MethodBase.GetCurrentMethod());
  232. return hook.InvokeOriginal<string>(element);
  233. }
  234. }
  235. public static int NewIndexOf(string v1, string v2)
  236. {
  237. if (Assembly.GetCallingAssembly() != null && Assembly.GetCallingAssembly().FullName.StartsWith("Aspose.") && v2 == DATE_CHANGED_TO)
  238. {
  239. Utils.LogWriteLine($"HOOK SUCCESS: From {Assembly.GetCallingAssembly().GetName().Name} {v1.ToString().Substring(0, 9) + "..."}.IndexOf({v2}) return 580;", ConsoleColor.Green);
  240. return 580;
  241. }
  242. else
  243. {
  244. var hook = MethodHookManager.Instance.GetHook(System.Reflection.MethodBase.GetCurrentMethod());
  245. var ret = hook.InvokeOriginal<int>(v1, v2);
  246. return ret;
  247. }
  248. }
  249. #endregion
  250. }
  251. public static class HookManager
  252. {
  253. private class HookItem
  254. {
  255. public HookMethods Method { get; set; }
  256. public MethodHook Hook { get; set; }
  257. public bool Enabled { get; set; }
  258. }
  259. //所有的license都只需要设置一次
  260. private static List<string> mAssembliesLicenseSetted = new List<string>();
  261. //将于20200827过期的Aspose.Total开发版序列号
  262. private const string LICENSE_STRING = "PExpY2Vuc2U+CiAgPERhdGE+CiAgICA8TGljZW5zZWRUbz5TdXpob3UgQXVuYm94IFNvZnR3YXJlIENvLiwgT" +
  263. "HRkLjwvTGljZW5zZWRUbz4KICAgIDxFbWFpbFRvPnNhbGVzQGF1bnRlYy5jb208L0VtYWlsVG8+CiAgICA8TG" +
  264. "ljZW5zZVR5cGU+RGV2ZWxvcGVyIE9FTTwvTGljZW5zZVR5cGU+CiAgICA8TGljZW5zZU5vdGU+TGltaXRlZCB" +
  265. "0byAxIGRldmVsb3BlciwgdW5saW1pdGVkIHBoeXNpY2FsIGxvY2F0aW9uczwvTGljZW5zZU5vdGU+CiAgICA8" +
  266. "T3JkZXJJRD4xOTA4MjYwODA3NTM8L09yZGVySUQ+CiAgICA8VXNlcklEPjEzNDk3NjAwNjwvVXNlcklEPgogI" +
  267. "CAgPE9FTT5UaGlzIGlzIGEgcmVkaXN0cmlidXRhYmxlIGxpY2Vuc2U8L09FTT4KICAgIDxQcm9kdWN0cz4KIC" +
  268. "AgICAgPFByb2R1Y3Q+QXNwb3NlLlRvdGFsIGZvciAuTkVUPC9Qcm9kdWN0PgogICAgPC9Qcm9kdWN0cz4KICA" +
  269. "gIDxFZGl0aW9uVHlwZT5FbnRlcnByaXNlPC9FZGl0aW9uVHlwZT4KICAgIDxTZXJpYWxOdW1iZXI+M2U0NGRl" +
  270. "MzAtZmNkMi00MTA2LWIzNWQtNDZjNmEzNzE1ZmMyPC9TZXJpYWxOdW1iZXI+CiAgICA8U3Vic2NyaXB0aW9uR" +
  271. "XhwaXJ5PjIwMjAwODI3PC9TdWJzY3JpcHRpb25FeHBpcnk+CiAgICA8TGljZW5zZVZlcnNpb24+My4wPC9MaW" +
  272. "NlbnNlVmVyc2lvbj4KICAgIDxMaWNlbnNlSW5zdHJ1Y3Rpb25zPmh0dHBzOi8vcHVyY2hhc2UuYXNwb3NlLmN" +
  273. "vbS9wb2xpY2llcy91c2UtbGljZW5zZTwvTGljZW5zZUluc3RydWN0aW9ucz4KICA8L0RhdGE+CiAgPFNpZ25h" +
  274. "dHVyZT53UGJtNUt3ZTYvRFZXWFNIY1o4d2FiVEFQQXlSR0pEOGI3L00zVkV4YWZpQnd5U2h3YWtrNGI5N2c2e" +
  275. "GtnTjhtbUFGY3J0c0cwd1ZDcnp6MytVYk9iQjRYUndTZWxsTFdXeXNDL0haTDNpN01SMC9jZUFxaVZFOU0rWn" +
  276. "dOQkR4RnlRbE9uYTFQajhQMzhzR1grQ3ZsemJLZFZPZXk1S3A2dDN5c0dqYWtaL1E9PC9TaWduYXR1cmU+CjwvTGljZW5zZT4=";
  277. private static List<HookItem> mHookStatus = new List<HookItem>();
  278. private static bool mHookStarted = false;
  279. static HookManager()
  280. {
  281. }
  282. static void InitializeHookList()
  283. {
  284. if (mHookStatus.Count == 0)
  285. {
  286. mHookStatus.Add(new HookItem
  287. {
  288. Method = HookMethods.Invoke,
  289. Hook = new MethodHook(
  290. typeof(MethodBase).GetMethod("Invoke", BindingFlags.Public | BindingFlags.Instance, null, new[] { typeof(object), typeof(object[]) }, null),
  291. typeof(NewHookMethods).GetMethod(nameof(NewHookMethods.NewMethodInvoke), BindingFlags.Static | BindingFlags.Public, null, new[] { typeof(MethodBase), typeof(object), typeof(object[]) }, null)
  292. ),
  293. Enabled = true
  294. });
  295. mHookStatus.Add(new HookItem
  296. {
  297. Method = HookMethods.ParseExact,
  298. Hook = new MethodHook(
  299. typeof(DateTime).GetMethod("ParseExact", BindingFlags.Static | BindingFlags.Public, null, new[] { typeof(string), typeof(string), typeof(IFormatProvider) }, null),
  300. typeof(NewHookMethods).GetMethod(nameof(NewHookMethods.NewParseExact), BindingFlags.Static | BindingFlags.Public, null, new[] { typeof(string), typeof(string), typeof(IFormatProvider) }, null)
  301. ),
  302. Enabled = true
  303. });
  304. mHookStatus.Add(new HookItem
  305. {
  306. Method = HookMethods.DateTimeOpGreaterThan,
  307. Hook = new MethodHook(
  308. typeof(DateTime).GetMethod("op_GreaterThan", BindingFlags.Static | BindingFlags.Public, null, new[] { typeof(DateTime), typeof(DateTime) }, null),
  309. typeof(NewHookMethods).GetMethod(nameof(NewHookMethods.NewGreaterThan), BindingFlags.Static | BindingFlags.Public, null, new[] { typeof(DateTime), typeof(DateTime) }, null)
  310. ),
  311. Enabled = true
  312. });
  313. mHookStatus.Add(new HookItem
  314. {
  315. Method = HookMethods.StringCompare,
  316. Hook = new MethodHook(
  317. typeof(string).GetMethod("Compare", BindingFlags.Static | BindingFlags.Public, null, new[] { typeof(string), typeof(string) }, null),
  318. typeof(NewHookMethods).GetMethod(nameof(NewHookMethods.NewCompare), BindingFlags.Static | BindingFlags.Public, null, new[] { typeof(string), typeof(string) }, null)
  319. ),
  320. Enabled = true
  321. });
  322. mHookStatus.Add(new HookItem
  323. {
  324. Method = HookMethods.StringIndexOf,
  325. Hook = new MethodHook(
  326. typeof(string).GetMethod("IndexOf", BindingFlags.Instance | BindingFlags.Public, null, new[] { typeof(string) }, null),
  327. typeof(NewHookMethods).GetMethod(nameof(NewHookMethods.NewIndexOf), BindingFlags.Static | BindingFlags.Public, null, new[] { typeof(string), typeof(string) }, null)
  328. ),
  329. Enabled = true
  330. });
  331. mHookStatus.Add(new HookItem
  332. {
  333. Method = HookMethods.XmlElementInnerText,
  334. #if NET40
  335. Hook = new MethodHook(
  336. typeof(XmlElement).GetProperty("InnerText", BindingFlags.Public | BindingFlags.Instance).GetGetMethod(true),
  337. typeof(NewHookMethods).GetMethod(nameof(NewHookMethods.NewInnerText), BindingFlags.Static | BindingFlags.Public, null, new[] { typeof(XmlElement) }, null)
  338. ),
  339. #else
  340. Hook = new MethodHook(
  341. typeof(XmlElement).GetProperty("InnerText", BindingFlags.Public | BindingFlags.Instance).GetMethod,
  342. typeof(NewHookMethods).GetMethod(nameof(NewHookMethods.NewInnerText), BindingFlags.Static | BindingFlags.Public, null, new[] { typeof(XmlElement) }, null)
  343. ),
  344. #endif
  345. Enabled = true
  346. });
  347. foreach (var item in mHookStatus)
  348. {
  349. if (item.Enabled)
  350. {
  351. MethodHookManager.Instance.AddHook(item.Hook);
  352. }
  353. }
  354. }
  355. }
  356. /// <summary>
  357. /// 设置需要启用的方法清单(默认已启用了所有)
  358. /// </summary>
  359. /// <param name="methods"></param>
  360. public static void SetHookMethods(HookMethods methods)
  361. {
  362. InitializeHookList();
  363. MethodHookManager.Instance.StopHook();
  364. MethodHookManager.Instance.RemoveAllHook();
  365. foreach (var item in mHookStatus)
  366. {
  367. if (methods.HasFlag(item.Method))
  368. {
  369. item.Enabled = true;
  370. MethodHookManager.Instance.AddHook(item.Hook);
  371. }
  372. else
  373. {
  374. item.Enabled = false;
  375. }
  376. }
  377. if (mHookStarted)
  378. {
  379. MethodHookManager.Instance.StartHook();
  380. }
  381. }
  382. /// <summary>
  383. /// 是否显示详细的HOOK明细
  384. /// </summary>
  385. /// <param name="show"></param>
  386. public static void ShowHookDetails(bool show)
  387. {
  388. if (show)
  389. {
  390. Utils.EnableLog();
  391. }
  392. else
  393. {
  394. Utils.DisableLog();
  395. }
  396. }
  397. /// <summary>
  398. /// 启用hook
  399. /// </summary>
  400. public static void StartHook()
  401. {
  402. if (mHookStarted)
  403. {
  404. return;
  405. }
  406. try
  407. {
  408. InitializeHookList();
  409. MethodHookManager.Instance.StartHook();
  410. //所有库的License都只需要设置一次就可以了。
  411. var assemblies = Assembly.GetCallingAssembly()?.GetReferencedAssemblies().Union(Assembly.GetEntryAssembly()?.GetReferencedAssemblies() ?? new AssemblyName[] { })
  412. .GroupBy(assembly => assembly.Name).Select(item => item.FirstOrDefault())
  413. .Where(assembly => assembly.Name.StartsWith("Aspose") && assembly.Name.StartsWith("Aspose.Hook") == false);
  414. if (assemblies != null)
  415. {
  416. foreach (var assembly in assemblies)
  417. {
  418. if (mAssembliesLicenseSetted.Contains(assembly.FullName))
  419. {
  420. continue;
  421. }
  422. else
  423. {
  424. var type = Assembly.Load(assembly).GetType(assembly.Name + ".License");
  425. if (type == null)
  426. {
  427. type = Assembly.Load(assembly).GetType(System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(assembly.Name.ToLower()) + ".License");
  428. }
  429. if (type != null)
  430. {
  431. Utils.LogWriteLine($"\nSETTING...{type.FullName}", ConsoleColor.Yellow);
  432. var instance = Activator.CreateInstance(type);
  433. type.GetMethod("SetLicense", new[] { typeof(Stream) }).Invoke(instance, BindingFlags.Public | BindingFlags.Instance, null, new[] { new MemoryStream(Convert.FromBase64String(LICENSE_STRING)) }, null);
  434. Utils.LogWriteLine($"{type.FullName} SET SUCCESSFULLY.", ConsoleColor.Yellow);
  435. mAssembliesLicenseSetted.Add(assembly.FullName);
  436. }
  437. }
  438. }
  439. }
  440. }
  441. catch (Exception e)
  442. {
  443. var exception = e;
  444. while (exception.InnerException != null)
  445. {
  446. exception = exception.InnerException;
  447. }
  448. Utils.LogWriteLine($"start hook failed because of {exception.Message}.", ConsoleColor.Red);
  449. }
  450. mHookStarted = true;
  451. }
  452. /// <summary>
  453. /// 停用Hook
  454. /// </summary>
  455. public static void StopHook()
  456. {
  457. if (mHookStarted == false)
  458. {
  459. return;
  460. }
  461. MethodHookManager.Instance.StopHook();
  462. mHookStarted = false;
  463. }
  464. }
  465. }


示例代码:

  1. HookManager.ShowHookDetails(true);
  2. HookManager.StartHook();
  3. Document doc = new Document("E:\\outparcket\\asposenetpojie\\file\\nh.docx");
  4. // 将文档保存为 PDF 格式
  5. doc.Save("E:\\outparcket\\asposenetpojie\\file\\nh.pdf", SaveFormat.Pdf);


发现并没有水印破解成功。

参考


参考链接:https://www.52hb.com/thread-57858-1-1.html


欢迎加群讨论技术,1群:677373950(满了,可以加,但通过不了),2群:656732739

评价

net core 使用 EF Code First

下面这些内容很老了看这篇:https://www.tnblog.net/aojiancc2/article/details/5365 项目使用多层,把数据库访问...

cAPS.net 保存base64位格式的图片

publicvoidUpload() { //取出图片对应的base64位字符 stringimgBase=Request[&quot;imgBase&quot;]; //c#里边的base6...

Quartz.net实例动态改变周期调度。misfire、Cron

Quartz:Java编写的开源的任务调度作业框架 类似Timer之类定时执行的功能,但是更强大Quartz.NET:是把Quartz转成C# NuGet...

.net Windows服务发布、安装、卸载、监听脚本。服务调试

一、脚本 为方便不用每次都去写安装卸载的脚本1.安装脚本@echooff @echo开始安装【服务】 %SystemRoot%\Microsoft.NET\Fr...

c、VB.net中全角半角转换方法

///&lt;summary&gt; ///转全角的函数(SBCcase) ///&lt;/summary&gt; ///&lt;paramname=&quot;input&quot;&gt;任意字符串...

.net mvc分部页,.net core分部页

.net分部页的三种方式第一种:@Html.Partial(&quot;_分部页&quot;)第二种:@{ Html.RenderPartial(&quot;分部页&quot;);}...

C.net 配合小程序实现经过第三方服务器中转文件

某些时候,微信小程序前段上传文件的时候需要经过第三方服务器再将文件上传到客户的服务器;操作如下:1:(小程序内向中端服...

.net实现QQ邮箱发送邮件功能

1、微软已经帮我们封装好了发送邮件的类MailMessage,MailMessage类构造一些邮件信息,然后通过SmtpClient进行邮件发送。Mai...

StackExchange.Redis操作redis(net core支持)

官方git开源地址https://github.com/StackExchange/StackExchange.Redis官方文档在docs里边都是官方的文档通过nuget命令下...

windows 自带的netsh进行端口映射

使用netsh 把本地任意ip的25566端口 映射到192.168.81.234的25565端口netshinterfaceportproxyaddv4tov4listenaddress=0.0....

确保.net程序始终以管理员身份运行

usingSystem; usingSystem.Collections.Generic; usingSystem.Linq; usingSystem.Text; usingSystem.Threading.Tasks; ...

ASP.net Timer细节处理

Timer的用法:1:本人称之为计时器,是asp.net官方的一种。用法即是计时所用 2:关于计时有很多中方式,本人学识有限,暂...

.net core 使用session

tip:net core 2.2后可以直接启用session了,不用在自己添加一次session依赖,本身就添加了使用nuget添加引用Microsoft.AspN...

通俗易懂,什么是.net?什么是.net Framework?什么是.net core?

朋友圈@蓝羽 看到一篇文章写的太详细太通俗了,搬过来细细看完,保证你对.NET有个新的认识理解原文地址:https://www.cnblo...

asp.net core2.0 依赖注入 AddTransient与AddScoped的区别

asp.net core主要提供了三种依赖注入的方式其中AddTransient与AddSingleton比较好区别AddTransient瞬时模式:每次都获取一...
这一世以无限游戏为使命!
排名
2
文章
634
粉丝
44
评论
93
docker中Sware集群与service
尘叶心繁 : 想学呀!我教你呀
一个bug让程序员走上法庭 索赔金额达400亿日元
叼着奶瓶逛酒吧 : 所以说做程序员也要懂点法律知识
.net core 塑形资源
剑轩 : 收藏收藏
映射AutoMapper
剑轩 : 好是好,这个对效率影响大不大哇,效率高不高
ASP.NET Core 服务注册生命周期
剑轩 : http://www.tnblog.net/aojiancc2/article/details/167
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2025TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
公网安备:50010702506256
欢迎加群交流技术