Skip to content

Commit 3d5518c

Browse files
committed
Initial commit
0 parents  commit 3d5518c

4 files changed

Lines changed: 275 additions & 0 deletions

File tree

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[*]
2+
charset = utf-8
3+
end_of_line = lf
4+
indent_size = 4
5+
indent_style = space
6+
insert_final_newline = false
7+
max_line_length = 120
8+
tab_width = 4
9+
ij_continuation_indent_size = 8
10+
11+
[*.java]
12+
ij_java_align_multiline_chained_methods = true

.gitignore

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
2+
# Created by https://www.toptal.com/developers/gitignore/api/eclipse,intellij+all,maven,bluej
3+
# Edit at https://www.toptal.com/developers/gitignore?templates=eclipse,intellij+all,maven,bluej
4+
5+
### bluej ###
6+
# BlueJ: A Java IDE for programming beginners. http://bluej.org
7+
8+
# Editor preferences for a class etc, see http://lists.bluej.org/pipermail/bluej-discuss/2003-May/002351.html
9+
*.ctxt
10+
11+
# Duplicate of project file, see http://www.hs-owl.de/fb5/labor/it/de/if1/vl/IF1JavaOhneBluej.pdf, page 4
12+
bluej.pkh
13+
14+
### Eclipse ###
15+
.metadata
16+
bin/
17+
tmp/
18+
*.tmp
19+
*.bak
20+
*.swp
21+
*~.nib
22+
local.properties
23+
.settings/
24+
.loadpath
25+
.recommenders
26+
27+
# External tool builders
28+
.externalToolBuilders/
29+
30+
# Locally stored "Eclipse launch configurations"
31+
*.launch
32+
33+
# PyDev specific (Python IDE for Eclipse)
34+
*.pydevproject
35+
36+
# CDT-specific (C/C++ Development Tooling)
37+
.cproject
38+
39+
# CDT- autotools
40+
.autotools
41+
42+
# Java annotation processor (APT)
43+
.factorypath
44+
45+
# PDT-specific (PHP Development Tools)
46+
.buildpath
47+
48+
# sbteclipse plugin
49+
.target
50+
51+
# Tern plugin
52+
.tern-project
53+
54+
# TeXlipse plugin
55+
.texlipse
56+
57+
# STS (Spring Tool Suite)
58+
.springBeans
59+
60+
# Code Recommenders
61+
.recommenders/
62+
63+
# Annotation Processing
64+
.apt_generated/
65+
.apt_generated_test/
66+
67+
# Scala IDE specific (Scala & Java development for Eclipse)
68+
.cache-main
69+
.scala_dependencies
70+
.worksheet
71+
72+
# Uncomment this line if you wish to ignore the project description file.
73+
# Typically, this file would be tracked if it contains build/dependency configurations:
74+
#.project
75+
76+
### Eclipse Patch ###
77+
# Spring Boot Tooling
78+
.sts4-cache/
79+
80+
### Intellij+all ###
81+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
82+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
83+
84+
# User-specific stuff
85+
.idea/**/workspace.xml
86+
.idea/**/tasks.xml
87+
.idea/**/usage.statistics.xml
88+
.idea/**/dictionaries
89+
.idea/**/shelf
90+
91+
# Generated files
92+
.idea/**/contentModel.xml
93+
94+
# Sensitive or high-churn files
95+
.idea/**/dataSources/
96+
.idea/**/dataSources.ids
97+
.idea/**/dataSources.local.xml
98+
.idea/**/sqlDataSources.xml
99+
.idea/**/dynamic.xml
100+
.idea/**/uiDesigner.xml
101+
.idea/**/dbnavigator.xml
102+
103+
# Gradle
104+
.idea/**/gradle.xml
105+
.idea/**/libraries
106+
107+
# Gradle and Maven with auto-import
108+
# When using Gradle or Maven with auto-import, you should exclude module files,
109+
# since they will be recreated, and may cause churn. Uncomment if using
110+
# auto-import.
111+
# .idea/artifacts
112+
# .idea/compiler.xml
113+
# .idea/jarRepositories.xml
114+
# .idea/modules.xml
115+
# .idea/*.iml
116+
# .idea/modules
117+
# *.iml
118+
# *.ipr
119+
120+
# CMake
121+
cmake-build-*/
122+
123+
# Mongo Explorer plugin
124+
.idea/**/mongoSettings.xml
125+
126+
# File-based project format
127+
*.iws
128+
129+
# IntelliJ
130+
out/
131+
132+
# mpeltonen/sbt-idea plugin
133+
.idea_modules/
134+
135+
# JIRA plugin
136+
atlassian-ide-plugin.xml
137+
138+
# Cursive Clojure plugin
139+
.idea/replstate.xml
140+
141+
# Crashlytics plugin (for Android Studio and IntelliJ)
142+
com_crashlytics_export_strings.xml
143+
crashlytics.properties
144+
crashlytics-build.properties
145+
fabric.properties
146+
147+
# Editor-based Rest Client
148+
.idea/httpRequests
149+
150+
# Android studio 3.1+ serialized cache file
151+
.idea/caches/build_file_checksums.ser
152+
153+
### Intellij+all Patch ###
154+
# Ignores the whole .idea folder and all .iml files
155+
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
156+
157+
.idea/
158+
159+
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
160+
161+
*.iml
162+
modules.xml
163+
.idea/misc.xml
164+
*.ipr
165+
166+
# Sonarlint plugin
167+
.idea/sonarlint
168+
169+
### Maven ###
170+
target/
171+
pom.xml.tag
172+
pom.xml.releaseBackup
173+
pom.xml.versionsBackup
174+
pom.xml.next
175+
release.properties
176+
dependency-reduced-pom.xml
177+
buildNumber.properties
178+
.mvn/timing.properties
179+
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
180+
.mvn/wrapper/maven-wrapper.jar
181+
182+
# End of https://www.toptal.com/developers/gitignore/api/eclipse,intellij+all,maven,bluej
183+
.classpath
184+
.project

pom.xml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>org.example</groupId>
8+
<artifactId>CustomTransformerSample</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
11+
<properties>
12+
<maven.compiler.source>8</maven.compiler.source>
13+
<maven.compiler.target>8</maven.compiler.target>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
<asm.version>9.4</asm.version>
16+
</properties>
17+
18+
<repositories>
19+
<repository>
20+
<id>jitpack.io</id>
21+
<url>https://jitpack.io</url>
22+
</repository>
23+
</repositories>
24+
25+
<dependencies>
26+
<dependency>
27+
<groupId>com.github.qTechnologiesV2</groupId>
28+
<artifactId>qProtect-API</artifactId>
29+
<version>1.9.2</version>
30+
</dependency>
31+
<dependency>
32+
<groupId>org.ow2.asm</groupId>
33+
<artifactId>asm</artifactId>
34+
<version>${asm.version}</version>
35+
</dependency>
36+
<dependency>
37+
<groupId>org.ow2.asm</groupId>
38+
<artifactId>asm-tree</artifactId>
39+
<version>${asm.version}</version>
40+
</dependency>
41+
</dependencies>
42+
43+
</project>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package de.brownie.customtransformer;
2+
3+
import dev.mdma.qprotect.api.jar.JarFile;
4+
import dev.mdma.qprotect.api.transformer.ClassTransformer;
5+
import dev.mdma.qprotect.api.transformer.TransformException;
6+
import dev.mdma.qprotect.api.transformer.exclusions.ExclusionType;
7+
import org.objectweb.asm.Opcodes;
8+
import org.objectweb.asm.tree.ClassNode;
9+
import org.objectweb.asm.tree.InsnNode;
10+
11+
//Sample transformer that adds useless NOP instuctions
12+
public class NopSpamTransformer extends ClassTransformer {
13+
public NopSpamTransformer() {
14+
super("NopSpamTransformer", "Added {} NOP instructions");
15+
}
16+
17+
@Override
18+
public boolean runOnClass(String s, ClassNode classNode, JarFile jarFile) throws TransformException {
19+
//loop through methods
20+
classNode.methods.forEach(methodNode ->
21+
//loop through instructions
22+
methodNode.instructions.forEach(abstractInsnNode -> {
23+
//Add useless NOP instruction before each real instruction
24+
methodNode.instructions.insertBefore(abstractInsnNode, new InsnNode(Opcodes.NOP));
25+
counter.incrementAndGet();
26+
}));
27+
28+
//return true if class was modified
29+
return true;
30+
}
31+
32+
@Override
33+
public ExclusionType getExclusionType() {
34+
return ExclusionType.CUSTOM;
35+
}
36+
}

0 commit comments

Comments
 (0)