Esempio n. 1
0
 public void printTestForm(String s) {
   printBodyHeader("checking the remote connection");
   printButtonBar(getHelpPage(), "");
   outputStream.println("<h2>Remote Machine Connection Test</h2>");
   outputStream.println(
       "<p>This will test to see if the remote monitoring connection to:<b> "
           + getTestMachineName()
           + "</b> is\n"
           + "working properly.\n");
   outputStream.println(getTestDescription());
   outputStream.println(
       "<table border=\"0\" width=\"99%\"><tr><td width=\"50%\">&nbsp;</td><td align=\"right\">");
   printBackLink();
   outputStream.println("</td></tr></table>");
   if (!isPortalServerRequest()) {
     printContentStartComment();
     doTest(getTestMachine());
     printContentEndComment();
   } else {
     com.dragonflow.SiteView.PortalSiteView portalsiteview =
         (com.dragonflow.SiteView.PortalSiteView) getSiteView();
     if (portalsiteview != null) {
       String s1 = portalsiteview.getURLContentsFromRemoteSiteView(request, getTestCentra());
       outputStream.println(s1);
     }
   }
   printBackLink();
   outputStream.flush();
 }
Esempio n. 2
0
 public void printBody() throws Exception {
   if (!request.actionAllowed("_tools")) {
     throw new HTTPRequestException(557);
   }
   String s = request.getValue("host");
   String s1 = request.getValue("location");
   s =
       com.dragonflow.Utils.TextUtils.keepChars(
           s, ".-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
   printBodyHeader("Ping");
   if (!request.getValue("AWRequest").equals("yes")) {
     printButtonBar("Ping.htm", "");
   }
   String s2 = "";
   if (s1.length() != 0) {
     s2 = "&location=" + s1;
     for (s2 = s2.trim();
         s2.indexOf(" ") >= 0;
         s2 = s2.substring(0, s2.indexOf(" ")) + s2.substring(s2.indexOf(" ") + 1)) {}
   }
   if (!request.getValue("AWRequest").equals("yes")) {
     outputStream.println(
         "<center><b>Ping</b> | <a href="
             + getPageLink("trace", "")
             + "&host="
             + s
             + s2
             + "&group="
             + request.getValue("group")
             + ">TraceRoute</a></center><P>");
   } else {
     outputStream.println(
         "<center><b>Ping</b> | <a href="
             + getPageLink("trace", "")
             + "&host="
             + s
             + s2
             + "&AWRequest=yes"
             + ">TraceRoute</a>"
             + " | "
             + " <a href=/SiteView/cgi/go.exe/SiteView?page=monitor&operation=Tools&account="
             + request.getAccount()
             + "&AWRequest=yes>Diagnostic Tools</a>"
             + "</center><P>");
   }
   outputStream.println(
       "<p>\n<CENTER><H2>Ping</H2></CENTER><P>\n<p>\n"
           + getPagePOST("ping", "")
           + "Ping is a tool that sends a packet to another location and back to the sender.\n"
           + "It shows you the roundtrip time along the path.\n"
           + "When there is a problem with the network, ping can tell you if another\n"
           + "location is reachable.\n"
           + "<p>This form will do a ping from this server to another location.  Enter\n"
           + "the domain name or ip address of the other location.\n"
           + "<p>\n"
           + "Domain Name or IP address: <input type=text name=host value=\""
           + s
           + "\" size=60>\n"
           + "<p>\n");
   boolean flag = !isPortalServerRequest();
   try {
     Class.forName("com.dragonflow.StandardMonitor.URLRemoteMonitor");
   } catch (ClassNotFoundException classnotfoundexception) {
     flag = false;
   }
   if (flag) {
     outputStream.print(com.dragonflow.Utils.HTTPUtils.locationsHTML(s1, request));
   }
   outputStream.print("<input type=submit value=\"Ping\" class=\"VerBl8\">\n</FORM>\n");
   if (s.length() > 0) {
     if (!isPortalServerRequest()) {
       printContentStartComment();
       String s3 = "";
       String s4 = "";
       if (s1.length() > 0) {
         s3 = com.dragonflow.Utils.HTTPUtils.getPingURLByID(s1);
         s4 = com.dragonflow.Utils.HTTPUtils.getLocationNameByID(s1);
       }
       if (s4.length() > 0) {
         s4 = " from " + s4;
       }
       outputStream.println("<PRE>Pinging " + s + s4 + "...\n\n");
       outputStream.flush();
       if (s3.length() == 0) {
         String s6 = com.dragonflow.SiteView.Platform.pingCommand(s, 5000, 5, 64);
         boolean flag1 = false;
         try {
           Process process = com.dragonflow.Utils.CommandLine.execSync(s6);
           boolean flag2 = false;
           java.io.BufferedReader bufferedreader =
               com.dragonflow.Utils.FileUtils.MakeInputReader(process.getInputStream());
           String s9;
           while ((s9 = bufferedreader.readLine()) != null) {
             if (s9.length() > 0) {
               flag1 = true;
               outputStream.println(com.dragonflow.Utils.TextUtils.escapeHTML(s9));
               outputStream.flush();
               flag2 = false;
             } else if (flag2) {
               flag1 = true;
               outputStream.println();
               flag2 = false;
             } else {
               flag2 = true;
             }
           }
           bufferedreader.close();
         } catch (java.io.IOException ioexception) {
           if (!flag1) {
             outputStream.println("Could not perform ping command: " + s6);
           }
         }
       } else {
         StringBuffer stringbuffer = new StringBuffer();
         String s7 = "";
         String s8 = "";
         String s10 = "";
         String s11 = "";
         String s12 = "";
         String s13 = "";
         String s14 = "";
         String s15 = "";
         long l = 50000L;
         jgl.Array array = null;
         StringBuffer stringbuffer1 = new StringBuffer(s);
         com.dragonflow.Utils.SocketSession socketsession =
             com.dragonflow.Utils.SocketSession.getSession(null);
         long al[] =
             com.dragonflow.StandardMonitor.URLMonitor.checkURL(
                 socketsession,
                 s,
                 s8,
                 s10,
                 s12,
                 s13,
                 s14,
                 array,
                 s7,
                 s11,
                 s3,
                 stringbuffer,
                 l,
                 s15,
                 0,
                 0x1d4c0,
                 stringbuffer1);
         socketsession.close();
         long l1 = al[0];
         String s16;
         if (l1 != 200L) {
           s16 = stringbuffer.toString();
           outputStream.print(
               "Error, " + com.dragonflow.StandardMonitor.URLMonitor.lookupStatus(l1) + "\n\n");
         } else {
           s16 = com.dragonflow.StandardMonitor.URLMonitor.getHTTPContent(stringbuffer.toString());
         }
         if (stringbuffer != null) {
           outputStream.print(com.dragonflow.Utils.TextUtils.escapeHTML(s16));
         }
       }
       outputStream.println("</PRE>");
       printContentEndComment();
     } else {
       com.dragonflow.SiteView.PortalSiteView portalsiteview =
           (com.dragonflow.SiteView.PortalSiteView) getSiteView();
       if (portalsiteview != null) {
         String s5 =
             portalsiteview.getURLContentsFromRemoteSiteView(request, "_centrascopeToolMatch");
         outputStream.println(s5);
       }
     }
   }
   if (!request.getValue("AWRequest").equals("yes")) {
     printFooter(outputStream);
   } else {
     outputStream.println("</BODY>");
   }
 }