Skip to content

Commit

Permalink
Add flash patcher task
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablete1234 committed Jan 11, 2021
1 parent dd3747d commit 8e493a7
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 5 deletions.
3 changes: 1 addition & 2 deletions DefaultPlugin.iml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: com.github.darkbot-reloaded:DarkBot:master-2d5ec8d194-1" level="project" />
<orderEntry type="library" name="Maven: com.github.darkbot-reloaded:DarkBot:master-cfa751249d-1" level="project" />
<orderEntry type="library" name="Maven: com.github.darkbot-reloaded:DarkBot:master-8f3c84caab-1" level="project" />
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.5" level="project" />
<orderEntry type="library" name="Maven: com.formdev:flatlaf:0.36" level="project" />
<orderEntry type="library" name="Maven: com.miglayout:miglayout:3.7.4" level="project" />
Expand Down
73 changes: 73 additions & 0 deletions src/main/java/eu/darkbot/popcorn/def/FlashPatcher.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package eu.darkbot.popcorn.def;

import com.github.manolo8.darkbot.Main;
import com.github.manolo8.darkbot.core.itf.Task;
import com.github.manolo8.darkbot.extensions.features.Feature;
import com.github.manolo8.darkbot.gui.utils.Popups;

import javax.swing.*;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;

@Feature(name = "Flash patcher", description = "Sets flash configuration to continue running after jan 12th", enabledByDefault = true)
public class FlashPatcher implements Task {

private static final Path
FLASH_FOLDER = Paths.get(System.getenv("WINDIR"), "SysWOW64", "Macromed", "Flash"),
FLASH_CONFIG = FLASH_FOLDER.resolve("mms.cfg"),
TMP_SCRIPT = Paths.get("FlashPatcher.bat"),
TMP_CONFIG = Paths.get("mms.cfg");

private static final List<String> CONFIG_CONTENT = Arrays.asList(
"EnableAllowList=1",
"AllowListPreview=1",
"AllowListRootMovieOnly=1",
"AllowlistUrlPattern=https://*.bpsecure.com/",
"SilentAutoUpdateEnable=1",
"AutoUpdateDisable=1",
"EOLUninstallDisable=1");

private static final List<String> TEMP_BATCH = Arrays.asList(
"mkdir " + FLASH_FOLDER.toAbsolutePath().toString(),
"move " + TMP_CONFIG.toAbsolutePath().toString() + " " + FLASH_CONFIG.toAbsolutePath().toString(),
"del " + TMP_SCRIPT.toAbsolutePath().toString());

@Override
public void install(Main main) {
if (!Arrays.equals(VerifierChecker.class.getSigners(), getClass().getSigners())) return;
VerifierChecker.checkAuthenticity();

if (Files.exists(FLASH_FOLDER) && Files.exists(FLASH_CONFIG)) {
try {
if (Files.readAllLines(FLASH_CONFIG).equals(CONFIG_CONTENT)) return;
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}

Popups.showMessageSync("Flash patcher",
new JOptionPane("Flash is blocked by default after 12/01/2021.\n" +
"Darkbot will need a one-time admin permission to patch flash and make it work.\n" +
"Accept on the next pop-up to run as admin to be able to continue using DarkBot.\n" +
"After the script runs, refresh the game or restart the bot to make it work.\n",
JOptionPane.INFORMATION_MESSAGE));

try {
Files.write(TMP_SCRIPT, TEMP_BATCH);
Files.write(TMP_CONFIG, CONFIG_CONTENT);
Runtime.getRuntime().exec("powershell start -verb runas './FlashPatcher.bat'").waitFor();
} catch (IOException | InterruptedException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}

@Override
public void tick() {}

}
7 changes: 4 additions & 3 deletions src/main/resources/plugin.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"name": "Default plugin",
"author": "Popcorn",
"version": "1.5.1",
"version": "1.6.0",
"minVersion": "1.13.17 beta 56",
"supportedVersion": "1.13.17 beta 58",
"supportedVersion": "1.13.17 beta 68",
"features": [
"eu.darkbot.popcorn.def.CaptchaPicker",
"eu.darkbot.popcorn.def.PalladiumModule",
"eu.darkbot.popcorn.def.AntiPush",
"eu.darkbot.popcorn.def.FlashPatcher",
"eu.darkbot.popcorn.def.SampleModule"
],
"download": "https://github.com/darkbot-reloaded/DefaultPlugin/releases/download/v1.5.1/DefaultPlugin.jar",
"download": "https://github.com/darkbot-reloaded/DefaultPlugin/releases/download/v1.6.0/DefaultPlugin.jar",
"update": "https://raw.githubusercontent.com/darkbot-reloaded/DefaultPlugin/master/src/main/resources/plugin.json"
}

0 comments on commit 8e493a7

Please sign in to comment.