|
@@ -1,4 +1,4 @@
|
|
|
-package de.tudarmstadt.informatik.hostage.protocol.SMBUtils;
|
|
|
+package de.tudarmstadt.informatik.hostage.protocol.smbutils;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.net.DatagramPacket;
|
|
@@ -6,13 +6,10 @@ import java.net.DatagramSocket;
|
|
|
import java.net.InetAddress;
|
|
|
import java.net.UnknownHostException;
|
|
|
|
|
|
+import de.tudarmstadt.informatik.hostage.net.MyDatagramSocketFactory;
|
|
|
+
|
|
|
public class NMB extends Thread {
|
|
|
|
|
|
- public static void main(String[] args) {
|
|
|
- NMB nbns = new NMB("192.168.178.104", "ABCDEFG", "WORKGROUP");
|
|
|
- nbns.start();
|
|
|
- }
|
|
|
-
|
|
|
private DatagramSocket nbnsSocket;
|
|
|
private DatagramSocket nbdsSocket;
|
|
|
private DatagramPacket packet;
|
|
@@ -25,16 +22,17 @@ public class NMB extends Thread {
|
|
|
private String workgroup;
|
|
|
|
|
|
public NMB(String ip, String username, String workgroup) {
|
|
|
- super();
|
|
|
try {
|
|
|
this.username = username;
|
|
|
this.workgroup = workgroup;
|
|
|
- nbnsSocket = new DatagramSocket(nbnsPort);
|
|
|
- nbdsSocket = new DatagramSocket(nbdsPort);
|
|
|
this.ip = ip;
|
|
|
ipParts = ip.split("\\.");
|
|
|
String newHostAddr = ipParts[0] + "." + ipParts[1] + "." + ipParts[2] + ".255";
|
|
|
dst = InetAddress.getByName(newHostAddr);
|
|
|
+ nbnsSocket = new MyDatagramSocketFactory().createDatagramSocket(nbnsPort);
|
|
|
+ nbnsSocket.connect(dst, nbnsPort);
|
|
|
+ nbdsSocket = new MyDatagramSocketFactory().createDatagramSocket(nbdsPort);
|
|
|
+ nbnsSocket.connect(dst, nbdsPort);
|
|
|
} catch (UnknownHostException e) {
|
|
|
e.printStackTrace();
|
|
|
} catch (IOException e) {
|