Exploit database

GH-64d1b6d28fa2a03680b17718db498b99

8872/tinycmd

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2019-11358

1,181 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files9

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

TeamCode/src/main/java/org/firstinspires/ftc/teamcode/tinycmd/Scheduler.java

Java · 1,626 bytes
package org.firstinspires.ftc.teamcode.tinycmd;


import org.firstinspires.ftc.teamcode.tinycmd.cmd.Cmd;
import org.firstinspires.ftc.teamcode.tinycmd.sys.Sys;

import java.util.HashSet;
import java.util.Set;

// TODO test onInterrupt
public final class Scheduler {
    // TODO replace with priority queue
    private static final Set<Cmd> cmds = new HashSet<>();
    private static final Set<Sys> systems = new HashSet<>();

    public static void add(Cmd cmd) {
        Set<Cmd> toRemove = new HashSet<>();
        if (!cmds.contains(cmd)) {
            for (Cmd c : cmds) {
                if (c.getSystems().stream().anyMatch(sys -> cmd.getSystems().contains(sys))) {
                    if (c.isInterruptible()) {
                        toRemove.add(c);
                    } else {
                        return;
                    }
                }
            }
            toRemove.forEach(Cmd::onInterrupt);
            cmds.removeAll(toRemove);
            cmds.add(cmd);
            cmd.init();
            systems.addAll(cmd.getSystems());
        }
    }

    // TODO scheduler remove (cancel)
    public static void remove(Cmd cmd) {

    }

    public static void tick() {
        cmds.stream().filter(Cmd::isDone).forEach(Cmd::lastly);
        cmds.removeIf(Cmd::isDone);

        // TODO merge these two lines of code into a single lambda
        cmds.forEach(Cmd::loop);
        // TODO test sys update
        systems.forEach(Sys::update);
    }

    public static void clear() {
        cmds.clear();
        systems.clear();
    }

    public static Set<Cmd> getCmds() {
        return cmds;
    }
}