Tool: class id

View previous topic View next topic Go down

Tool: class id

Post  Tei on Tue Oct 19, 2010 3:04 pm

Using mod creator I have extracted the java files.
http://mcdocs.team-talk.net/how-to-s-f2/mod-creator-pack-v12-update-t17.htm

This work with the unpatched version, so I use a special extractor bat file that don't do any patching.

unpatchedgen.bat
Code:

@echo off

echo UNPACKING MINECRAFT.JAR
unzip -o bin\minecraft.jar * -d minecraft
echo UNPACKING MINECRAFT_SERVER.JAR
unzip -o minecraft_server.jar * -d minecraft_server

echo DECOMPILING MINECRAFT.JAR
jad -f -dead -ff -safe -stat -v -o -s .java -d minecraft.unpatched minecraft\*.class
echo DECOMPILING MINECRAFT_SERVER.JAR
jad -f -dead -ff -safe -stat -v -o -s .java -d minecraft_server.unpatched minecraft_server\*.class

pause


Here is the tool.
Code:

#!/bin/perl

 $base = "/cygdrive/c/mine/modding/minecraft.unpatched/";
 
 @files = <$base*.java>;
 
 
 foreach $file (@files) {
 
  $result = getCode($file);
 
  print $result . "\n"; 
  #die;
 }


sub getCode {
   my $file = shift @_;

   $text = "";
   
   open(FILE,$file) or die $!;
   while($data = <FILE>){   
      if( substr( $data , 0 , 2 )  eq "//" ) {
         #avoid comments
         next;      
      }
      $text .= $data;         
   }
   
   #remove crud data (like ofuscated name class)   
   $text =~ s/[(A-Z)|(a-z)|\t|      |\n|\r|\13]//g;   
   
   #remove comments like  /*hell\no*/
   $text =~ s/((?:\/\*(?:[^*]|(?:\*+[^*\/]))*\*+\/)|(?:\/\/.*))//g;   
   
   $len = length($text);
   $len = uc(sprintf("%04x", $len));
   
   $file =~ s/$base//g;#easier to show
   
   
   #print $text ."\n";
   return $len . ":" . $file;   
}

Very lame and simple. It remove comment and all the A..z letter, so the file is the same even after different ofuscations. Then return the length of such file as id. I could have used something like md5, but I like here that two files very similar will have a id similar.

Heres the dump of the tool.

Code:

006D:a.java
0049:aa.java
017C:ab.java
0193:ac.java
0086:ad.java
005A:ae.java
000E:af.java
004D:ag.java
0016:ah.java
0168:ai.java
02BE:aj.java
0708:ak.java
0295:al.java
0008:am.java
0029:an.java
04BE:ao.java
0013:ap.java
01FD:aq.java
0024:ar.java
0040:as.java
0229:at.java
00D0:au.java
00A7:av.java
000E:aw.java
000A:ax.java
00E6:ay.java
023D:az.java
03B6:b.java
0150:ba.java
0031:bb.java
40E7:bc.java
01BC:bd.java
001B:be.java
0073:bf.java
03F9:bg.java
022C:bh.java
002C:bi.java
0020:bj.java
0004:bk.java
004B:bl.java
002B:bm.java
034F:bn.java
000B:bo.java
0037:bp.java
012F:bq.java
020C:br.java
005E:bs.java
0163:bt.java
0052:bu.java
00A8:bv.java
0054:bw.java
00E2:bx.java
0041:by.java
00A2:bz.java
001B:c.java
000F:ca.java
00EA:cb.java
001F:cc.java
00E1:cd.java
0014:ce.java
0420:cf.java
02D7:cg.java
0064:ch.java
01CB:ci.java
006B:cj.java
0094:ck.java
0198:cl.java
0018:cm.java
21EB:cn.java
0002:co.java
00B4:cp.java
0193:cq.java
03FA:cr.java
0030:cs.java
0014:ct.java
015E:cu.java
00DB:cv.java
000A:cw.java
00B8:cx.java
006F:cy.java
0316:cz.java
00E2:d.java
006F:da.java
0024:db.java
04F0:dc.java
0016:dd.java
01F4:de.java
00C3:df.java
0043:dg.java
009F:dh.java
0409:di.java
0084:dj.java
0027:dk.java
00BC:dl.java
0392:dm.java
0372:dn.java
0050:do.java
0156:dp.java
00B8:dq.java
00EC:dr.java
001A:ds.java
0087:dt.java
0025:du.java
0140:dv.java
0626:dw.java
037F:dx.java
0042:dy.java
0032:dz.java
0C8C:e.java
00F6:ea.java
00B6:eb.java
0138:ec.java
003E:ed.java
01B7:ee.java
0051:ef.java
024E:eg.java
0038:eh.java
0048:ei.java
07B8:ej.java
022B:ek.java
006B:el.java
01BC:em.java
01DC:en.java
00CA:eo.java
001E:ep.java
0073:eq.java
0287:er.java
00A7:es.java
0065:et.java
04A0:eu.java
00F6:ev.java
01CC:ew.java
0023:ex.java
082E:ey.java
0085:ez.java
002F:f.java
0050:fa.java
0028:fb.java
002C:fc.java
0135:fd.java
00D3:fe.java
0140:ff.java
0050:fg.java
0052:fh.java
0187:fi.java
006C:fj.java
0075:fk.java
0028:fl.java
003F:fm.java
016C:fn.java
0020:fo.java
003B:fp.java
0048:fq.java
0490:fr.java
0032:fs.java
0254:ft.java
00E2:fu.java
00A4:fv.java
0391:fw.java
0137:fx.java
0020:fy.java
0123:fz.java
0047:g.java
0978:ga.java
0049:gb.java
02EB:gc.java
00BE:gd.java
0CB0:ge.java
009D:gf.java
000D:gg.java
000E:gh.java
001B:gi.java
0035:gj.java
0014:gk.java
003E:gl.java
000E:gm.java
002D:gn.java
0013:go.java
009D:gp.java
00BC:gq.java
02A5:gr.java
024C:gs.java
0031:gt.java
007A:gu.java
016B:gv.java
0026:gw.java
0055:gx.java
0504:gy.java
0019:gz.java
0023:h.java
0097:ha.java
000D:hb.java
002A:hc.java
020E:hd.java
0072:he.java
0035:hf.java
0197:hg.java
00B5:hh.java
002C:hi.java
01EA:hj.java
007B:hk.java
0007:hl.java
01B8:hm.java
00F3:hn.java
0444:ho.java
004B:hp.java
00CD:hq.java
0061:hr.java
0056:hs.java
01E8:ht.java
042F:hu.java
0470:hv.java
014D:hw.java
00D1:hx.java
013A:hy.java
0009:hz.java
0230:i.java
01F5:ia.java
0055:ib.java
0126:ic.java
00B4:id.java
00F1:ie.java
0159:if.java
014C:ig.java
0054:ih.java
01C5:ii.java
002D:ij.java
0014:ik.java
003F:il.java
0033:im.java
00E5:in.java
002D:io.java
03F1:ip.java
0FC7:iq.java
00BE:ir.java
0038:is.java
000F:it.java
003E:iu.java
00CD:iv.java
014C:iw.java
002F:ix.java
0031:iy.java
01C3:iz.java
04B3:j.java
007C:ja.java
01AB:jb.java
0296:jc.java
017D:jd.java
03DB:je.java
007F:jf.java
0039:jg.java
0082:jh.java
0032:ji.java
0038:jj.java
0050:jk.java
007B:jl.java
0120:jm.java
0036:jn.java
0041:jo.java
04A1:jp.java
0134:jq.java
0155:jr.java
0040:js.java
0038:jt.java
0025:ju.java
001A:jv.java
002A:jw.java
0029:jx.java
0407:jy.java
01D0:jz.java
0043:k.java
0038:ka.java
000D:kb.java
0066:kc.java
05F2:kd.java
0261:ke.java
0589:kf.java
057F:kg.java
0CFA:kh.java
0085:ki.java
003E:kj.java
048F:kk.java
0050:kl.java
0452:km.java
0273:kn.java
000F:ko.java
002C:kp.java
0051:kq.java
002D:kr.java
001C:ks.java
021E:kt.java
023D:ku.java
01E6:kv.java
0093:kw.java
020A:kx.java
0046:ky.java
0076:kz.java
00D5:l.java
011D:la.java
0059:lb.java
0025:lc.java
0031:ld.java
032E:le.java
008D:lf.java
0047:lg.java
001E:lh.java
0040:li.java
002C:lj.java
001B:lk.java
0105:ll.java
026E:lm.java
0044:ln.java
0100:lo.java
00B0:lp.java
002D:lq.java
018F:lr.java
002F:ls.java
057E:lt.java
00A2:lu.java
0020:lv.java
00C2:lw.java
0009:lx.java
02EC:ly.java
00B2:lz.java
00A1:m.java
0014:ma.java
000A:mb.java
0043:mc.java
007E:md.java
010D:me.java
003A:mf.java
002E:mg.java
0038:mh.java
0154:mi.java
03E9:mj.java
0431:mk.java
01DF:ml.java
0047:mm.java
00BB:mn.java
00E0:mo.java
0084:mp.java
00BB:mq.java
003F:mr.java
002F:ms.java
003A:mt.java
0082:mu.java
0008:mv.java
0044:mw.java
0074:mx.java
00BB:my.java
0022:mz.java
006E:n.java
006D:na.java
0010:nb.java
006C:nc.java
00EC:nd.java
0037:ne.java
0173:nf.java
008D:ng.java
0035:nh.java
003E:ni.java
0278:nj.java
003A:nk.java
01D8:nl.java
0014:nm.java
00BA:nn.java
03C9:no.java
0013:np.java
0321:nq.java
0006:nr.java
000E:ns.java
002D:nt.java
0009:nu.java
02B2:nv.java
0BF2:nw.java
007A:nx.java
006E:ny.java
002C:nz.java
0014:o.java
015E:oa.java
0078:ob.java
0F26:oc.java
004B:od.java
0008:oe.java
0078:of.java
04CD:og.java
002D:oh.java
00A5:oi.java
001C:oj.java
0025:ok.java
0023:ol.java
0041:p.java
00A1:q.java
010B:r.java
004D:s.java
0015:t.java
0015:u.java
046A:v.java
000D:w.java
00C4:x.java
0078:y.java
0050:z.java

Even if notch distribute a new version of the game, this simple tool will let us quickly detect the new names


Tei
Admin

Posts : 32
Join date : 2010-10-15

View user profile http://mcdocs.team-talk.net

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum