Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.0 rewrite #14

Draft
wants to merge 180 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
180 commits
Select commit Hold shift + click to select a range
5c40ff2
Huge refactor of buildscript
solonovamax Jun 12, 2023
42494e9
oopsies autoformat did a glob import
solonovamax Jun 12, 2023
2b84ea0
Fix build issue after rebasing onto master
solonovamax Jun 13, 2023
0d2fa9b
Remove personal maven repo from publishing & repositories
solonovamax Jun 13, 2023
db7fac4
Fix funny build error on github actions
solonovamax Jun 13, 2023
b9e6da9
Merge pull request #12 from solonovamax/build/gradle-buildscript-refa…
KosmX Jun 13, 2023
a46b717
Organize modules, replace logger to slf4k, fix dependencies, create s…
KosmX Jun 14, 2023
16fc513
start moving packages
KosmX Jun 17, 2023
a39a776
debug logger config
KosmX Jun 17, 2023
8ddc462
Create new interfaces for rules, matcher and result
KosmX Jun 17, 2023
dcc28b0
Move utility stuff
KosmX Jun 17, 2023
8a0f541
remove unneeded lazy
KosmX Jun 17, 2023
57c54fb
Refactor whole scanning logic, make future extension easier,
KosmX Jun 17, 2023
d74b31f
Update database generation code
KosmX Jun 17, 2023
7cbb2e4
Update interfaces
KosmX Jun 17, 2023
15aed54
Fix a major bug causing the whole detector to not function
KosmX Jun 17, 2023
7b39e68
change fat-jar naming scheme
KosmX Jun 18, 2023
6fa322d
gitignore logs
KosmX Jun 18, 2023
cf3e61e
collect all artifacts
KosmX Jun 18, 2023
938c8f0
cleanup unused method
KosmX Jun 18, 2023
652f87e
more debug logging
KosmX Jun 18, 2023
f5ba620
Merge pull request #17 from KosmX/dev_2.0_massive_refactor
KosmX Jun 19, 2023
29952e6
Extra notes and compatibility names on severity levels
KosmX Jun 23, 2023
3f85125
proper logging
KosmX Jun 28, 2023
69ade6d
minor refactor on database deserialization
KosmX Jun 28, 2023
c467eb5
Create CONTRIBUTING.md
KosmX Jun 30, 2023
dfd708a
Merge branch 'dev_2.0' into KosmX-patch-1
KosmX Jul 9, 2023
1e287d7
Merge pull request #18 from KosmX/KosmX-patch-1
KosmX Jul 9, 2023
787ffd7
update gitignore
KosmX Jul 9, 2023
cf1eb27
update gradle wrapper to 8.2
KosmX Jul 9, 2023
03df40e
Add slf4k to gui module
KosmX Jul 9, 2023
761e59d
Fix logger configuration, and add gui default config
KosmX Jul 9, 2023
cb07d7e
add initialized value and re-initialization check to avoid accidental…
KosmX Jul 9, 2023
e9dbdca
Some fixes in GUI
KosmX Jul 9, 2023
cb3ff72
Create dependabot.yml
KosmX Jul 9, 2023
3dd68d9
Add GitHub dependency submission
KosmX Jul 9, 2023
54afe7a
dependencyOops
KosmX Jul 9, 2023
19852f6
Merge pull request #25 from KosmX/dev_2.0
KosmX Jul 9, 2023
aa59ddc
Update build.yml
KosmX Jul 9, 2023
c9259a0
Update build.yml
KosmX Jul 9, 2023
7afe129
Merge pull request #19 from KosmX/dependency_submission
KosmX Jul 9, 2023
4311bcc
Include submodule dependencies in graph
KosmX Jul 9, 2023
bbd822b
Attempt dependency stuff again (#26)
KosmX Jul 9, 2023
1cfd2f0
failing dependency submission shouldn't fail the action
KosmX Jul 9, 2023
78bcc83
Bump ch.qos.logback:logback-classic from 1.3.7 to 1.4.8
dependabot[bot] Jul 9, 2023
1350e03
Merge pull request #24 from KosmX/dependabot/gradle/ch.qos.logback-lo…
KosmX Jul 9, 2023
ce9575e
Bump com.github.ajalt.clikt:clikt from 3.5.2 to 4.0.0
dependabot[bot] Jul 9, 2023
2345a64
Merge pull request #23 from KosmX/dependabot/gradle/com.github.ajalt.…
KosmX Jul 9, 2023
60f290a
Bump kotlinx-coroutines from 1.7.1 to 1.7.2
dependabot[bot] Jul 9, 2023
12b2cc7
Merge pull request #22 from KosmX/dependabot/gradle/kotlinx-coroutine…
KosmX Jul 9, 2023
110e92d
Bump commons-codec:commons-codec from 1.15 to 1.16.0
dependabot[bot] Jul 9, 2023
06b58ea
Update lljzip to 2.1.2
KosmX Jul 9, 2023
4508b5c
Merge pull request #21 from KosmX/dependabot/gradle/commons-codec-com…
KosmX Jul 9, 2023
63d83f4
Bump junit-jupiter from 5.9.2 to 5.9.3
dependabot[bot] Jul 9, 2023
dd56307
Bump pl.allegro.tech.build.axion-release from 1.15.0 to 1.15.3
dependabot[bot] Jul 9, 2023
44dc9ad
Bump com.google.guava:guava from 31.1-jre to 32.1.1-jre
dependabot[bot] Jul 9, 2023
5a1b629
Bump com.squareup.okio:okio from 3.3.0 to 3.4.0
dependabot[bot] Jul 9, 2023
10728bd
Bump org.jetbrains.compose from 1.4.0 to 1.4.1
dependabot[bot] Jul 9, 2023
0f810ee
Update dependabot.yml
KosmX Jul 9, 2023
dde429f
Merge pull request #20 from KosmX/dependabot/gradle/junit-jupiter-5.9.3
KosmX Jul 9, 2023
bf795fc
Bump com.darkrockstudios:mpfilepicker-desktop from 1.1.0 to 1.2.0
dependabot[bot] Jul 9, 2023
0475082
Merge pull request #27 from KosmX/dependabot/gradle/pl.allegro.tech.b…
KosmX Jul 9, 2023
871e4fb
Merge pull request #28 from KosmX/dependabot/gradle/com.google.guava-…
KosmX Jul 9, 2023
645ca16
Merge pull request #29 from KosmX/dependabot/gradle/com.squareup.okio…
KosmX Jul 9, 2023
e583190
Merge pull request #30 from KosmX/dependabot/gradle/org.jetbrains.com…
KosmX Jul 9, 2023
14fa689
Merge pull request #31 from KosmX/dependabot/gradle/com.darkrockstudi…
KosmX Jul 9, 2023
b22019e
Bump org.gradle.toolchains.foojay-resolver-convention
dependabot[bot] Jul 17, 2023
196f510
Bump com.github.ajalt.clikt:clikt from 4.0.0 to 4.1.0
dependabot[bot] Jul 17, 2023
3d8a2df
Merge pull request #32 from KosmX/dependabot/gradle/org.gradle.toolch…
KosmX Jul 17, 2023
df3d34d
Merge pull request #33 from KosmX/dependabot/gradle/com.github.ajalt.…
KosmX Jul 17, 2023
e5760ed
Bump junit-jupiter from 5.9.3 to 5.10.0
dependabot[bot] Jul 24, 2023
4c99678
Merge pull request #34 from KosmX/dependabot/gradle/junit-jupiter-5.10.0
KosmX Jul 24, 2023
e8db89c
Use logback 1.3.8 to maintain java 1.8 compatibility
KosmX Jul 29, 2023
0c8aeec
Bump org.apache.commons:commons-lang3 from 3.12.0 to 3.13.0
dependabot[bot] Jul 29, 2023
0a1d326
Bump kotlinx-coroutines from 1.7.2 to 1.7.3
dependabot[bot] Jul 29, 2023
dca3530
Bump org.jetbrains.compose from 1.4.1 to 1.4.3
dependabot[bot] Jul 29, 2023
2922a34
Bump pl.allegro.tech.build.axion-release from 1.15.3 to 1.15.4
dependabot[bot] Jul 29, 2023
772c5dd
Merge pull request #38 from KosmX/dependabot/gradle/org.apache.common…
KosmX Jul 30, 2023
0d6f19a
Merge pull request #41 from KosmX/dependabot/gradle/org.jetbrains.com…
KosmX Jul 30, 2023
ae162b5
Merge pull request #39 from KosmX/dependabot/gradle/kotlinx-coroutine…
KosmX Jul 30, 2023
d7cafe0
Merge pull request #42 from KosmX/dependabot/gradle/pl.allegro.tech.b…
KosmX Jul 30, 2023
879c55d
docs(readme): Add quickstart section
FGBxRamel Jul 30, 2023
3a06ae0
docs(readme): Add GUI quickstart section
FGBxRamel Jul 30, 2023
4ebcde8
docs(readme): Add CLI section
FGBxRamel Jul 30, 2023
ccaa128
ref(readme): Delete old GUI section
FGBxRamel Jul 30, 2023
0b1c7eb
ref(readme): Merge old CLI section with new one
FGBxRamel Jul 30, 2023
cc12da1
ref(cli-mode): Hold Shift instead of Press
FGBxRamel Jul 30, 2023
bd4ad0b
docs(cli): Explain output when finished
FGBxRamel Jul 30, 2023
e70ea38
doc(readme): Warning for advanced options
FGBxRamel Jul 30, 2023
89f12c8
docs(readme): State that Java 1.8 isn't working
FGBxRamel Jul 30, 2023
31b3a2d
Merge pull request #44 from FGBxRamel/docs/quickstart
KosmX Jul 30, 2023
3e8937d
Bump com.charleskorn.kaml:kaml from 0.54.0 to 0.55.0
dependabot[bot] Jul 31, 2023
36fcf6e
Bump com.github.ajalt.clikt:clikt from 4.1.0 to 4.2.0
dependabot[bot] Jul 31, 2023
347b7ab
Catch more ZIP exceptions
KosmX Jul 31, 2023
7a3a9f7
completely gitignore logs
KosmX Jul 31, 2023
2dcbd18
Properly relocate libraries, fixes #45
KosmX Jul 31, 2023
09834a8
re-add java-agent info to META-INF
KosmX Jul 31, 2023
a193b9b
Bump com.squareup.okio:okio from 3.4.0 to 3.5.0
dependabot[bot] Aug 7, 2023
c818597
Bump ch.qos.logback:logback-classic from 1.3.8 to 1.3.9
dependabot[bot] Aug 7, 2023
77c2fc4
Bump com.google.guava:guava from 32.1.1-jre to 32.1.2-jre
dependabot[bot] Aug 7, 2023
227d4b8
Bump software.coley:lljzip from 2.1.2 to 2.1.3
dependabot[bot] Aug 7, 2023
48a8d68
Merge pull request #55 from KosmX/dependabot/gradle/software.coley-ll…
KosmX Aug 7, 2023
53b5024
Merge pull request #53 from KosmX/dependabot/gradle/ch.qos.logback-lo…
KosmX Aug 7, 2023
c792dc8
Merge pull request #52 from KosmX/dependabot/gradle/com.squareup.okio…
KosmX Aug 7, 2023
b98d840
Merge pull request #54 from KosmX/dependabot/gradle/com.google.guava-…
KosmX Aug 7, 2023
6f7a78f
Merge pull request #48 from KosmX/dependabot/gradle/com.github.ajalt.…
KosmX Aug 7, 2023
b704603
Merge pull request #47 from KosmX/dependabot/gradle/com.charleskorn.k…
KosmX Aug 7, 2023
3007975
Bump ch.qos.logback:logback-classic from 1.3.9 to 1.3.11
dependabot[bot] Aug 14, 2023
eaa1e70
Merge pull request #56 from KosmX/dependabot/gradle/ch.qos.logback-lo…
KosmX Aug 14, 2023
36483cb
Bump org.gradle.toolchains.foojay-resolver-convention
dependabot[bot] Aug 21, 2023
7237b0f
Detecting weirdUtils
KosmX Aug 22, 2023
0e0fa78
Merge pull request #58 from KosmX/utilsdetector
KosmX Aug 22, 2023
2a6327b
Modify json format to keep compatibility
KosmX Aug 22, 2023
ca48507
Bump kotlinx-serialization from 1.5.1 to 1.6.0
dependabot[bot] Aug 28, 2023
e3ed5a9
Bump org.jetbrains.kotlinx:kotlinx-datetime from 0.4.0 to 0.4.1
dependabot[bot] Sep 4, 2023
f765f8f
Bump org.jetbrains.compose from 1.4.3 to 1.5.0
dependabot[bot] Sep 4, 2023
12ea9b8
Bump software.coley:lljzip from 2.1.3 to 2.2.0
dependabot[bot] Sep 4, 2023
b6176c1
Bump org.slf4j:slf4j-api from 2.0.7 to 2.0.9
dependabot[bot] Sep 4, 2023
1f8c578
Bump org.jetbrains.kotlinx:kotlinx-cli from 0.3.5 to 0.3.6
dependabot[bot] Sep 4, 2023
0b64cb6
Bump kotlin from 1.8.20 to 1.9.0
dependabot[bot] Sep 4, 2023
212320c
Merge pull request #57 from KosmX/dependabot/gradle/org.gradle.toolch…
KosmX Sep 4, 2023
64c3499
Merge pull request #59 from KosmX/dependabot/gradle/kotlinx-serializa…
KosmX Sep 4, 2023
5fe0732
Merge pull request #60 from KosmX/dependabot/gradle/org.jetbrains.kot…
KosmX Sep 4, 2023
676d567
Merge pull request #61 from KosmX/dependabot/gradle/org.jetbrains.com…
KosmX Sep 4, 2023
f3b7f0b
Merge pull request #65 from KosmX/dependabot/gradle/kotlin-1.9.0
KosmX Sep 4, 2023
05a88e5
Merge pull request #63 from KosmX/dependabot/gradle/org.slf4j-slf4j-a…
KosmX Sep 4, 2023
2ce0a38
Merge pull request #62 from KosmX/dependabot/gradle/software.coley-ll…
KosmX Sep 4, 2023
7a24f8d
Merge pull request #64 from KosmX/dependabot/gradle/org.jetbrains.kot…
KosmX Sep 4, 2023
86ce5ab
Bump org.jetbrains.compose from 1.5.0 to 1.5.1
dependabot[bot] Sep 11, 2023
c8534e3
Bump org.apache.commons:commons-compress from 1.23.0 to 1.24.0
dependabot[bot] Sep 11, 2023
81cdaa9
Merge pull request #66 from KosmX/dependabot/gradle/org.jetbrains.com…
KosmX Sep 11, 2023
13ad49b
Merge pull request #67 from KosmX/dependabot/gradle/org.apache.common…
KosmX Sep 11, 2023
766b43e
build(deps): bump software.coley:lljzip from 2.2.0 to 2.3.0
dependabot[bot] Sep 25, 2023
1e5a97a
build(deps): bump com.squareup.okio:okio from 3.5.0 to 3.6.0
dependabot[bot] Oct 2, 2023
187b5c9
build(deps): bump commons-io:commons-io from 2.13.0 to 2.14.0
dependabot[bot] Oct 2, 2023
7313738
build(deps): bump asm from 9.5 to 9.6
dependabot[bot] Oct 2, 2023
0cbe860
build(deps): bump org.jetbrains.compose from 1.5.1 to 1.5.2
dependabot[bot] Oct 2, 2023
14699f9
build(deps): bump pl.allegro.tech.build.axion-release
dependabot[bot] Oct 2, 2023
efd6d07
Merge pull request #69 from KosmX/dependabot/gradle/com.squareup.okio…
KosmX Oct 2, 2023
aa05b51
Merge pull request #70 from KosmX/dependabot/gradle/commons-io-common…
KosmX Oct 2, 2023
3059167
Merge pull request #71 from KosmX/dependabot/gradle/asm-9.6
KosmX Oct 2, 2023
d74da97
Merge pull request #72 from KosmX/dependabot/gradle/org.jetbrains.com…
KosmX Oct 2, 2023
2433e04
Merge pull request #73 from KosmX/dependabot/gradle/pl.allegro.tech.b…
KosmX Oct 2, 2023
a2fa989
Merge pull request #68 from KosmX/dependabot/gradle/software.coley-ll…
KosmX Oct 2, 2023
3c83320
build(deps): bump org.jetbrains.compose from 1.5.2 to 1.5.3
dependabot[bot] Oct 9, 2023
b7331f7
build(deps): bump com.github.ajalt.clikt:clikt from 4.2.0 to 4.2.1
dependabot[bot] Oct 9, 2023
991448b
Merge pull request #74 from KosmX/dependabot/gradle/org.jetbrains.com…
KosmX Oct 9, 2023
1f75dd9
Merge pull request #75 from KosmX/dependabot/gradle/com.github.ajalt.…
KosmX Oct 9, 2023
ce5c3a7
build(deps): bump com.google.guava:guava from 32.1.2-jre to 32.1.3-jre
dependabot[bot] Oct 16, 2023
3edd8f1
Merge pull request #76 from KosmX/dependabot/gradle/com.google.guava-…
KosmX Oct 16, 2023
3ed00cf
build(deps): bump kotlin from 1.9.0 to 1.9.10
dependabot[bot] Oct 23, 2023
84d3852
Merge pull request #77 from KosmX/dependabot/gradle/kotlin-1.9.10
KosmX Oct 23, 2023
637a6f2
build(deps): bump commons-io:commons-io from 2.14.0 to 2.15.0
dependabot[bot] Oct 30, 2023
2e6ca9f
build(deps): bump org.apache.commons:commons-text from 1.10.0 to 1.11.0
dependabot[bot] Oct 30, 2023
991bc83
Merge pull request #78 from KosmX/dependabot/gradle/commons-io-common…
KosmX Oct 30, 2023
448a5ac
Merge pull request #79 from KosmX/dependabot/gradle/org.apache.common…
KosmX Oct 30, 2023
227f532
build(deps): bump junit-jupiter from 5.10.0 to 5.10.1
dependabot[bot] Nov 6, 2023
95cb54b
build(deps): bump org.jetbrains:annotations from 24.0.1 to 24.1.0
dependabot[bot] Nov 20, 2023
981adc7
build(deps): bump org.apache.commons:commons-compress
dependabot[bot] Nov 20, 2023
c5de29e
build(deps): bump org.jetbrains.compose from 1.5.3 to 1.5.11
dependabot[bot] Nov 27, 2023
dad5c05
build(deps): bump org.apache.commons:commons-lang3 from 3.13.0 to 3.14.0
dependabot[bot] Nov 27, 2023
db4d9aa
build(deps): bump kotlinx-serialization from 1.6.0 to 1.6.2
dependabot[bot] Dec 4, 2023
301f598
build(deps): bump org.jetbrains.kotlinx:kotlinx-datetime
dependabot[bot] Dec 4, 2023
154f66b
build(deps): bump ch.qos.logback:logback-classic from 1.3.11 to 1.3.14
dependabot[bot] Dec 4, 2023
01ffd92
build(deps): bump pl.allegro.tech.build.axion-release
dependabot[bot] Dec 11, 2023
322e4df
build(deps): bump com.squareup.okio:okio from 3.6.0 to 3.7.0
dependabot[bot] Dec 18, 2023
d66d0e3
build(deps): bump com.charleskorn.kaml:kaml from 0.55.0 to 0.57.0
dependabot[bot] Jan 15, 2024
7b6edae
Merge pull request #95 from KosmX/dependabot/gradle/com.charleskorn.k…
KosmX Jan 15, 2024
c3c3164
Merge pull request #94 from KosmX/dependabot/gradle/com.squareup.okio…
KosmX Jan 15, 2024
afef4ec
Merge pull request #93 from KosmX/dependabot/gradle/pl.allegro.tech.b…
KosmX Jan 15, 2024
5f4ca02
Merge pull request #89 from KosmX/dependabot/gradle/org.jetbrains.kot…
KosmX Jan 15, 2024
555e92e
Merge pull request #90 from KosmX/dependabot/gradle/ch.qos.logback-lo…
KosmX Jan 15, 2024
d9b967c
Merge pull request #87 from KosmX/dependabot/gradle/kotlinx-serializa…
KosmX Jan 15, 2024
e08c009
Merge pull request #80 from KosmX/dependabot/gradle/junit-jupiter-5.10.1
KosmX Jan 15, 2024
a59f385
Merge pull request #83 from KosmX/dependabot/gradle/org.jetbrains-ann…
KosmX Jan 15, 2024
f930935
Merge pull request #84 from KosmX/dependabot/gradle/org.apache.common…
KosmX Jan 15, 2024
1c3daae
Merge pull request #86 from KosmX/dependabot/gradle/org.apache.common…
KosmX Jan 15, 2024
7ef6435
Merge pull request #85 from KosmX/dependabot/gradle/org.jetbrains.com…
KosmX Jan 15, 2024
5fbcb48
build(deps): bump commons-io:commons-io from 2.15.0 to 2.15.1
dependabot[bot] Jan 15, 2024
b8d3ed1
Merge pull request #88 from KosmX/dependabot/gradle/commons-io-common…
KosmX Jan 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "gradle" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
open-pull-requests-limit: 12
16 changes: 14 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,23 @@ jobs:
run: chmod +x ./gradlew
- name: build
run: ./gradlew build
- name: Gradle Dependency Submission
if: ${{ runner.os != 'Windows' }}
uses: mikepenz/[email protected]
with:
gradle-build-module: |-
:api
:cli
:launchwrapper
:gui
continue-on-error: true
- name: capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS
uses: actions/upload-artifact@v3
with:
name: Artifacts
path: |
build/libs/
compose/build/libs/
api/build/libs/
cli/build/libs/
launchwrapper/build/libs/
gui/build/libs/
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ run/
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

/database
/api/database

*.pass
*.pass

**/logs
52 changes: 52 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# How can I help?

## Requesting feature or request adding malware signature to the database

In this case, feel free to open an issue or contact me on [Minecraft Malware Prevention Alliance](https://mmpa.info/) Discord server.
**Never upload malware to GitHub or Discord!** If you have a malware sample that you want to share with se, please share it via [Wormhole](https://wormhole.app/).
<!-- or use malware store TODO -->

## Contribution
If you're familiar with [Kotlin](https://kotlinlang.org/) and you want to help with the project, feel free to open pull requests.

### Pull-requests
Please keep pull requests clean: only add one feature per pull request. Pull requests modifying the whole project and adding multiple unrelated features will be rejected.
If you start working on a feature, please open a draft PR as soon as you can, and track your progress there.
This way people will know that someone is already working on XXX.


GitHub support checkboxes, you may use those:

---
```md
- [x] ticked checkbox
- [ ] todo checkbox
```
- [x] ticked checkbox
- [ ] todo checkbox


---

## Coding
Follow common sense!

### No premature optimization
First, make a feature work, then you might profile and optimize it. (you may choose efficient algorithms)

You may use Object Oriented or Functional style, but please avoid unnecessary abstraction.
A readable code is better than an optimized or obfuscated code.

### Readable code
Please avoid global variables and functions. Only use global if it is widely used in the project.
Group simple functions into Objects, or use extension functions.

Multiple classes may be declared in a single file as long as those are closely related.

If possible, avoid using reflection.

Avoid [platform types](https://kotlinlang.org/docs/java-interop.html#null-safety-and-platform-types): If java library has no nullability annotation choose the expected type.
```kt
val mayBeNull = JavaClass.function() // Any! NOT OK
val mayBeNull: Any = JavaClass.function() // Any OK
```
96 changes: 65 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,60 @@
# 🪡 jNeedle (or Needle)

Yet another jar malware detection tool

---

## Quickstart / How to use

If you came from [MMPA](https://blog.mmpa.info) or already know what this program does, look here to see how to use jNeedle.

### GUI (Graphical) mode

The easiest way to use jNeedle is to use the GUI version.
Just download the `jneedle-gui-xxx.jar` from the [release page](https://github.com/KosmX/jneedle/releases/latest) and double click on it.

_Help, it won't start!_

There currently is a bug with Java 1.8, which won't let the program start. This is known and will be fixed in the future.

### CLI mode

If you want to use the CLI version, you have to download the `jneedle-xxx-fat.jar` from the [release page](https://github.com/KosmX/jneedle/releases/latest) and run it with the following command:

```text
java -jar jneedle-xxx-fat.jar -f <path to jar or directory>
```

JNeedle will then check the given file or directory for malicious code. It gives a summary of the results at the end.

_Help, where do I need to put that command?_
On Windows, open the file explorer, navigate to the folder where you downloaded the jar file. Hold `Shift` and right click on empty space. Select `Open PowerShell window here` and type the command above.

_Help, it won't start!_
See the [GUI section](#gui-graphical-mode) for more information.

For more CLI arguments, type the command without `-f`:

```text
> java -jar .\jneedle-1.0.0.jar
Value for option --file should be always provided in command line.
Usage: jNeedle options_list
Options:
--file, -f -> file or directory (always required) { String }
--url, -u [https://maven.kosmx.dev/dev/kosmx/needles] { String }
--dblocation [C:\Users\kosmx\.jneedle] { String }
--threads [16] { Int }
--help, -h -> Usage info
```

## How to find the needle in a haystack? - Use a strong enough magnet

The detection tool is parsing jar `.class` files looking for signature instruction sequences.
It is actually similar to string search:

Is the following sequence: `"jump into the well"`
in the program:

```text
exit house and lock door,
get the bus and to the shop to buy milk
Expand All @@ -17,78 +63,66 @@ come home
```

## See the **light** at the end of the tunnel

**Attention! These are advanced options, which you probably won't need!**
For an easy setup, look at the [Quickstart](#quickstart--how-to-use) section.

### Add to PrismLauncher

### Extra jar // recommended but harder to set-up

1. Check current launch classpath in the Version menu:
Select the Fabric/Forge/Quilt/Minecraft (most bottom of these) and on the right menu, click Customize then Edit
Select the Fabric/Forge/Quilt/Minecraft (most bottom of these) and on the right menu, click Customize then Edit
2. This will open a text-editor, look for the `mainClass` entry in the class
Fabrc for example: `"mainClass": "net.fabricmc.loader.impl.launch.knot.KnotClient",`
Fabrc for example: `"mainClass": "net.fabricmc.loader.impl.launch.knot.KnotClient",`
3. Save (copy) the entry value: `net.fabricmc.loader.impl.launch.knot.KnotClient`
4. close the editor and optionally click Revert in Prismlauncher
5. click `Add to Minecraft.jar` button and select jneedle.jar
6. Click edit while jneedle.jar is selected
7. Add the following to the json:
`"+jvmArgs": ["-Ddev.kosmx.jneedle.launchClass={launchClass}"],` where you replace `{launchClass}` with the earlier saved class.
`"+jvmArgs": ["-Ddev.kosmx.jneedle.launchClass={launchClass}"],` where you replace `{launchClass}` with the earlier saved class.
8. Add the following to the json:
`"mainClass": "dev.kosmx.needle.launchWrapper.ParameterizedWrapper",`
`"mainClass": "dev.kosmx.needle.launchWrapper.ParameterizedWrapper",`
9. Save the file and have fun!

---
---

**The lines for specific launchers:**
Quilt: `"+jvmArgs": ["-Ddev.kosmx.jneedle.launchClass=org.quiltmc.loader.impl.launch.knot.KnotClient"],`
Fabric: `"+jvmArgs": ["-Ddev.kosmx.jneedle.launchClass=net.fabricmc.loader.impl.launch.knot.KnotClient"],`
Fabric: `"+jvmArgs": ["-Ddev.kosmx.jneedle.launchClass=net.fabricmc.loader.impl.launch.knot.KnotClient"],`
Forge up to 1.12.2: `"+jvmArgs": ["-Ddev.kosmx.jneedle.launchClass=net.minecraft.launchwrapper.Launch"],`
Forge from 1.13.2: `"+jvmArgs": ["-Ddev.kosmx.jneedle.launchClass=io.github.zekerzhayard.forgewrapper.installer.Main"],`
Forge from 1.13.2: `"+jvmArgs": ["-Ddev.kosmx.jneedle.launchClass=io.github.zekerzhayard.forgewrapper.installer.Main"],`

### Easy path // slow but easy-to-setup
1. In the game version menu, click `Add agents`:

1. In the game version menu, click `Add agents`:
2. Select jneedle.jar
3. Done. (It will be slow in large modpacks)

## JVM properties

Some parameter can be set as a JVM property:
`-Ddev.kosmx.jneedle.remoteDatabase` to set online database location.
`-Ddev.kosmx.jneedle.remoteDatabase=https://maven.kosmx.dev/dev/kosmx/needles` is default.
`-Ddev.kosmx.jneedle.remoteDatabase=https://maven.kosmx.dev/dev/kosmx/needles` is default.

`-Ddev.kosmx.jneedle.databasePath` to set local database cache.
`-Ddev.kosmx.jneedle.databasePath=${user.home}/.jneedle` by default.


If using `-cp jneedle.jar dev.kosmx.needle.launchWrapper.ParameterizedWrapper`
`-Ddev.kosmx.jneedle.launchClass` to set the start class after checking is completed. The application has to be in classpath.
(This is for Minecraft wrapper use)

## GUI mode
There is a gui version, you can simply open it in a graphical environment

## CLI mode
```text
> java -jar .\jneedle-1.0.0.jar
Value for option --file should be always provided in command line.
Usage: jNeedle options_list
Options:
--file, -f -> file or directory (always required) { String }
--url, -u [https://maven.kosmx.dev/dev/kosmx/needles] { String }
--dblocation [C:\Users\kosmx\.jneedle] { String }
--threads [16] { Int }
--help, -h -> Usage info
```

## API usage:

<not yet in maven, I'll change that soon>
dev.kosmx.needle.CheckWrapper object (static class) has API functions:
These can be used from any JVM interop language (ideally Kotlin)
First call `CheckWrapper.init()` to initialize database. Optionally database location and file location can be specified

Then the program state is effectively immutable, calling check function is safe from any thread anytime.
Then the program state is effectively immutable, calling check function is safe from any thread anytime.

`CheckWrapper.checkJar()` to check a single jar file (extension doesn't have to be jar)
`CheckWrapper.checkPathBlocking()` to check jar file or walk directory. Function will return with results once completed.
`CheckWrapper.checkPathBlocking()` to check jar file or walk directory. Function will return with results once completed.


`CheckWrapper.checkPath()` with parameters to check path as a coroutine function. It can have feedback while running.
This function is kotlin only.


58 changes: 58 additions & 0 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
plugins {

jneedle.compilation
alias(libs.plugins.kotlin.serialization)

//alias(libs.plugins.shadow)

jneedle.repositories
jneedle.tasks
jneedle.publishing
jneedle.dokka
}


sourceSets {
val main by getting
create("dbGen") {
compileClasspath += main.compileClasspath + main.output
runtimeClasspath += main.runtimeClasspath + main.output
}
}

dependencies {
implementation(libs.kotlin.stdlib)

implementation(libs.bundles.kotlinx.serialization)

implementation(libs.bundles.kotlinx.coroutines)
testImplementation(libs.bundles.kotlinx.coroutines.debugging)

implementation(libs.kotlinx.cli)

implementation(libs.bundles.asm)

implementation(libs.cafedude)

implementation(libs.lljzip)

implementation(libs.slf4j)
implementation(libs.slf4k)
"dbGenImplementation"(libs.logback) // API doesn't need a logger backend

testImplementation(kotlin("test"))
}


tasks {
withType<Jar>().configureEach {
manifest {
}
}

// TODO: 2023-06-12 buildDb should be a subproject, or possibly a build script thingy
create<JavaExec>("buildDb") {
this.mainClass.set("dev.kosmx.needle.dbGen.GeneratorKt")
this.classpath = sourceSets["dbGen"].runtimeClasspath
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import kotlin.io.path.writeText
import kotlin.streams.asSequence


const val databaseId = 5
const val databaseId = 6



Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dev.kosmx.needle.dbGen.db

import dev.kosmx.needle.core.MatchType
import dev.kosmx.needle.dbGen.dsl.KDSL
import dev.kosmx.needle.matcher.result.Severity
import org.objectweb.asm.Opcodes.*
import org.objectweb.asm.tree.InsnNode
import org.objectweb.asm.tree.IntInsnNode
Expand All @@ -10,7 +10,7 @@ import org.objectweb.asm.tree.TypeInsnNode

fun KDSL.fractureiser() {
malwareId = "fractureiser"
type = MatchType.MALWARE
type = Severity.SEVERE

"SIG1" byteCodeEntry {
autoFilerInstructions = true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package dev.kosmx.needle.dbGen.db

import dev.kosmx.needle.core.MatchType
import dev.kosmx.needle.dbGen.dsl.KDSL
import dev.kosmx.needle.matcher.result.Severity
import org.objectweb.asm.Opcodes.*
import org.objectweb.asm.tree.LdcInsnNode
import org.objectweb.asm.tree.TypeInsnNode

fun KDSL.sessionLogger() {
malwareId = "SessionLogger"
type = MatchType.MALWARE
type = Severity.SEVERE

"webhook" byteCodeEntry {
insn(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package dev.kosmx.needle.dbGen.db

import dev.kosmx.needle.core.MatchType
import dev.kosmx.needle.dbGen.dsl.KDSL
import dev.kosmx.needle.matcher.result.Severity
import org.objectweb.asm.Opcodes
import org.objectweb.asm.tree.LdcInsnNode
import org.objectweb.asm.tree.MethodInsnNode
import org.objectweb.asm.tree.TypeInsnNode

fun KDSL.skyrage() {
malwareId = "Skyrage"
type = MatchType.MALWARE
type = Severity.SEVERE

"Upd1" byteCodeEntry {
autoFilerInstructions = true
Expand Down
Loading
Loading