Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit dedac0d

Browse files
committed
Modding Integration + Codebase Update
1 parent 81c47a9 commit dedac0d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+434
-209
lines changed

AppSettings.cfg

+9
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ ModdingEnabled = false
2323
# It is recommended to let this enabled, unless you know EXACTLY, what you are doing.
2424
DisableModsOnAdministration = true
2525

26+
# Disables the external mod JAR files, when the Application was built, or its binaries changed
27+
# permission levels from regular to SetUID/SetGID permissions. These permissions have security
28+
# implications, and external mod JAR files can initiate a SetUID/SetGID change, allowing Root
29+
# execution. Recommended to let it stay enabled (true).
30+
# !! WARNING !!
31+
# If someone tells you to disable it, it is very likely a SCAM or MALWARE being delivered.
32+
# It is recommended to let this enabled, unless you know EXACTLY, what you are doing.
33+
DisableModsOnUidChange = true
34+
2635
# Allows the execution of this software, even with tampered core application files.
2736
# Not recommended, when you did not allow the core application to be modified.
2837
# Use at your own risk.

build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ if [[ "$INSTALL_CHOICE" =~ ^[Yy]$ ]]; then
170170
fi
171171
fi
172172

173-
echo "> Copying built files"
173+
echo "// Copying built files"
174174
"$PREFIX" mkdir -p /usr/share/bc100dev/osintgram4j/
175175
"$PREFIX" cp -r out/pkg/osintgram4j/* /usr/share/bc100dev/osintgram4j
176176
"$PREFIX" ln -s /usr/share/bc100dev/osintgram4j/bin/osintgram4j /usr/bin/osintgram4j

commons/src/net/bc100dev/commons/utils/Utility.java

-6
Original file line numberDiff line numberDiff line change
@@ -183,17 +183,11 @@ public static File getBinaryPath(String name) throws IOException {
183183
File bin = new File(pathContent);
184184
if ((bin.exists() && bin.canExecute()) && (getOperatingSystem() == OperatingSystem.WINDOWS ?
185185
bin.getName().equalsIgnoreCase(name) : bin.getName().equals(name))) {
186-
passedPathContents.clear();
187-
passedPathEntries.clear();
188-
189186
return bin;
190187
}
191188
}
192189
}
193190

194-
passedPathContents.clear();
195-
passedPathEntries.clear();
196-
197191
return null;
198192
}
199193

commons/src/osintgram4j/commons/AppConstants.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
public class AppConstants {
66

7-
public static final Logger log = Logger.getLogger("osintgram4j");
7+
public static final Logger log_og4j = Logger.getLogger("osintgram4j");
8+
public static final Logger log_net = Logger.getLogger("og4j-network");
89

910
}

commons/src/osintgram4j/commons/PackagedApplication.java

+20-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package osintgram4j.commons;
22

3+
import net.bc100dev.commons.ApplicationException;
4+
35
import java.io.File;
46

57
/**
@@ -16,37 +18,49 @@ private static String withValue(String key) {
1618
private static final String oldPrefix = ".app.locations";
1719
private static final String newPrefix = "og4j.location";
1820

19-
public static File getApplicationDirectory() {
21+
public static File getApplicationDirectory() throws ApplicationException {
2022
String k = oldPrefix + ".app_dir";
2123
String v = withValue(k);
2224
if (v != null)
2325
return new File(v);
2426

2527
k = newPrefix + ".app_dir";
2628
v = withValue(k);
27-
return v != null ? new File(v) : null;
29+
30+
if (v == null)
31+
throw new ApplicationException("Application directory was not initialized");
32+
33+
return new File(v);
2834
}
2935

30-
public static File getRootDirectory() {
36+
public static File getRootDirectory() throws ApplicationException {
3137
String k = oldPrefix + ".root_dir";
3238
String v = withValue(k);
3339
if (v != null)
3440
return new File(v);
3541

3642
k = newPrefix + ".root_dir";
3743
v = withValue(k);
38-
return v != null ? new File(v) : null;
44+
45+
if (v == null)
46+
throw new ApplicationException("Application directory was not initialized");
47+
48+
return new File(v);
3949
}
4050

41-
public static File getBinaryDirectory() {
51+
public static File getBinaryDirectory() throws ApplicationException {
4252
String k = oldPrefix + ".bin_dir";
4353
String v = withValue(k);
4454
if (v != null)
4555
return new File(v);
4656

4757
k = newPrefix + ".bin_dir";
4858
v = withValue(k);
49-
return v != null ? new File(v) : null;
59+
60+
if (v == null)
61+
throw new ApplicationException("Application directory was not initialized");
62+
63+
return new File(v);
5064
}
5165

5266
}

commons/src/osintgram4j/commons/ShellConfig.java commons/src/osintgram4j/commons/ShellEnvironment.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package osintgram4j.commons;
22

3-
public class ShellConfig {
3+
public class ShellEnvironment {
44

55
private final String name;
66
private String value;
77

8-
public ShellConfig(String name, String value) {
8+
public ShellEnvironment(String name, String value) {
99
this.name = name;
1010
this.value = value;
1111
}

extres/usermod-example.json

+5-8
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22
"ModInfo": {
33
"Author": "ExampleUser",
44
"Name": "ModName",
5-
"Version": "1.00",
6-
"PackageName": "com.example"
5+
"Version": "1.00"
76
},
8-
"Actions": {
9-
"OnStart": {
10-
"LaunchClass": ".ModMain",
11-
"InitiateCommands": "{pkg}/resources/commands.json"
12-
}
13-
}
7+
"JsonCommandFiles": [
8+
"com/app_package/example/commands.json"
9+
],
10+
"StartClass": "com.app_package.example.StartClass"
1411
}

modapi/src/osintgram4j/api/Launcher.java

+2
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ public abstract class Launcher {
44

55
public abstract void onLaunch(String[] cliArgs);
66

7+
public abstract void onExit(String reason);
8+
79
}

modapi/src/osintgram4j/api/sh/Command.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package osintgram4j.api.sh;
22

3-
import osintgram4j.commons.ShellConfig;
3+
import osintgram4j.commons.ShellEnvironment;
44

55
import java.util.List;
66

77
public abstract class Command {
88

99
private boolean asAlias = false;
1010

11-
public abstract int launchCmd(String[] args, List<ShellConfig> env);
11+
public abstract int launchCmd(String[] args, List<ShellEnvironment> env);
1212

1313
public abstract String helpCmd(String[] args);
1414

0 commit comments

Comments
 (0)