|
@@ -6,6 +6,9 @@ import android.net.DhcpInfo;
|
|
|
import android.net.wifi.WifiManager;
|
|
|
|
|
|
import org.alfresco.jlan.app.CifsOnlyXMLServerConfiguration;
|
|
|
+import org.alfresco.jlan.netbios.server.AddNameListener;
|
|
|
+import org.alfresco.jlan.netbios.server.NetBIOSNameEvent;
|
|
|
+import org.alfresco.jlan.netbios.server.NetBIOSNameServer;
|
|
|
import org.alfresco.jlan.server.SessionListener;
|
|
|
import org.alfresco.jlan.server.SrvSession;
|
|
|
import org.alfresco.jlan.server.config.InvalidConfigurationException;
|
|
@@ -24,9 +27,10 @@ import de.tudarmstadt.informatik.hostage.R;
|
|
|
import de.tudarmstadt.informatik.hostage.ui.activity.MainActivity;
|
|
|
import de.tudarmstadt.informatik.hostage.wrapper.Packet;
|
|
|
|
|
|
-public class CIFS implements Protocol, SessionListener, FileListener {
|
|
|
+public class CIFS implements Protocol, SessionListener, FileListener{
|
|
|
private Listener mHandler;
|
|
|
private SMBServer mSmbServer;
|
|
|
+ private NetBIOSNameServer mNbNameServer;
|
|
|
|
|
|
public void initialize(Listener mHandler) {
|
|
|
this.mHandler = mHandler;
|
|
@@ -37,12 +41,19 @@ public class CIFS implements Protocol, SessionListener, FileListener {
|
|
|
smbConfig.loadConfiguration(new InputStreamReader(MainActivity.context.getResources().openRawResource(R.raw.jlan_config)));
|
|
|
CIFSConfigSection cifsConfig = (CIFSConfigSection) smbConfig.getConfigSection(CIFSConfigSection.SectionName);
|
|
|
cifsConfig.setBroadcastMask(getBroadcastAddress());
|
|
|
-
|
|
|
+ cifsConfig.setSessionPort(28276);
|
|
|
+ cifsConfig.setTcpipSMBPort(28582);
|
|
|
+ cifsConfig.setDatagramPort(28274);
|
|
|
+ cifsConfig.setHostAnnouncerPort(28275);
|
|
|
+ cifsConfig.setNetBIOSSMB(true);
|
|
|
+ cifsConfig.setDisableNIOCode(true);
|
|
|
|
|
|
this.mSmbServer = new SMBServer(smbConfig);
|
|
|
+ this.mNbNameServer = new NetBIOSNameServer(smbConfig);
|
|
|
this.mSmbServer.addSessionListener(this);
|
|
|
this.mSmbServer.addFileListener(this);
|
|
|
|
|
|
+ this.mNbNameServer.startServer();
|
|
|
this.mSmbServer.startServer();
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
@@ -116,4 +127,5 @@ public class CIFS implements Protocol, SessionListener, FileListener {
|
|
|
quads[k] = (byte) (broadcast >> (k * 8));
|
|
|
return InetAddress.getByAddress(quads).toString().substring(1);
|
|
|
}
|
|
|
+
|
|
|
}
|