2023年7月31日发(作者:)

暴⼒破解带有密码的压缩⽂件⼀ 暴⼒破解,就是不断⽣成新的密码去尝试能否破解成功。假如我们的密码位数为3位,其⾥⾯的值有可能是0或者1,其产⽣的密码集的数量为2的3次幂,也就是⼋个,然后⼀个⼀个去破解。⽽这⽣成这8个密码的过程就有⼀个递归规则存在。我们传⼊深度deep和对应字符串passwd两个参数,如果深度为1,直接输出字符串passwd,如果深度不为1,把深度deep减⼀,并把可能存在的字符串集合[0,1]遍历,添加到passwd的后⾯,重新回到这个递归函数,直到深度deep为1输出。⼆ 解压压缩⽂件⽹上有对应的jar包去解压压缩⽂件,但是我这⾥使⽤⼀种⽐较简单的⽅法去实现,本地电脑window上装有winrar,java调⽤本地去解压压缩⽂件。其核⼼代码为:C:Program x -ibck -hp123 -y F: D:testunrar第⼀个路径是的路径,第⼆个路劲是需要解压缩⽂件的路径地址,第三个是存放的路径。-hp后⾯的123表⽰密码。下⾯是代码的实现 /** *

* @param filePath 解压⽂件路径 * @param targetPath 解压之后存放的路径 * @param passwd 密码 * @return * @throws Exception */public static int unrar(String filePath,String targetPath,String passwd) throws Exception { //winrar的执⾏路径 String rarPath="C:Program "; StringBuilder sb = new StringBuilder(); (rarPath); (" x -ibck -hp"); (passwd).append(" -y ").append(filePath+" "+targetPath); Process process; process = time().exec(ng()); if(r() ==0 ){ FileOutputStream fileOutputStream = new FileOutputStream(new File("D:")); String s = "解压后的密码:"+passwd; (es()); (); (); return 1; }else{ n(new Date()+"--失败:"+passwd); return 0 ; } } /** * 递归获取密码过程 * @param deep 深度 * @param parent 密码 * @return * @throws Exception */ public static int findpwd(int deep,String parent) throws Exception { String[] dir ={"q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l", "z","x","c","v","b","n","m","Q","W","E","R","T","Y","U","I","O","P","A","S","D","F","G","H","J","K","L","Z","X", "C","V","B","N","M","1","2","3","4","5","6","7","8","9","0","`","!","@","#","$","%","&","*","(",")","-","_","+","=","[", "]","{","}","|","",""",":",";","'","<",">",",",".","?","/"}; if(deep == 1){ if(unrar("","",parent) == 1){ return 1; }else{ return 0; } }else{ for(int j =0;j<;j++){ if(findpwd(deep-1,parent+dir[j]) ==1 ){ return 1; } } } return 0; }⽂章最后的总结:破解的难度跟设置密码的长度有关,破解⼀位的密码只需要92的1次幂个密码,⽽破解六位的密码需要92的6次幂个密码,其难度可想⽽知。所以这⾥写的内容只供学习参考。

2023年7月31日发(作者:)

暴⼒破解带有密码的压缩⽂件⼀ 暴⼒破解,就是不断⽣成新的密码去尝试能否破解成功。假如我们的密码位数为3位,其⾥⾯的值有可能是0或者1,其产⽣的密码集的数量为2的3次幂,也就是⼋个,然后⼀个⼀个去破解。⽽这⽣成这8个密码的过程就有⼀个递归规则存在。我们传⼊深度deep和对应字符串passwd两个参数,如果深度为1,直接输出字符串passwd,如果深度不为1,把深度deep减⼀,并把可能存在的字符串集合[0,1]遍历,添加到passwd的后⾯,重新回到这个递归函数,直到深度deep为1输出。⼆ 解压压缩⽂件⽹上有对应的jar包去解压压缩⽂件,但是我这⾥使⽤⼀种⽐较简单的⽅法去实现,本地电脑window上装有winrar,java调⽤本地去解压压缩⽂件。其核⼼代码为:C:Program x -ibck -hp123 -y F: D:testunrar第⼀个路径是的路径,第⼆个路劲是需要解压缩⽂件的路径地址,第三个是存放的路径。-hp后⾯的123表⽰密码。下⾯是代码的实现 /** *

* @param filePath 解压⽂件路径 * @param targetPath 解压之后存放的路径 * @param passwd 密码 * @return * @throws Exception */public static int unrar(String filePath,String targetPath,String passwd) throws Exception { //winrar的执⾏路径 String rarPath="C:Program "; StringBuilder sb = new StringBuilder(); (rarPath); (" x -ibck -hp"); (passwd).append(" -y ").append(filePath+" "+targetPath); Process process; process = time().exec(ng()); if(r() ==0 ){ FileOutputStream fileOutputStream = new FileOutputStream(new File("D:")); String s = "解压后的密码:"+passwd; (es()); (); (); return 1; }else{ n(new Date()+"--失败:"+passwd); return 0 ; } } /** * 递归获取密码过程 * @param deep 深度 * @param parent 密码 * @return * @throws Exception */ public static int findpwd(int deep,String parent) throws Exception { String[] dir ={"q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l", "z","x","c","v","b","n","m","Q","W","E","R","T","Y","U","I","O","P","A","S","D","F","G","H","J","K","L","Z","X", "C","V","B","N","M","1","2","3","4","5","6","7","8","9","0","`","!","@","#","$","%","&","*","(",")","-","_","+","=","[", "]","{","}","|","",""",":",";","'","<",">",",",".","?","/"}; if(deep == 1){ if(unrar("","",parent) == 1){ return 1; }else{ return 0; } }else{ for(int j =0;j<;j++){ if(findpwd(deep-1,parent+dir[j]) ==1 ){ return 1; } } } return 0; }⽂章最后的总结:破解的难度跟设置密码的长度有关,破解⼀位的密码只需要92的1次幂个密码,⽽破解六位的密码需要92的6次幂个密码,其难度可想⽽知。所以这⾥写的内容只供学习参考。