通过去掉DayPilot的DEMO字样学习反编译知识
以下内容来源于:开发者论坛:Daypilot去DEMO标记操作笔记【作者:miaojinming】
在此仅作为笔记留存,以防走丢!
将DayPilot.dll反编译后,得到9个js文件,在其中3个文件中找到了生成DEMO字样的代码。
DayPilot js版本可以直接通过修改代码中的DEMO,在daypilot-all.min.js文件中搜索下DEMO的Unicode编码:\u0044\u0045\u004d\u004f,搜索“\u0044\u0045\u004d\u004f”,删除相应的代码段,即可达到目的。而ASP.Net版本的DayPilot是DayPilot.Dll库文件,需通过修改Dll文件达到。
需要用到3个主要工具:
1:微软工具ildasm.exe:这个是把DLL生成IL文件的一个软件,是微软自带的;可以在C:\Program Files\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1Tools\找到该软件;
2:微软的工具ilasm.exe:这个是把IL文件重新生成DLL的程序,可以在C:\Windows\Microsoft.NET\Framework\v4.0.30319找到该软件;
3:微软的dll强签名生成工具:目录位置在C:\Program Files\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1Tools\sn.exe
以上3个工具文件,系统必须安装了Visual Studio才有,不同的windows版本和不同的Visual Studio版本,版本目录不同。安装了Visual Studio才会生成Microsoft SDKs。其中工具2和工具3是在命令提示符下运行的。
操作:
1.反编译:运行ildasm.exe(可以快捷键复制到桌面),打开DayPilot.Dll,转储采用缺省设置即可,转储(转储名称daypilot)完成后,可在当前目录下看到如下文件:
daypilot.il
daypilot.res
DayPilot.Resources.Bubble.js
DayPilot.Resources.Calendar.js
DayPilot.Resources.Common.js
DayPilot.Resources.Datepicker.js
DayPilot.Resources.Gantt.js
DayPilot.Resources.Images.Delete10x10.gif
DayPilot.Resources.Images.Down.png
DayPilot.Resources.Images.Left10x10.gif
DayPilot.Resources.Images.Right10x10.gif
DayPilot.Resources.Images.TreeImageCollapse.png
DayPilot.Resources.Images.TreeImageExpand.png
DayPilot.Resources.Images.TreeImageNoChildren.png
DayPilot.Resources.Images.Up.png
DayPilot.Resources.Menu.js
DayPilot.Resources.Month.js
DayPilot.Resources.Navigator.js
DayPilot.Resources.Scheduler.js
在上述加粗的三个文件中,可搜索到“\u0044\u0045\u004d\u004f”字符串。对这三个文件用“记事本”进行编辑。
DayPilot.Resources.Calendar.js删除以下代码段
var $2E=document.createElement(“div”);$2E.style.position=‘absolute’;$2E.style.padding=‘2px’;$2E.style.top=‘0px’;$2E.style.left=‘1px’;$2E.style.backgroundColor=“#FF6600”;$2E.style.color=“white”;$2E.innerHTML=“\u0044\u0045\u004D\u004F”;$2E.setAttribute(“unselectable”,“on”);if(DayPilot.Util.isNullOrUndefined(undefined))$28.appendChild($2E);
DayPilot.Resources.Month.js中删除以下代码:
if(!DayPilot.contains(this.nav.top.childNodes,KaTeX parse error: Expected 'EOF', got '&' at position 4: 0T)&̲&DayPilot.Util.…y=document.createElement(“div”); y . s t y l e . p o s i t i o n = ′ a b s o l u t e ′ ; y.style.position='absolute'; y.style.position=′absolute′;y.style.padding=‘2px’; y . s t y l e . t o p = ′ 0 p x ′ ; y.style.top='0px'; y.style.top=′0px′;y.style.left=‘0px’;KaTeX parse error: Expected 'EOF', got '#' at position 26: …ckgroundColor="#̲FF6600";y.style.color=“white”;$y.innerHTML=“\u0044\u0045\u004D\u004F”; 0 T = 0T= 0T=y;this.nav.top.appendChild($y);}
DayPilot.Resources.Scheduler.js中删除以下代码(2021年以前的版本):
var $89=document.createElement(“div”);$89.style.position=‘absolute’;$89.style.padding=‘2px’;$89.style.top=‘0px’;$89.style.left=‘1px’;$89.style.backgroundColor=“#FF6600”;$89.style.color=“white”;$89.innerHTML=“\u0044\u0045\u004D\u004F”;if(DayPilot.Util.isNullOrUndefined(undefined))$02.appendChild($89);
版本DayPilotProTrial-2022.1.3810 的 DayPilot.Resources.Scheduler.js,删除以下代码:
var a C = aC= aC=k(); a C . s t y l e . p o s i t i o n = ′ a b s o l u t e ′ ; aC.style.position='absolute'; aC.style.position=′absolute′;aC.style.padding=‘2px’; a C . s t y l e . t o p = ′ 0 p x ′ ; aC.style.top='0px'; aC.style.top=′0px′;aC.style.left=‘1px’;KaTeX parse error: Expected 'EOF', got '#' at position 27: …ckgroundColor="#̲FF6600";aC.style.color=“white”;$aC.innerHTML=“\u0044\u0045\u004D\u004F”;if(DayPilot.Util.isNullOrUndefined(undefined)) 0 d . a p p e n d C h i l d ( 0d.appendChild( 0d.appendChild(aC);
编辑完成后进行保存(注:不同版本上述代码段中的参数名称可能不同)。
2.生成强签名文件
为方便操作,将C:\ProgramFiles\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\sn.exe文件拷贝到D:盘根目录下。
在D;盘根目录下运行sn.exe -k key.snk,可在当前目录下生成key.snk的签名文件,将该文件拷贝到上述转储的文件目录内。
3.编译
在命令提示符下,进入上述转储的文件目录(最好在根目录内)运行以下命令:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\ilasm.exe /dll /resource=daypilot.res daypilot.il /KEY=key.snk
即重新编译形成了DayPilot.Dll。
(可预先将上述命令复制,在命令提示符下,点鼠标右键即可粘贴,不需手动输入,避免出错)