wget -qO- - http://host/path/ | sed -E 's/^.*href=\"(.*)\".*$/\1/g'|grep -v '/'|grep -v '>' | xargs -i wget 'http://host/path/{}'
public class UpDownload implements Serializable{ static SCPClient scp= new SCPClient(host, port, user, pass); public void download(String remote, String local) throws IOException { boolean cacheInMemory = false; if (cacheInMemory) { byte[] data = scp.download(remote); new File(local).getParentFile().mkdirs(); FileOutputStream fos = new FileOutputStream(local); fos.write(data); fos.close(); } else { new File(local).getParentFile().mkdirs(); FileOutputStream fos = new FileOutputStream(local); scp.downloadToStream(remote, fos); fos.close(); } } public static void upload(String remote, String local) throws IOException { File file = new File(local); FileInputStream fis = new FileInputStream(file); byte[] data = new byte[(int) file.length()]; for (int i = 0; i < data.length;) i += fis.read(data, i, data.length - i); fis.close(); scp.upload(remote, data); } public static void main(String[] args) throws IOException { upload("user:pass@host/path/to/file","c:\\local\\path"); download("user:pass@host/path/to/file","c:\\local\\path"); } public static void download(String fullPath) throws IOException { String[] components = fullPath.split("\\/"); String user = components[0].split("@")[0].split(":")[0]; String pass = components[0].split("@")[0].split(":")[1]; String host = components[0].split("@")[1]; String fileName = components[components.length - 1]; String folder = ""; for (int i = 1; i < components.length - 1; i++) folder += "/" + components[i]; UpDownload ud = new UpDownload(host, 22, user, pass); ud.download(folder + "/" + fileName, "j:/scp/" + host + "/" + folder + "/" + fileName); } public static void upload(String fullPath) throws IOException { String[] components = fullPath.split("\\/"); String user = components[0].split("@")[0].split(":")[0]; String pass = components[0].split("@")[0].split(":")[1]; String host = components[0].split("@")[1]; String fileName = components[components.length - 1]; String folder = ""; for (int i = 1; i < components.length - 1; i++) folder += "/" + components[i]; UpDownload ud = new UpDownload(host, 22, user, pass); ud.upload(folder + "/" + fileName, "j:/scp/" + host + "/" + folder + "/" + fileName); } }
URL url = new URL( "ssh://user:password@host?ksh -c ls"); URLConnection c=url.openConnection(); c.connect(); InputStream is=c.getInputStream(); for(;;) { int i=is.read(); if(i<0)break; // System.out.print((char)i); }
package dms.xml; import java.io.ByteArrayOutputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; public class XSLT{ private Transformer transformer; public XSLT(InputStream xslt) throws TransformerConfigurationException{ System.setProperty("javax.xml.transform.TransformerFactory","net.sf.saxon.TransformerFactoryImpl"); TransformerFactory tfactory=TransformerFactory.newInstance(); // tfactory.setAttribute("http://saxon.sf.net/feature/outputURIResolver",new UserOutputResolver()); tfactory.setAttribute("http://saxon.sf.net/feature/allow-external-functions",Boolean.TRUE); tfactory.setAttribute("http://saxon.sf.net/feature/timing",Boolean.TRUE); transformer=tfactory.newTransformer(new StreamSource(xslt)); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); } public void setParameter(String name,Object value){ transformer.setParameter(name,value); } public byte[] transform(InputStream xml) throws TransformerException{ ByteArrayOutputStream baos=new ByteArrayOutputStream(); transformer.transform(new StreamSource(xml),new StreamResult(baos)); return baos.toByteArray(); } public static void main(String argv[]) throws TransformerException,IOException{ System.out.println("!!!!!!!"); System.out.println("-----------------------"); XSLT xslt=new XSLT(new FileInputStream("J:\\http\\applications\\WSDLConnector\\wsdl2xml.xsl")); byte[] result=xslt.transform(new FileInputStream("j:\\http\\applications\\WSDLConnector\\SelfCareWebServicePort.wsdl")); // FileOutputStream output=new FileOutputStream("J:\\DS\\qpass\\MediaMall\\storefrontpurchasewebservice.html"); // OutputStream output=System.out; // output.write(result); // output.close(); // System.out.println(new String(result)); System.out.println(result.length); } // private static class UserOutputResolver implements OutputURIResolver{ // public Result resolve(String href,String base) throws TransformerException{ // if(href.endsWith(".out")){ // StreamResult res=new StreamResult(System.out); // res.setSystemId(href); // return res; // } // return null; // } // public void close(Result result) throws TransformerException{} // } }
package dms.xml; import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.Source; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; import javax.xml.XMLConstants; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.xml.sax.EntityResolver; import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; public class XSD { public static void main(String[] args) throws SAXException, ParserConfigurationException, IOException { SchemaFactory schemaFactory = SchemaFactory .newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schemaXSD = schemaFactory .newSchema(new File( "j:\\scsjcm\\v15\\scripts\\templates\\CustomerDetailsVO.xsd")); Validator validator = schemaXSD.newValidator(); validator.setErrorHandler(new ErrorHandler() { @Override public void warning(SAXParseException exception) throws SAXException { System.out.println(3); } @Override public void fatalError(SAXParseException exception) throws SAXException { System.out.println(1); } @Override public void error(SAXParseException exception) throws SAXException { System.out.println(exception); } }); validator.validate(new StreamSource(new File( "j:\\scsjcm\\v15\\scripts\\templates\\AMSPFeed.xml"))); } public static void validate(String xml, File xsd) throws SAXException, ParserConfigurationException, IOException { SchemaFactory schemaFactory = SchemaFactory .newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schemaXSD = schemaFactory.newSchema(xsd); Validator validator = schemaXSD.newValidator(); validator.validate(new StreamSource(new ByteArrayInputStream(xml.getBytes()))); } }
public static void main(String[] args) throws IOException { TelnetClient tc = new TelnetClient("illin441", 23); System.out.println(tc.readKeysUntil("ogin:")); tc.println("text11"); System.out.println(tc.readKeysForUntil(1000, "assword:")); tc.println("Unix11!"); System.out.println(tc.readKeysFor(2000)); }
package dms.os; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.security.KeyManagementException; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.UnrecoverableKeyException; import java.security.cert.CertificateException; import javax.net.ssl.HttpsURLConnection; import sun.org.mozilla.javascript.internal.NativeObject; public class Boot { public static NativeObject cache = new NativeObject(); static { SSLUtil.class.getClass(); System.setProperty("proxyHost", "genproxy"); System.setProperty("proxyHost", "8080"); } public static void main(String[] args) throws KeyManagementException, UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException { // SSLmain(); } public static void SSLmain() throws IOException, KeyManagementException, UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException, CertificateException { System.out.println("Starting"); File file = new File( "j:\\Certificates\\c_qseng7.p12"); FileInputStream fis = new FileInputStream(file); byte[] data = new byte[(int) file.length()]; for (int pos = 0; pos < data.length;) pos += fis.read(data, pos, data.length - pos); fis.close(); SSLUtil.addClientCertificate(data, "password"); } private static void SSLdownloadUrl(String urlValue) throws IOException { URL url = new URL(urlValue); HttpsURLConnection connection = (HttpsURLConnection) url .openConnection(); try { System.out .println("IS: " + SSLcalcUrl(connection.getInputStream())); } catch (Throwable t) { } try { System.out .println("ES: " + SSLcalcUrl(connection.getErrorStream())); } catch (Throwable t) { } } private static int SSLcalcUrl(InputStream is) throws IOException { int count = 0; for (;;) { int i = is.read(); if (i < 0) break; count++; } return count; } }
package dms.os.ie; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Graphics; import java.awt.Insets; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.net.MalformedURLException; import java.net.URL; import javax.swing.Icon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.UIManager; import javax.swing.border.Border; import org.jdesktop.jdic.browser.WebBrowser; import dms.vm.Environment; import dms.vm.VM; public class TabbedBrowser extends JFrame { public static void main(String[] args) throws MalformedURLException { TabbedBrowser w = new TabbedBrowser(); } private static JTabbedPane pane = new JTabbedPane(JTabbedPane.BOTTOM, JTabbedPane.WRAP_TAB_LAYOUT); public TabbedBrowser() throws MalformedURLException { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Throwable t) { } this.setVisible(true); this.setSize(800, 600); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.add(pane); pane.setBorder(new Border() { @Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { } @Override public boolean isBorderOpaque() { return false; } @Override public Insets getBorderInsets(Component c) { return new Insets(0, 0, 0, 0); } }); WebBrowser w1 = new WebBrowser(new URL("http://www.google.com")); w1.setLocation(0, -100); JPanel console = new JPanel(new BorderLayout()); final JTextArea outp=new JTextArea(); console.add(outp); JPanel inp = new JPanel(new BorderLayout()); console.add(inp, BorderLayout.SOUTH); final JTextField field = new JTextField(); inp.add(field); JButton run = new JButton("Run"); // final VM vm = new VM(); Environment.getInstance().put("TabbedBrowser", Environment.getInstance(), this); run.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { Object result=null; try { result = VM.eval(field.getText(), "console"); } catch (Throwable t) { result=t; } outp.append(""+result+"\n"); } }); inp.add(run, BorderLayout.EAST); pane.add("Console", console); // pane.add("QQQQQQQQQQQQQQQQQQQ12", w1); // pane.add("3WWWWWWWWWWWWWWWWWWWW4", new WebBrowser(new URL( // "http://www.yahoo.com"))); } public void addTab(String title, String url) throws MalformedURLException { pane.add(title, new WebBrowser(new URL(url))); } public void closeTab(int i) { pane.remove(i); } public void renameTab(int i,String name) { pane.setTitleAt(i,name); } }