Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shares Under IP

How to list all the available shared folders under a specific IP Address?

Mock code:

IP ip = new IP("10.0.0.9");

for(File share : ip.getSharedFolders){
    System.out.println(share.getName());
}

Is there a way in which this can be accomplished?

I want to make something similar to windows network explorer and I need to get all the shared folders under a specific IP so I can ggenerate a tree.

Network explorer

With the first level shared folders I can easely get the lower levels like this

for(File f : new File("//10.0.0.9/d").listFiles()){
                    System.out.println(f.getName());
like image 561
ex0b1t Avatar asked Dec 12 '11 20:12

ex0b1t


People also ask

What does IP mean in companies?

Intellectual property (IP) refers to creations of the mind, such as inventions; literary and artistic works; designs; and symbols, names and images used in commerce.

Is selling IP legal?

Selling Your Intellectual PropertyCopyrights are able to be sold or transferred as long as the transaction is done in writing. Many copyrights When completing the sale, it is important to have a proper Copyright Assignment agreement done to ensure the rights are transferred from one entity to the next.

What are the 4 types of intellectual property?

Patents, trademarks, copyrights, and trade secrets are valuable assets of the company and understanding how they work and how they are created is critical to knowing how to protect them.

What does IP stand for in private equity?

Intellectual property (IP) and other intangible assets now account for over 80 percent of company value in the S&P 500, by some estimates.


2 Answers

You can get the list of shares using the The Java CIFS Client Library and in particular the SmbFile.list method. Here is a small illustration of how to use this API:

SmbFile server = new SmbFile("smb://server/");
String[] shares = server.list();
like image 182
vitaut Avatar answered Oct 22 '22 18:10

vitaut


Java from out of the box does not support what you are trying to do. You need to use libraries such as JCIFS to do this.

One easy/cludgy way out though would be to make sure that you have a drive mapping ( if windows or nfs/smb mount for other OSs) to the location and then treat it as a local file - using java.io APIs.

like image 31
ring bearer Avatar answered Oct 22 '22 18:10

ring bearer