Esempio n. 1
0
    def getNetworkShares(self, hostip, hostname, devicetype):
        sharelist = []
        self.sharecache_file = None
        self.sharecache_file = '/etc/enigma2/' + hostname.strip(
        ) + '.cache'  #Path to cache directory
        username = ""
        password = ""
        if os_path.exists(self.sharecache_file):
            print '[Networkbrowser] Loading userinfo from ', self.sharecache_file
            try:
                self.hostdata = load_cache(self.sharecache_file)
                username = self.hostdata['username']
                password = self.hostdata['password']
            except:
                pass

        cmd = "/usr/bin/smbclient -g -N -U Guest -L {0}".format(hostip).split()
        if username != "" or password != "":
            cmd = [
                "/usr/bin/smbclient", "-g", "-U", username, "-L", hostip,
                "\\\\IPC\\", password
            ]
        try:
            p = subprocess.Popen(cmd,
                                 stderr=subprocess.PIPE,
                                 stdout=subprocess.PIPE)
            (out, err) = p.communicate()
            for line in out.split('\n'):
                item = line.split('|')
                if len(item) == 3 and item[
                        0] == "Disk" and not item[1].endswith("$"):
                    sharelist.append([
                        "smbShare", hostname, hostip, item[1], item[0], item[2]
                    ])
        except OSError as e:
            print "Running " + str(cmd) + " failed with:" + str(e)
            pass

        if devicetype == 'unix':
            nfslist = netscan.nfsShare(hostip, hostname)
            for x in nfslist:
                if len(x) == 6:
                    sharelist.append(x)
        else:
            nfslist = netscan.nfsShare(hostip, hostname)
            for x in nfslist:
                if len(x) == 6:
                    sharelist.append(x)
        return sharelist
Esempio n. 2
0
    def getNetworkShares(self, hostip, hostname, devicetype):
        sharelist = []
        self.sharecache_file = None
        self.sharecache_file = '/etc/enigma2/' + hostname.strip(
        ) + '.cache'  #Path to cache directory
        if os_path.exists(self.sharecache_file):
            print('[Networkbrowser] Loading userinfo from ',
                  self.sharecache_file)
            try:
                self.hostdata = load_cache(self.sharecache_file)
                username = self.hostdata['username']
                password = self.hostdata['password']
            except:
                username = "******"
                password = "******"
        else:
            username = "******"
            password = "******"

        if devicetype == 'unix':
            smblist = netscan.smbShare(hostip, hostname, username, password)
            print('[Networkbrowser] unix smblist ', smblist)
            for x in smblist:
                if len(x) == 6:
                    if x[3] != 'IPC$':
                        sharelist.append(x)
                        print('[Networkbrowser] unix sharelist ', sharelist)
            nfslist = netscan.nfsShare(hostip, hostname)
            print('[Networkbrowser] unix nfslist ', nfslist)
            for x in nfslist:
                if len(x) == 6:
                    sharelist.append(x)
                    print('[Networkbrowser] unix sharelist ', sharelist)
        else:
            smblist = netscan.smbShare(hostip, hostname, username, password)
            print('[Networkbrowser] smblist ', smblist)
            for x in smblist:
                if len(x) == 6:
                    if x[3] != 'IPC$':
                        sharelist.append(x)
                        print('[Networkbrowser] sharelist ', sharelist)
            nfslist = netscan.nfsShare(hostip, hostname)
            print('[Networkbrowser] nfslist ', nfslist)
            for x in nfslist:
                if len(x) == 6:
                    sharelist.append(x)
                    print('[Networkbrowser] sharelist ', sharelist)
        print('[Networkbrowser] sharelist final ', sharelist)
        return sharelist
    def getNetworkShares(self, hostip, hostname, devicetype):
        sharelist = []
        self.sharecache_file = None
        self.sharecache_file = '/etc/enigma2/' + hostname.strip(
        ) + '.cache'  #Path to cache directory
        if os_path.exists(self.sharecache_file):
            print '[Networkbrowser] Loading userinfo from ', self.sharecache_file
            try:
                self.hostdata = load_cache(self.sharecache_file)
                username = self.hostdata['username']
                password = self.hostdata['password']
            except:
                username = "******"
                password = ""
        else:
            username = "******"
            password = ""

        smblist = netscan.smbShare(hostip, hostname, username, password)
        for x in smblist:
            if len(x) == 6:
                if x[3].upper() not in ('IPC$', 'ADMIN$', 'PRINT$'):
                    sharelist.append(x)

        nfslist = netscan.nfsShare(hostip, hostname)
        for x in nfslist:
            if len(x) == 6:
                sharelist.append(x)

        return sharelist
	def getNetworkShares(self,hostip,hostname,devicetype):
		sharelist = []
		self.sharecache_file = None
		self.sharecache_file = '/etc/enigma2/' + hostname.strip() + '.cache' #Path to cache directory
		if os_path.exists(self.sharecache_file):
			print '[Networkbrowser] Loading userinfo from ',self.sharecache_file
			try:
				self.hostdata = load_cache(self.sharecache_file)
				username = self.hostdata['username']
				password = self.hostdata['password']
			except:
				username = "******"
				password = "******"
		else:
			username = "******"
			password = "******"

		if devicetype == 'unix':
			smblist=netscan.smbShare(hostip,hostname,username,password)
			for x in smblist:
				if len(x) == 6:
					if x[3] != 'IPC$':
						sharelist.append(x)
			nfslist=netscan.nfsShare(hostip,hostname)
			for x in nfslist:
				if len(x) == 6:
					sharelist.append(x)
		else:
			smblist=netscan.smbShare(hostip,hostname,username,password)
			for x in smblist:
				if len(x) == 6:
					if x[3] != 'IPC$':
						sharelist.append(x)
		return sharelist
Esempio n. 5
0
    def getNetworkShares(self, hostip, hostname, devicetype):
        sharelist = []
        self.sharecache_file = None
        self.sharecache_file = '/etc/enigma2/' + hostname.strip(
        ) + '.cache'  #Path to cache directory
        username = '******'
        password = '******'
        try:
            hostdata = load_cache(self.sharecache_file)
            username = hostdata['username']
            password = hostdata['password']
        except:
            pass

        if devicetype == 'unix':
            smblist = netscan.smbShare(hostip, hostname, username, password)
            for x in smblist:
                if len(x) == 6:
                    if x[3] != 'IPC$':
                        sharelist.append(x)
            nfslist = netscan.nfsShare(hostip, hostname)
            for x in nfslist:
                if len(x) == 6:
                    sharelist.append(x)
        else:
            smblist = netscan.smbShare(hostip, hostname, username, password)
            for x in smblist:
                if len(x) == 6:
                    if x[3] != 'IPC$':
                        sharelist.append(x)
        return sharelist
Esempio n. 6
0
	def getNetworkShares(self,hostip,hostname,devicetype):
		sharelist = []
		self.sharecache_file = None
		self.sharecache_file = '/etc/enigma2/' + hostname.strip() + '.cache' #Path to cache directory
		username = ""
		password = ""
		if os_path.exists(self.sharecache_file):
			print '[Networkbrowser] Loading userinfo from ',self.sharecache_file
			try:
				self.hostdata = load_cache(self.sharecache_file)
				username = self.hostdata['username']
				password = self.hostdata['password']
			except:
				pass

		cmd = "/usr/bin/smbclient -g -N -U Guest -L {0}".format(hostip).split()
		if username != "" or password != "":
			cmd = ["/usr/bin/smbclient", "-g", "-U", username, "-L", hostip, "\\\\IPC\\", password]
		try:
			p = subprocess.Popen(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
			(out, err) = p.communicate()
			for line in out.split('\n'):
				item = line.split('|')
				if len(item) == 3 and item[0] == "Disk" and not item[1].endswith("$"):
					sharelist.append(["smbShare", hostname, hostip, item[1], item[0], item[2]])
		except OSError as e:
			print "Running " + str(cmd) + " failed with:" + str(e)
			pass
		
		if devicetype == 'unix':
			nfslist=netscan.nfsShare(hostip,hostname)
			for x in nfslist:
				if len(x) == 6:
					sharelist.append(x)
		return sharelist
Esempio n. 7
0
	def getNetworkShares(self,hostip,hostname,devicetype):
		sharelist = []
		self.sharecache_file = None
		self.sharecache_file = eEnv.resolve("${sysconfdir}/enigma2/") + hostname.strip() + '.cache' #Path to cache directory

		username = "******"
		password = ""
		if os_path.exists(self.sharecache_file):
			print '[Networkbrowser] Loading userinfo from ',self.sharecache_file
			try:
				self.hostdata = load_cache(self.sharecache_file)
				username = self.hostdata['username']
				password = self.hostdata['password']
			except:
				pass

		smblist = netscan.smbShare(hostip, hostname, username, password)
		for x in smblist:
			if len(x) == 6:
				if x[4] == "Disk" and not x[3].endswith('$'):
					sharelist.append(x)
		if devicetype == 'unix':
			nfslist = netscan.nfsShare(hostip, hostname)
			for x in nfslist:
				if len(x) == 6:
					sharelist.append(x)

		return sharelist
Esempio n. 8
0
    def getNetworkShares(self, hostip, hostname, devicetype):
        sharelist = []
        self.sharecache_file = None
        self.sharecache_file = '/etc/enigma2/' + hostname.strip() + '.cache'
        if os_path.exists(self.sharecache_file):
            print '[Networkbrowser] Loading userinfo from ',
            print self.sharecache_file
            try:
                self.hostdata = load_cache(self.sharecache_file)
                username = self.hostdata['username']
                password = self.hostdata['password']
            except:
                username = '******'
                password = '******'
        else:
            username = '******'
            password = '******'
        if devicetype == 'unix':
            smblist = netscan.smbShare(hostip, hostname, username, password)
            for x in smblist:
                if len(x) == 6:
                    if x[3] != 'IPC$':
                        sharelist.append(x)

            nfslist = netscan.nfsShare(hostip, hostname)
            for x in nfslist:
                if len(x) == 6:
                    sharelist.append(x)

        else:
            smblist = netscan.smbShare(hostip, hostname, username, password)
            for x in smblist:
                if len(x) == 6:
                    if x[3] != 'IPC$':
                        sharelist.append(x)

        return sharelist