马上注册,结交更多好友,享用更多功能,让你轻松玩转社区
您需要 登录 才可以下载或查看,没有账号?立即注册
×
曾经有不少的圈内朋友咨询,如何限定后处理的使用次数,达到设定的次数后就失效或提示用户延长使用次数。 这个功能通过对后处理进行二次开发确实可以达到目的,但由于该方法在实现的过程中,需要用明文的方式保存次数,如果把次数加密后保存,这样对后处理的计算量非常大,同时也需要借助vb script来辅助,这样一来,每次都需要把已经保存的数据传递给vb script解密,解密后再传回后处理,后处理对数据运算后,再传给vb script加密,在这个过程中,很容易利用工具拦截并修改数据,导致次数失效。. Q* y. |9 q2 L- @- B8 P6 h# C" t
那如何才能保证这一过程安全,高效,同时确保保存的数据安全可靠呢? 对此,本人基于NET-Hooks技术开发了相应的dll文件,后处理只需要把次数密文传递给dll,剩下的工作交由dll完成,这一过程高效,快而且相对安全。 对于密文加密部分,通过一个exe程序来进行加密相关的数据。 后处理在第一次使用时会生成一个用户系统信息的文件,该文件需要发送给后处理制作者,后处理制作者提取相关的数据后,生成相应的密文,替换后处理中"KeyKeyKeyKeyKeyKeyKeyKeyKeyKeyKeyKeyKeyKey"字符串即可 把后处理的所有源代码除数据格式定义,换刀块等加密。 下面将进入激动人心的时刻,后处理代码部分。9 r/ f0 d* I* c- k$ `( c
/ {+ S0 M; w# P: L) D h4 I$ w* @8 K1.首先定义dll保存返回的数据。 #----------------------------------------------------------------------------- # Do not change below any code. #----------------------------------------------------------------------------- sav_arg_1 : "" sav_arg_2 : "" sav_arg_3 : ""
& M c$ D5 p7 c5 o2.定义次数,硬件,用户名等密文。 slic_int: "ktpzKs94d0ZBGlbgZWNuexxMZRlYf/67+sSKqqsfxJll6ocbpzg+kg==" slic_ids : "K3Ylvd7tS1ul+EKTLSsDrA==" #Use Number slic_iqc : "KeyKeyKeyKeyKeyKeyKeyKeyKeyKey" #Key
# J+ X% G. _0 @3 C1 D8 i以下部分需要加密。 3.定义传递给dll数据的字符串。 #[startbin] #----------------------------------------------------------------------------- # Do not change below any code. #----------------------------------------------------------------------------- sDLL : "Use_time.dll" sSPACE : " " # Contains a SPACE character sSQ : "'" # Contains a Single Quote character sDQ : '"' # Contains a Double Quote character sARG1 : "arg1" # Load with the arg#1 sARG2 : "arg2" # Load with the arg#2 sARG3 : "arg3" # Load with the arg#3 sPARAMS : "" # This string variable will be the command line passed to the DLL. test_ok : 0 resultDLL : 0 # Needed for the dll() command call.
# n" e/ q7 u- S" J* e: N S4.定义错误提示信息。4 d* a; H$ K `; D2 T. o
serror_lic : "Sorry, you not license use this postprocessor" serror_dll : "Sorry, in " serror_fd : " folder is not dll file" serror_id : "Invalid hardware ID, " serror_nu : "Time limit has expired! " svers_limit_msg : "This post is designed to function with Mastercam 2017 only!" % ~% V1 a) A+ P- S$ {5 [
5.dll调用开始 prunaddin #This postblock is used to run a NET-Hook (or C-Hook) Add-In. sARG3 = slic_int sARG2 = slic_iqc sARG1 = slic_ids sPARAMS = sSQ + sDQ + sARG1 + sDQ + sSPACE + sDQ + sARG2 + sDQ + sSPACE + sDQ + sARG3 + sDQ + sSQ sDLL = spathpst$ + sDLL if fexist(sDLL), resultDLL = dll(sDLL, sPARAMS) else, [ serror_dll = serror_dll + spathpst$ + serror_fd result = mprint(serror_dll) test_ok = 0 exitpost$ ] if spost_arg_1$ = "error", test_ok = 1, e$ if spost_arg_0$ = "error", test_ok = 2, e$ if test_ok = 1, [ result = mprint(serror_id + serror_lic) *spost_arg_2$, e$ pauthor_info psof0$ exitpost$ ] if test_ok = 2, [ result = mprint(serror_nu + serror_lic) *spost_arg_2$, e$ pauthor_info psof0$ exitpost$ ] % P) N- v! V4 n2 M
6.定义次数失效后的相关联系方式。 pauthor_info #- Author Info - "(qq:279497172)", e$ ​ 3 j+ j" u0 x5 U" t7 e' t
|