Beispiel #1
0
  public static void main(String args[]) {
    getPortal();
    ArrayList array = Platform.getProcesses("remote:10@pete:");
    for (int i = 0; i < array.size(); i++) {
      System.out.println("PROCESS=" + array.get(i));
    }

    System.exit(0);
  }
Beispiel #2
0
  public static Vector getScriptList(String s, String s1, HTTPRequest httprequest) {
    Vector vector = new Vector();
    String s2 = s1;
    if (s2 == null || s2.length() == 0) {
      s2 = "scripts";
    }
    s = Machine.getFullMachineID(s, httprequest);
    if (Machine.isPortalMachineID(s)) {
      String s3 = Machine.getServerIDFromMachineID(s);
      PortalSiteView portalsiteview = (PortalSiteView) Portal.getPortal().getElement(s3);
      if (portalsiteview != null) {
        String s4 =
            "/SiteView/cgi/go.exe/SiteView?page=remoteOp&operation=scripts&machineID="
                + Machine.getMachineFromMachineID(s)
                + "&account=administrator";
        ArrayList array2 = portalsiteview.sendURLToRemoteSiteView(s4, null);
        for (int i1 = 0; i1 < array2.size(); i1++) {
          vector.addElement(array2.get(i1));
        }

      } else {
        LogManager.log("Error", "Could not find SiteView ID: " + s3);
      }
    } else if (Machine.isNTSSH(s)) {
      RemoteFile remotefile = new RemoteFile(s, "scripts");
      ArrayList array = remotefile.listFiles();
      for (int j = 0; j < array.size(); j++) {
        String s5 = I18N.toNullEncoding((String) array.get(j));
        if (!s5.endsWith(".txt")
            && !s5.endsWith("directory.bat")
            && (s5.endsWith(".bat")
                || s5.endsWith(".vbs")
                || s5.endsWith(".exe")
                || s5.endsWith(".pl")
                || s5.endsWith(".sh"))) {
          String as1[] = TextUtils.split(s5, " ");
          s5 = as1[as1.length - 1].trim();
          vector.addElement(s5);
          vector.addElement(s5);
        }
      }

    } else if (Platform.isCommandLineRemote(s)) {
      RemoteFile remotefile1 = new RemoteFile(s, "scripts");
      int i = Machine.getOS(s);
      ArrayList array1 = remotefile1.listFiles();
      for (int l = 0; l < array1.size(); l++) {
        String s7 = I18N.toNullEncoding((String) array1.get(l));
        if (!s7.endsWith(".txt") && (!Platform.isUnix(i) || !s7.startsWith("."))) {
          vector.addElement(s7);
          vector.addElement(s7);
        }
      }

    } else {
      File file = new File(Platform.getUsedDirectoryPath(s2, httprequest.getAccount()));
      String as[] = file.list();
      for (int k = 0; k < as.length; k++) {
        String s6 = I18N.toNullEncoding(as[k]);
        if (s6.endsWith(".txt") || Platform.isUnix() && s6.startsWith(".")) {
          continue;
        }
        File file1 = new File(file, as[k]);
        if (!file1.isDirectory()) {
          vector.addElement(s6);
          vector.addElement(s6);
        }
      }
    }
    return vector;
  }