diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index ed3f9c4..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Maven Build and Release - -on: - workflow_dispatch: - -jobs: - release: - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Set up JDK - uses: actions/setup-java@v2 - with: - distribution: 'adopt' - java-version: '8' - - - name: Build with Maven - run: mvn clean package - - - name: Check Latest Release - id: check_latest_release - run: | - LATEST_RELEASE=$(curl -s "https://api.github.com/repos/${{ github.repository }}/releases/latest" | jq -r .id) - echo "::set-output name=latest_release::$LATEST_RELEASE" - - - name: Delete Previous Release - if: steps.check_latest_release.outputs.latest_release != 'null' - run: | - # Get the latest release ID - RELEASE_ID=$(curl -s "https://api.github.com/repos/${{ github.repository }}/releases/latest" | jq -r .id) - - # Delete the release - curl -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/releases/${RELEASE_ID}" - - - name: Set up Git - run: | - git config user.email "novice88@users.noreply.github.com" - git config user.name "novitechie" - - - name: Create Tag - run: git tag -a v${{ github.run_number }} -m "release" - - - name: Push Tag - run: git push origin v${{ github.run_number }} - - - name: Create Release - id: create_release - uses: ncipollo/release-action@v1 - with: - artifacts: "target/privacy.jar" - tag: release \ No newline at end of file diff --git a/readme.md b/readme.md index c64f89c..39e770c 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,4 @@ plugin-privacy A plugin for the ja-netfilter,it protects our VM options file from being read by malicious plugins - Use the `mvn clean package` command to compile and use privacy.jar file! diff --git a/src/main/java/com/novitechie/VMOptionsTransformer.java b/src/main/java/com/novitechie/VMOptionsTransformer.java index f213362..4391cb8 100644 --- a/src/main/java/com/novitechie/VMOptionsTransformer.java +++ b/src/main/java/com/novitechie/VMOptionsTransformer.java @@ -23,11 +23,22 @@ public class VMOptionsTransformer implements MyTransformer { InsnList list = new InsnList(); list.add(new MethodInsnNode(INVOKESTATIC, "com/novitechie/StackTraceRule", "check", "()Z", false)); LabelNode labelNode = new LabelNode(); - list.add(new JumpInsnNode(IFEQ,labelNode)); + list.add(new JumpInsnNode(IFEQ, labelNode)); list.add(new InsnNode(ACONST_NULL)); list.add(new InsnNode(ARETURN)); list.add(labelNode); m.instructions.insert(list); + } else if ("readOption".equals(m.name) && "(Ljava/lang/String;Z)Ljava/lang/String;".equals(m.desc)) { + InsnList list = new InsnList(); + LabelNode continueLabel = new LabelNode(); + list.add(new VarInsnNode(ALOAD, 0)); + list.add(new LdcInsnNode("javaagent")); + list.add(new MethodInsnNode(INVOKEVIRTUAL, "java/lang/String", "contains", "(Ljava/lang/CharSequence;)Z", false)); + list.add(new JumpInsnNode(IFEQ, continueLabel)); + list.add(new InsnNode(ACONST_NULL)); + list.add(new InsnNode(ARETURN)); + list.add(continueLabel); + m.instructions.insert(list); } } ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);