示例#1
0
 def loglinks(self,options):
     '''Prints to the log all the links that weborf is listening to'''
     if options['ip']==None:
         addrs4=nhelper.getaddrs(False)
         
         if self.ipv6:
             addrs6=nhelper.getaddrs(True)
         else:
             addrs6=tuple()
     else:
         if self.ipv6:
             #address can be both ipv6 or mapped ipv4
             if '.' in options['ip']:
                 addrs6=(options['ip'],)
                 addrs4=(options['ip'][7:],)
             else: #Normal ipv6
                 addrs4=tuple()
                 addrs6=(options['ip'],)
         else:
             addrs6=tuple()
             addrs4=(options['ip'],)
     
     #Output of addresses binded
     for i in addrs4:
         url='http://%s:%d/' % (i,options['port'])
         logentry='Address: <a href="%s">%s</a>' % (url,url)
         self.logclass.logger(logentry)
     for i in addrs6:
         url='http://[%s]:%d/' % (i,options['port'])
         logentry='Address: <a href="%s">%s</a>' % (url,url)
         self.logclass.logger(logentry)
示例#2
0
    def loglinks(self, options):
        '''Prints to the log all the links that weborf is listening to'''
        if options['ip'] == None:
            addrs4 = nhelper.getaddrs(False)

            if self.ipv6:
                addrs6 = nhelper.getaddrs(True)
            else:
                addrs6 = tuple()
        else:
            if self.ipv6:
                #address can be both ipv6 or mapped ipv4
                if '.' in options['ip']:
                    addrs6 = (options['ip'], )
                    addrs4 = (options['ip'][7:], )
                else:  #Normal ipv6
                    addrs4 = tuple()
                    addrs6 = (options['ip'], )
            else:
                addrs6 = tuple()
                addrs4 = (options['ip'], )

        #Output of addresses binded
        for i in addrs4:
            url = 'http://%s:%d/' % (i, options['port'])
            logentry = 'Address: <a href="%s">%s</a>' % (url, url)
            self.logclass.logger(logentry)
        for i in addrs6:
            url = 'http://[%s]:%d/' % (i, options['port'])
            logentry = 'Address: <a href="%s">%s</a>' % (url, url)
            self.logclass.logger(logentry)
示例#3
0
 def setUi(self,ui):
     self.ui=ui
     self.weborf=whelper.weborf_runner(self)
     self.started=False
     
     if self.weborf.version>= '0.13':
         self.ui.chkTar.setEnabled(True)
     else:
         self.ui.chkTar.setEnabled(False)
     
     #Listing addresses
     for i in nhelper.getaddrs(self.weborf.ipv6):
         self.ui.cmbAddress.addItem(i,None)
     
     self.defaultdir=str(QtGui.QDesktopServices.storageLocation(QtGui.QDesktopServices.HomeLocation))
     self.ui.txtPath.setText(self.defaultdir)
示例#4
0
文件: qweborf.py 项目: onlyyoufor/AUR
    def setUi(self, ui):
        self.ui = ui
        self.weborf = whelper.weborf_runner(self)
        self.started = False

        if self.weborf.version >= '0.13':
            self.ui.chkTar.setEnabled(True)
        else:
            self.ui.chkTar.setEnabled(False)

        #Listing addresses
        for i in nhelper.getaddrs(self.weborf.ipv6):
            self.ui.cmbAddress.addItem(i, None)

        self.defaultdir = str(
            QtGui.QDesktopServices.storageLocation(
                QtGui.QDesktopServices.HomeLocation))
        self.ui.txtPath.setText(self.defaultdir)