{"id":151,"date":"2009-01-01T23:06:57","date_gmt":"2009-01-01T23:06:57","guid":{"rendered":""},"modified":"2009-01-01T23:06:57","modified_gmt":"2009-01-01T23:06:57","slug":"151","status":"publish","type":"post","link":"https:\/\/www.poloo.org\/?p=151","title":{"rendered":".NET\u7834\u89e3\u4f53\u9a8c ildasm.exe\u7684\u4f7f\u7528(\u8f6c)"},"content":{"rendered":"<p>.NET\u4e2d\u53ef\u4ee5\u4f7f\u7528ildasm.exe\u6765\u7834\u89e3BIN\u76ee\u5f55\u4e0b\u9762\u7684DLL\u6587\u4ef6,\u89e3\u6210IL\u683c\u5f0f.\u4fee\u6539\u540e\u53ef\u7528ilasm\u6765\u8fdb\u884c\u91cd\u65b0\u7f16\u8bd1. <\/p>\n<p>\u65b9\u6cd5: <br \/>\/\/\/ &lt;summary&gt;<br \/>\/\/\/ \u4f7f\u7528cmd\u8c03\u7528ildasm.exe \u53c2\u6570:argm= ildasm F:\\overred.exe \/out=F:\\overred.il<br \/>\/\/\/ &lt;\/summary&gt;<br \/>public static bool cmdCreateIL(string argm)<br \/>{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;System.Diagnostics.Process p = new System.Diagnostics.Process();<br \/>&nbsp;&nbsp;&nbsp;&nbsp;p.StartInfo.FileName = &#8220;cmd.exe&#8221;;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;p.StartInfo.UseShellExecute = false;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;p.StartInfo.RedirectStandardInput = true;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;p.StartInfo.RedirectStandardOutput = true;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;p.StartInfo.RedirectStandardError = true;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;p.StartInfo.CreateNoWindow = false; <\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;try<br \/>&nbsp;&nbsp;&nbsp;&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p.Start();<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p.StandardInput.WriteLine(argm);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p.StandardInput.WriteLine(&#8220;exit&#8221;);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p.StandardOutput.ReadToEnd();<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p.Close();<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return true;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;catch<br \/>&nbsp;&nbsp;&nbsp;&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return false;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;finally<br \/>&nbsp;&nbsp;&nbsp;&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p.Dispose();<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>} <\/p>\n<p>\u4f5c\u4e3aCracker\uff0c\u53ef\u4ee5\u7528.Net Framework SDK\u81ea\u5e26\u7684\u5de5\u5177\u8fdb\u884cMSIL\u548cEXE(DLL)\u4e4b\u95f4\u7684\u4e92\u6362\uff1a<br \/>\u5229\u7528FrameworkSDKBin\u76ee\u5f55\u4e0b\u7684ilasm\u548cildasm<br \/>(1)ilasm\u793a\u4f8b\uff1a<br \/>\u4e0b\u9762\u7684\u547d\u4ee4\u5bf9 MSIL \u6587\u4ef6 myTestFile.il \u8fdb\u884c\u6c47\u7f16\u5e76\u4ea7\u751f\u53ef\u6267\u884c\u6587\u4ef6 myTestFile.exe\u3002<br \/>ilasm myTestFile<br \/>\u4e0b\u9762\u7684\u547d\u4ee4\u5bf9 MSIL \u6587\u4ef6 myTestFile.il \u8fdb\u884c\u6c47\u7f16\u5e76\u4ea7\u751f .dll \u6587\u4ef6 myTestFile.dll\u3002<br \/>ilasm myTestFile \/dll <br \/>\u4e0b\u9762\u7684\u547d\u4ee4\u5bf9 MSIL \u6587\u4ef6 myTestFile.il \u8fdb\u884c\u6c47\u7f16\u5e76\u4ea7\u751f .dll \u6587\u4ef6 myNewTestFile.dll\u3002<br \/>ilasm myTestFile \/dll \/output:myNewTestFile.dll<br \/>(2)ildasm\u793a\u4f8b<br \/>\u4e0b\u9762\u7684\u547d\u4ee4\u4f7f PE \u6587\u4ef6 MyHello.exe \u7684\u5143\u6570\u636e\u548c\u53cd\u6c47\u7f16\u4ee3\u7801\u663e\u793a\u5728 Ildasm.exe \u7684\u9ed8\u8ba4 GUI \u4e2d\u3002<br \/>ildasm myHello.exe<br \/>\u4e0b\u9762\u7684\u547d\u4ee4\u5bf9 MyFile.exe \u6587\u4ef6\u8fdb\u884c\u53cd\u6c47\u7f16\uff0c\u5e76\u5c06\u7ed3\u679c MSIL \u6c47\u7f16\u7a0b\u7a0b\u5e8f\u6587\u672c\u5b58\u50a8\u5728 MyFile.il \u6587\u4ef6\u4e2d\u3002 <\/p>\n<p>ildasm MyFile.exe \/output:MyFile.il<br \/>\u4e0b\u9762\u7684\u547d\u4ee4\u5bf9 MyFile.exe \u6587\u4ef6\u8fdb\u884c\u53cd\u6c47\u7f16\uff0c\u5e76\u5c06\u7ed3\u679c MSIL \u6c47\u7f16\u7a0b\u5e8f\u6587\u672c\u663e\u793a\u5230\u63a7\u5236\u53f0\u7a97\u53e3\u4e2d\u3002 <\/p>\n<p>ildasm MyFile.exe \/text<br \/>\u5982\u679c\u6587\u4ef6 MyApp.exe \u5305\u542b\u5d4c\u5165\u7684\u6258\u7ba1\u548c\u975e\u6258\u7ba1\u8d44\u6e90\uff0c\u5219\u4e0b\u9762\u7684\u547d\u4ee4\u5c06\u4ea7\u751f\u4ee5\u4e0b 4 \u4e2a\u6587\u4ef6\uff1a<br \/>MyApp.il\u3001MyApp.res\u3001Icons.resources \u548c Message.resources\uff1a <\/p>\n<p>ildasm MyApp.exe \/output:MyApp.il<br \/>\u4e0b\u9762\u7684\u547d\u4ee4\u5bf9 MyFile.exe \u7684 MyClass \u7c7b\u4e2d\u7684 MyMethod \u65b9\u6cd5\u8fdb\u884c\u53cd\u6c47\u7f16\uff0c\u5e76\u5c06\u8f93\u51fa\u663e\u793a\u5230\u63a7\u5236\u53f0\u7a97\u53e3\u4e2d\u3002 <\/p>\n<p>ildasm \/item:MyClass::MyMethod MyFile.exe \/text<br \/>\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u53ef\u80fd\u6709\u51e0\u4e2a\u5177\u6709\u4e0d\u540c\u7b7e\u540d\u7684 MyMethod \u65b9\u6cd5\u3002<br \/>\u4e0b\u9762\u7684\u547d\u4ee4\u5bf9\u8fd4\u56de\u7c7b\u578b\u4e3a void \u4e14\u5e26\u6709\u53c2\u6570 int32 \u548c System.string \u7684 MyMethod \u65b9\u6cd5\u8fdb\u884c\u53cd\u6c47\u7f16\u3002 <\/p>\n<p>ildasm \/item:&#8221;MyClass::MyMethod(void(int32,class System.String))&#8221; MyFile.exe \/text <\/p>\n<p><a href=\"http:\/\/www.poloo.org\/wp-content\/attachments\/month_0901\/920091723845.rar\" target=\"_blank\">\u53cd\u7f16\u8bd1\u5de5\u5177 ildasm 2.0\u4e0b\u8f7d<\/a><\/p>\n<p><a href=\"http:\/\/www.poloo.org\/wp-content\/attachments\/month_0901\/y20091723958.rar\" target=\"_blank\">\u53cd\u7f16\u8bd1\u5de5\u5177 ildasm\u4e0b\u8f7d<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>.NET\u4e2d\u53ef\u4ee5\u4f7f\u7528ildasm.exe\u6765\u7834\u89e3BIN\u76ee\u5f55\u4e0b\u9762\u7684DLL\u6587&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-151","post","type-post","status-publish","format-standard","hentry","category-NET"],"_links":{"self":[{"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/posts\/151","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.poloo.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=151"}],"version-history":[{"count":0,"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/posts\/151\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.poloo.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=151"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.poloo.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=151"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.poloo.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=151"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}