1 import java.io.*; 2 3 import java.net.*; 4 5 import jcifs.*; 6 7 public class NtlmHttpClient { 8 9 public static void main(String [] args) throws Exception { 10 Config.registerSmbURLHandler(); 14 20 if (args == null || args.length < 4) { 21 System.out.println("NtlmHttpClient <url> <domain> <user> <password>"); 22 System.exit(1); 23 } 24 String location = args[0]; 25 String domain = args[1]; 26 String user = args[2]; 27 String password = args[3]; 28 Config.setProperty("jcifs.smb.client.domain", domain); 32 Config.setProperty("jcifs.smb.client.username", user); 33 Config.setProperty("jcifs.smb.client.password", password); 34 35 try { 36 Config.setProperty("jcifs.netbios.hostname", 37 Config.getProperty("jcifs.netbios.hostname", 38 InetAddress.getLocalHost().getHostName())); 39 } catch (Exception ex) { } 40 URL url = new URL(location); 41 BufferedReader reader = new BufferedReader( 42 new InputStreamReader(url.openStream())); 43 String line; 44 while ((line = reader.readLine()) != null) { 45 System.out.println(line); 46 } 47 } 48 49 } 50 | Popular Tags |