Example #1
0
 def set_auth(self, bonjour_auth_user):
     bonjour_auth_username = str(bonjour_auth_user)
     if bonjour_auth_username:
         auth_user = {bonjour_auth_username:
                  self.parent.bonjour_users[bonjour_auth_username]}
         logger.debug("Bonjour contact which receive message: %s" % auth_user)
         for f in self.friend_list:
             f.auth_user = auth_user
     else:
         banner_notification("Avahi error, please restart HeySms")
Example #2
0
 def set_auth(self, bonjour_auth_user):
     bonjour_auth_username = str(bonjour_auth_user)
     if bonjour_auth_username:
         auth_user = {
             bonjour_auth_username:
             self.parent.bonjour_users[bonjour_auth_username]
         }
         logger.debug("Bonjour contact which receive message: %s" %
                      auth_user)
         for f in self.friend_list:
             f.auth_user = auth_user
     else:
         banner_notification("Avahi error, please restart HeySms")
Example #3
0
    def toggle_smssend(self, state):
        s = subprocess.Popen("/usr/bin/which "
                             "smssend ",
                             shell=True, stdout=subprocess.PIPE)
        res = s.stdout.readlines()
        smssend_installed = False 
        if len(res) == 1:
            smssend_installed = True 

        if not smssend_installed:
            banner_notification("You need to install smssend")
            QtCore.QObject.disconnect(self.smssend_checkbox,
                               QtCore.SIGNAL("stateChanged(int)"),
                               self.toggle_smssend)
            self.smssend_checkbox.setCheckState(QtCore.Qt.Unchecked)
            QtCore.QObject.connect(self.smssend_checkbox,
                               QtCore.SIGNAL("stateChanged(int)"),
                               self.toggle_smssend)
            return

        state = self.smssend_checkbox.checkState()
        config.toggle_smssend(state)
Example #4
0
    def toggle_smssend(self, state):
        s = subprocess.Popen("/usr/bin/which "
                             "smssend ",
                             shell=True,
                             stdout=subprocess.PIPE)
        res = s.stdout.readlines()
        smssend_installed = False
        if len(res) == 1:
            smssend_installed = True

        if not smssend_installed:
            banner_notification("You need to install smssend")
            QtCore.QObject.disconnect(self.smssend_checkbox,
                                      QtCore.SIGNAL("stateChanged(int)"),
                                      self.toggle_smssend)
            self.smssend_checkbox.setCheckState(QtCore.Qt.Unchecked)
            QtCore.QObject.connect(self.smssend_checkbox,
                                   QtCore.SIGNAL("stateChanged(int)"),
                                   self.toggle_smssend)
            return

        state = self.smssend_checkbox.checkState()
        config.toggle_smssend(state)
Example #5
0
    def start_useusb(self):
        # Check current module
        s = subprocess.Popen("cat "
                             "/proc/driver/musb_hdrc "
                             "| "
                             "grep "
                             '"Gadget driver:" ',
                             shell=True, stdout=subprocess.PIPE)
        ret = s.stdout.readlines()
        if len(ret) > 0:
            if ret[0].find('g_file_storage') != -1:
                # Disable g_file_storage module
                s = subprocess.Popen("echo "
                         "' "
                         "/sbin/rmmod "
                         "g_file_storage "
                         "' "
                         "| "
                         "sudo "
                         "gainroot ",
                         shell=True, stdout=subprocess.PIPE)

            time.sleep(1)
            if ret[0].find('g_ether') != -1 and ret[0].find('(none)') != -1:
                banner_notification("Please don't set USB mode")
                return

        # Check if usb0 is used
        if ret[0].find('g_ether') != -1: 
            s = subprocess.Popen("/sbin/ifconfig "
                                 "usb0",
                                 shell=True, stdout=subprocess.PIPE)
            ret = s.stdout.readlines()
            if any([l for l in ret if l.find('addr:') != -1]):
                # usb already used
                banner_notification("USB network is currently used ...")
                return
        time.sleep(1)
        # mount ethernet module
        s = subprocess.Popen("echo "
                             "' "
                             "/sbin/modprobe "
                             "g_ether "
                             "' "
                             "| "
                             "sudo "
                             "gainroot ",
                             shell=True, stdout=subprocess.PIPE)
        # Waiting for mount moule
        time.sleep(1)
        # Set IP
        network = "192.168.55."
        s = subprocess.Popen("echo "
                             "' "
                             "/sbin/ifconfig "
                             "usb0 "
                             + network + "1 "
                             "netmask "
                             "255.255.255.0 "
                             "up "
                             "' "
                             "| "
                             "sudo "
                             "gainroot ",
                             shell=True, stdout=subprocess.PIPE)
        time.sleep(1)            
        # launch dhcp server (dnsmasq)
        self.dns_sp = subprocess.Popen("echo "
                             "' "
                             "/usr/sbin/dnsmasq "
                             "--no-daemon "
                             "-i "
                             "usb0 "
                             "-a "
                             + network + "1 "
                             "-I "
                             "lo "
                             "-z "
                             "--dhcp-range=" + network + "10," + network + "200,6h "
                             "--dhcp-authoritative "
                             "' "
                             "| "
                             "sudo "
                             "gainroot ",
                             shell=True, stdout=subprocess.PIPE)
Example #6
0
    def start_useusb(self):
        # Check current module
        s = subprocess.Popen(
            "cat "
            "/proc/driver/musb_hdrc "
            "| "
            "grep "
            '"Gadget driver:" ',
            shell=True,
            stdout=subprocess.PIPE)
        ret = s.stdout.readlines()
        if len(ret) > 0:
            if ret[0].find('g_file_storage') != -1:
                # Disable g_file_storage module
                s = subprocess.Popen(
                    "echo "
                    "' "
                    "/sbin/rmmod "
                    "g_file_storage "
                    "' "
                    "| "
                    "sudo "
                    "gainroot ",
                    shell=True,
                    stdout=subprocess.PIPE)

            time.sleep(1)
            if ret[0].find('g_ether') != -1 and ret[0].find('(none)') != -1:
                banner_notification("Please don't set USB mode")
                return

        # Check if usb0 is used
        if ret[0].find('g_ether') != -1:
            s = subprocess.Popen("/sbin/ifconfig "
                                 "usb0",
                                 shell=True,
                                 stdout=subprocess.PIPE)
            ret = s.stdout.readlines()
            if any([l for l in ret if l.find('addr:') != -1]):
                # usb already used
                banner_notification("USB network is currently used ...")
                return
        time.sleep(1)
        # mount ethernet module
        s = subprocess.Popen(
            "echo "
            "' "
            "/sbin/modprobe "
            "g_ether "
            "' "
            "| "
            "sudo "
            "gainroot ",
            shell=True,
            stdout=subprocess.PIPE)
        # Waiting for mount moule
        time.sleep(1)
        # Set IP
        network = "192.168.55."
        s = subprocess.Popen("echo "
                             "' "
                             "/sbin/ifconfig "
                             "usb0 " + network + "1 "
                             "netmask "
                             "255.255.255.0 "
                             "up "
                             "' "
                             "| "
                             "sudo "
                             "gainroot ",
                             shell=True,
                             stdout=subprocess.PIPE)
        time.sleep(1)
        # launch dhcp server (dnsmasq)
        self.dns_sp = subprocess.Popen("echo "
                                       "' "
                                       "/usr/sbin/dnsmasq "
                                       "--no-daemon "
                                       "-i "
                                       "usb0 "
                                       "-a " + network + "1 "
                                       "-I "
                                       "lo "
                                       "-z "
                                       "--dhcp-range=" + network + "10," +
                                       network + "200,6h "
                                       "--dhcp-authoritative "
                                       "' "
                                       "| "
                                       "sudo "
                                       "gainroot ",
                                       shell=True,
                                       stdout=subprocess.PIPE)