Skip to content

Instantly share code, notes, and snippets.

@alximw
Created October 23, 2019 14:54
Show Gist options
  • Select an option

  • Save alximw/822a8f6f986cb86b62c31dae61b9e329 to your computer and use it in GitHub Desktop.

Select an option

Save alximw/822a8f6f986cb86b62c31dae61b9e329 to your computer and use it in GitHub Desktop.

Revisions

  1. alximw created this gist Oct 23, 2019.
    49 changes: 49 additions & 0 deletions CheckMount.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    public static boolean remount_fileSystem(String filesystem, String mode) {
    boolean v0_4;
    Class v3 = SystemUtils.class;
    synchronized(v3) {
    StringBuilder v4 = new StringBuilder();
    StringBuilder v5 = new StringBuilder();
    StringBuilder v6 = new StringBuilder();
    StringBuilder mode = new StringBuilder();
    SystemUtils.getFSMountMode(filesystem, v4, v5, v6, mode);
    if(mode.equalsIgnoreCase(mode.toString())) {
    v0_4 = false;
    }
    else {
    ArrayList commandList = new ArrayList();
    command.add(Decoder.decodeBase64("mount -o remount ") + mode + Decoder.decodeBase64(" ") + filesystem);
    commandList.add(Decoder.decodeBase64("mount -o ") + mode + Decoder.decodeBase64(" ,remount ") + filesystem);
    commandList.add(Decoder.decodeBase64("busybox mount -o remount,") + mode + Decoder.decodeBase64(" ") + filesystem);
    commandList.add(Decoder.decodeBase64("busybox mount -o remount,") + mode + Decoder.decodeBase64(" ") + filesystem);
    commandList.add(Decoder.decodeBase64("busybox mount -o remount,") + mode + Decoder.decodeBase64(" ") + filesystem + Decoder.decodeBase64(" ") + filesystem);
    commandList.add(Decoder.decodeBase64("toolbox mount -o remount,") + mode + Decoder.decodeBase64(" ") + filesystem + Decoder.decodeBase64(" ") + filesystem);
    commandList.add(Decoder.decodeBase64("busybox mount -o ") + mode + Decoder.decodeBase64(",remount ") + filesystem);
    commandList.add(Decoder.decodeBase64("toolbox mount -o ") + mode + Decoder.decodeBase64(",remount ") + filesystem);
    if(Decoder.decodeBase64("ro").equalsIgnoreCase(mode)) {
    commandList.add(Decoder.decodeBase64("mount -r -o remount ") + v4 + Decoder.decodeBase64(" ") + filesystem);
    commandList.add(Decoder.decodeBase64("busybox mount -r -o remount ") + v4 + Decoder.decodeBase64(" ") + filesystem);
    commandList.add(Decoder.decodeBase64("toolbox mount -r -o remount ") + v4 + Decoder.decodeBase64(" ") + filesystem);
    }
    else {
    commandList.add(Decoder.decodeBase64("mount -r -w -o remount ") + v4 + Decoder.decodeBase64(" ") + filesystem);
    commandList.add(Decoder.decodeBase64("busybox mount -r -w -o remount ") + v4 + Decoder.decodeBase64(" ") + filesystem);
    commandList.add(Decoder.decodeBase64("toolbox mount -r -w -o remount ") + v4 + Decoder.decodeBase64(" ") + filesystem);
    }

    Iterator iterator = commandList.iterator();
    while(true) {
    if(!iterator.hasNext()) {
    return false;
    }

    Object nextItem = iterator.next();
    String result = RunCommandWrapper.execute_command(true, ((String)nextItem), 30);
    if((result.contains(Decoder.decodeBase64("not found"))) || (result.contains(Decoder.decodeBase64("invalid"))) || (result.contains(Decoder.decodeBase64("Read-only"))) || (result.contains(Decoder.decodeBase64("Usage: mount")))) {
    continue;
    }

    SystemUtils.getFSMountMode(filesystem, v4, v5, v6, mode);
    if(!mode.equalsIgnoreCase(v7.toString())) {
    continue;
    }