当前位置: 首页>>代码示例>>Python>>正文


Python Wireless.getEssid方法代码示例

本文整理汇总了Python中pythonwifi.iwlibs.Wireless.getEssid方法的典型用法代码示例。如果您正苦于以下问题:Python Wireless.getEssid方法的具体用法?Python Wireless.getEssid怎么用?Python Wireless.getEssid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pythonwifi.iwlibs.Wireless的用法示例。


在下文中一共展示了Wireless.getEssid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: checkwifi

# 需要导入模块: from pythonwifi.iwlibs import Wireless [as 别名]
# 或者: from pythonwifi.iwlibs.Wireless import getEssid [as 别名]
def checkwifi():
    #here is some trickery to work in windows
    #without making a cmd window pop up frequently
    startupinfo = None
    print "os.name=="+OSName
    if OSName == 'nt' or OSName =="win32": #the user is using windows so we don't want cmd to show
        startupinfo = subprocess.STARTUPINFO()
        startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
        output = subprocess.Popen(["ipconfig", "/all"], stdout=subprocess.PIPE,
                                  startupinfo=startupinfo).communicate()[0]
        e=0
        lines=output.split('\n')
        for line in lines:
            if line.startswith('   Connection-specific DNS Suffix  . : '):
                if not len(line)==40:
                    nline=line[39:]
                    print(line)
                    if "dublinschool.org" in nline:
                        if(not lines[e-3].startswith('Tunnel')): #make sure this is not a tunnel adapter
                            print('found')
                            return(True)
            e=e+1; #maybe cleanup later
    elif SYSPlat == 'linux2':
        from pythonwifi.iwlibs import Wireless
        wifi = Wireless('wlan0')
        if(wifi.getEssid()=="student"):
            return(True)
开发者ID:aggendo,项目名称:Dublin-Autologin,代码行数:29,代码来源:login.py

示例2: main

# 需要导入模块: from pythonwifi.iwlibs import Wireless [as 别名]
# 或者: from pythonwifi.iwlibs.Wireless import getEssid [as 别名]
def main():
    rospy.init_node('wifi_poller')
    poll_freq = rospy.get_param('~poll_freq', 1)
    interface = rospy.get_param('~interface', 'eth1')
    frame_id = rospy.get_param('~frame_id', 'base_link')

    pub = rospy.Publisher('wifi_info', WifiInfo)

    wifi = Wireless(interface)
    poll_rate = rospy.Rate(poll_freq)
    while not rospy.is_shutdown():
        info = WifiInfo()
        info.header.stamp = rospy.Time.now()
        info.header.frame_id = frame_id

        try:
            info.essid = wifi.getEssid()
            info.interface = interface
            info.status = WifiInfo.STATUS_DISCONNECTED
            if info.essid:
                info.frequency = float(wifi.getFrequency().split(' ')[0])
                info.APaddr = wifi.getAPaddr()
                info.status = WifiInfo.STATUS_CONNECTED
        except IOError:
            # This can happen with an invalid iface
            info.status = WifiInfo.STATUS_ERROR
        except Exception, e:
            info.status = WifiInfo.STATUS_ERROR
            rospy.logerr('Error: %s' % e)

        pub.publish(info)
        poll_rate.sleep()
开发者ID:OSUrobotics,项目名称:wifi_info,代码行数:34,代码来源:poll_wifi.py

示例3: sniff_wifi

# 需要导入模块: from pythonwifi.iwlibs import Wireless [as 别名]
# 或者: from pythonwifi.iwlibs.Wireless import getEssid [as 别名]
def sniff_wifi():
    if plat == "OSX":
        # bridge to objective c(apple stuff)
        objc.loadBundle(
            "CoreWLAN", bundle_path="/System/Library/Frameworks/CoreWLAN.framework", module_globals=globals()
        )

        for iname in CWInterface.interfaceNames():
            interface = CWInterface.interfaceWithName_(iname)
            wifi_parameters = (
                "Interface:      %s, SSID:           %s, Transmit Rate:  %s, Transmit Power: %s, RSSI:           %s"
                % (iname, interface.ssid(), interface.transmitRate(), interface.transmitPower(), interface.rssi())
            )
    elif plat == "LINUX":
        interface = Wireless("wlan0")

        # Link Quality, Signal Level and Noise Level line
        wifi_parameters = "Interface:      %s, SSID:           %s, Transmit Rate:  %s, Transmit Power: %s" % (
            "wlan0",
            interface.getEssid(),
            interface.getBitrate(),
            interface.getTXPower(),
        )

    # record wifi parameters
    print wifi_parameters
    open(channels_file, "a").write(wifi_parameters + "\n")
开发者ID:baharxy,项目名称:LTEWiFi-Measurements,代码行数:29,代码来源:udp_local_phone.py

示例4: get_status

# 需要导入模块: from pythonwifi.iwlibs import Wireless [as 别名]
# 或者: from pythonwifi.iwlibs.Wireless import getEssid [as 别名]
 def get_status(interface):
     interface = Wireless(interface)
     try:
         stats = Iwstats(interface)
     except IOError:
         return (None, None)
     quality = stats.qual.quality
     essid = interface.getEssid()
     return (essid, quality)
开发者ID:20after4,项目名称:qtile,代码行数:11,代码来源:wlan.py

示例5: update

# 需要导入模块: from pythonwifi.iwlibs import Wireless [as 别名]
# 或者: from pythonwifi.iwlibs.Wireless import getEssid [as 别名]
 def update(self):
     interface = Wireless(self.interface)
     stats = Iwstats(self.interface)
     quality = stats.qual.quality
     essid = interface.getEssid()
     text = "{} {}/70".format(essid, quality)
     if self.text != text:
         self.text = text
         self.bar.draw()
     return True
开发者ID:Cadair,项目名称:qtile,代码行数:12,代码来源:wlan.py

示例6: poll

# 需要导入模块: from pythonwifi.iwlibs import Wireless [as 别名]
# 或者: from pythonwifi.iwlibs.Wireless import getEssid [as 别名]
 def poll(self):
     interface = Wireless(self.interface)
     try:
         stats = Iwstats(self.interface)
         quality = stats.qual.quality
         essid = interface.getEssid()
         return "{} {}/70".format(essid, quality)
     except IOError:
         logging.getLogger('qtile').error('%s: Probably your wlan device '
                 'is switched off or otherwise not present in your system.',
                 self.__class__.__name__)
开发者ID:Davidbrcz,项目名称:qtile,代码行数:13,代码来源:wlan.py

示例7: getSignalLevel

# 需要导入模块: from pythonwifi.iwlibs import Wireless [as 别名]
# 或者: from pythonwifi.iwlibs.Wireless import getEssid [as 别名]
    def getSignalLevel(self):
	wifi = Wireless('wlan1') 
	essid = wifi.getEssid()
	signal = "xx"
	try:
	  signal = wifi.getQualityAvg().signallevel
	  self.signalLevel.setValue(signal)
	except:
	  pass
	self.signalLevel.setFormat(str(essid)+"  "+str(signal))
	return True
开发者ID:homoludens,项目名称:py_examples,代码行数:13,代码来源:pyqtwindow.py

示例8: updateStates

# 需要导入模块: from pythonwifi.iwlibs import Wireless [as 别名]
# 或者: from pythonwifi.iwlibs.Wireless import getEssid [as 别名]
  def updateStates(self):
    try:
      wifi = Wireless('wlan0')
      ap_addr = wifi.getAPaddr()

      # Update Wifi Status
      if (ap_addr == "00:00:00:00:00:00"):
        self.ui.lblWifiStatus.setText('Not associated')
      else:
        self.ui.lblWifiStatus.setText(str(wifi.getEssid())+" connected")

      # Update 3G status
      ## Grep for route here

      # Update internet connectivity status
      response = os.system("ping -c 1 google.co.uk > /dev/null")
      if response == 0:
        self.ui.lblNetStatus.setText('Connected')
        netConnected = 1
      else:
        self.ui.lblNetStatus.setText('Not Connected')
        netConnected = 0

      # Update chef status
      response = os.system("ps auwwwx | grep -q chef-client")
      if response == 1:
        self.ui.lblChefRunStatus.setText('Running...')
      else:
        self.ui.lblChefRunStatus.setText('Not Running')
      try:
        f = open('/tmp/chef-lastrun')
        self.ui.lblChefStatus.setText(f.read())
        f.close()
      except:
        self.ui.lblChefStatus.setText('Unable to read')
      
      if netConnected:
        self.launchTimer = self.launchTimer - 1
        self.ui.btnLaunch.setEnabled(True)
      else:
        self.launchTimer = 15
        self.ui.btnLaunch.setEnabled(False)

      if self.launchTimer == 0:
        self.LoginForm = LoginForm()
        self.LoginForm.show()
        self.hide()

      self.ui.btnLaunch.setText("Launch ("+str(self.launchTimer)+")")
  
    finally:
      QtCore.QTimer.singleShot(1000, self.updateStates)
开发者ID:Afterglow,项目名称:pycar,代码行数:54,代码来源:pycar.py

示例9: get_intf_details

# 需要导入模块: from pythonwifi.iwlibs import Wireless [as 别名]
# 或者: from pythonwifi.iwlibs.Wireless import getEssid [as 别名]
 def get_intf_details(self, ip):
     rnode = self._radix.search_best(ip)
     intf = rnode.data["intf"]
     wifi = Wireless(intf)
     res = wifi.getEssid()
     if type(res) is tuple:
         dst_mac = ""
         if rnode.data["gw"] == "0.0.0.0":
             dst_mac = self._lookup_mac(ip)
         #                print "the ns %s has a mac %s"%(ip, dst_mac)
         else:
             dst_mac = self._lookup_mac(rnode.data["gw"])
         #                print "the gw %s has a mac %s"%(rnode.ata['gw'], dst_mac)
         return dict(is_wireless=False, dst_mac=dst_mac, intf=intf, essid="", ns=ip)
     else:
         return dict(is_wireless=True, dst_mac=wifi.getAPaddr(), intf=intf, essid=res, ns=ip)
开发者ID:avsm,项目名称:signpost,代码行数:18,代码来源:routing.py

示例10: getStatus

# 需要导入模块: from pythonwifi.iwlibs import Wireless [as 别名]
# 或者: from pythonwifi.iwlibs.Wireless import getEssid [as 别名]
	def getStatus(self):
		ifobj = Wireless(self.iface)
		fq = Iwfreq()
		try:
			self.channel = str(fq.getChannel(str(ifobj.getFrequency()[0:-3])))
		except:
			self.channel = 0
		status = {
				  'BSSID': str(ifobj.getAPaddr()), #ifobj.getStatistics()
				  'ESSID': str(ifobj.getEssid()),
				  'quality': "%s/%s" % (ifobj.getStatistics()[1].quality,ifobj.getQualityMax().quality),
				  'signal': str(ifobj.getStatistics()[1].siglevel-0x100) + " dBm",
				  'bitrate': str(ifobj.getBitrate()),
				  'channel': str(self.channel),
				  #'channel': str(fq.getChannel(str(ifobj.getFrequency()[0:-3]))),
		}
		
		for (key, item) in status.items():
			if item is "None" or item is "":
					status[key] = _("N/A")
				
		return status
开发者ID:FFTEAM,项目名称:enigma2-5,代码行数:24,代码来源:Wlan.py

示例11: iwconfig

# 需要导入模块: from pythonwifi.iwlibs import Wireless [as 别名]
# 或者: from pythonwifi.iwlibs.Wireless import getEssid [as 别名]
def iwconfig(interface):
    """ Get wireless information from the device driver. """
    if interface not in getWNICnames():
        print "%-8.16s  no wireless extensions." % (interface, )
    else:
        wifi = Wireless(interface)
        line = """%-8.16s  %s  """ % (interface, wifi.getWirelessName())
        if (wifi.getEssid()):
            line = line + """ESSID:"%s"  \n          """ % (wifi.getEssid(), )
        else:
            line = line + "ESSID:off/any  \n          "

        # Mode, Frequency, and Access Point
        line = line + "Mode:" + wifi.getMode()
        try:
            line = line + "  Frequency:" + wifi.getFrequency()
        except IOError, (error_number, error_string):
            # Some drivers do not return frequency info if not associated
            pass

        if (wifi.wireless_info.getMode() == pythonwifi.flags.IW_MODE_ADHOC):
            ap_type = "Cell"
        else:
            ap_type = "Access Point"
        ap_addr = wifi.getAPaddr()
        if (ap_addr == "00:00:00:00:00:00"):
            ap_addr = "Not-Associated"
        line = line + "  " + ap_type + ": " + ap_addr + "   "
        print line

        # Bit Rate, TXPower, and Sensitivity line
        line = "          "
        bitrate = getBitrate(wifi)
        if bitrate:
            line = line + bitrate
        txpower = getTXPower(wifi)
        if txpower:
            line = line + txpower
        sensitivity = getSensitivity(wifi)
        if sensitivity:
            line = line + sensitivity
        print line

        # Retry, RTS, and Fragmentation line
        line = "          "
        retry = getRetrylimit(wifi)
        if retry:
            line = line + retry
        rts = getRTS(wifi)
        if rts:
            line = line + rts
        fragment = getFragmentation(wifi)
        if fragment:
            line = line + fragment
        print line

        # Encryption line
        line = "          "
        line = line + getEncryption(wifi)
        print line

        # Power Management line
        line = "          "
        line = line + getPowerManagement(wifi)
        print line

        try:
            stat, qual, discard, missed_beacon = wifi.getStatistics()
        except IOError, (error_number, error_string):
            # Some drivers do not return statistics info if not associated
            pass
开发者ID:FomkaV,项目名称:wifi-arsenal,代码行数:73,代码来源:iwconfig.py

示例12: Wireless

# 需要导入模块: from pythonwifi.iwlibs import Wireless [as 别名]
# 或者: from pythonwifi.iwlibs.Wireless import getEssid [as 别名]
from pythonwifi.iwlibs import Wireless
wifi = Wireless('wlan0')
print wifi.getEssid()
print wifi.getMode()

开发者ID:mstfmomin,项目名称:labmonembedded,代码行数:6,代码来源:wifitest1.py

示例13: paintInterface

# 需要导入模块: from pythonwifi.iwlibs import Wireless [as 别名]
# 或者: from pythonwifi.iwlibs.Wireless import getEssid [as 别名]
    def paintInterface(self, painter, option, rect):
        wifi=Wireless('wlan0')
        dump,qual,dump,dump=wifi.getStatistics()
        self.chart.addSample([qual.signallevel-qual.noiselevel,qual.quality,100+qual.signallevel])
	self.chart.setShowTopBar(False)
	self.chart.setShowVerticalLines(False)
	self.chart.setShowHorizontalLines(False)
	self.chart.setShowLabels(False)
	self.chart.setStackPlots(False)
	self.chart.setUseAutoRange(True)
	painter.save()
        painter.setPen(Qt.black)
        self.label.setText("ESSID: %s\nLink quality: %02d/100\nSignal level: %02ddB\nSignal/Noise: %02ddB"%(wifi.getEssid(),qual.quality,qual.signallevel,qual.signallevel-qual.noiselevel))
        painter.restore()
开发者ID:nightsh,项目名称:argent-kde-config,代码行数:16,代码来源:main.py

示例14: print

# 需要导入模块: from pythonwifi.iwlibs import Wireless [as 别名]
# 或者: from pythonwifi.iwlibs.Wireless import getEssid [as 别名]
SIGMA_MIN = 2
SAMPLE_FREQ_HZ = 2

if options.verbose:
    print("Scanning for rouge AP's. Ctrl-C to exit.")

# Start processing. Ctrl-C to exit
while True: 
    
    time.sleep(1 / SAMPLE_FREQ_HZ)

    # Sample the network
    stat = wifi.getStatistics()[1]
    sig_level = stat.getSignallevel()
    ap_addr = wifi.getAPaddr()
    essid = wifi.getEssid()

    # First time sample on essid
    if not essid == current_essid:
        if options.verbose:
            print("Current essid: '%s' (%s)" % (essid, ap_addr))

        current_essid = essid
        current_ap_addr = ap_addr
        sig_sample = [sig_level]
        sig_avg = None
        sig_std = None
        continue

    # Check that AP addr hasn't changed
    if not current_ap_addr == ap_addr:
开发者ID:4ZM,项目名称:snarfsnare,代码行数:33,代码来源:snarfsnare.py

示例15: main

# 需要导入模块: from pythonwifi.iwlibs import Wireless [as 别名]
# 或者: from pythonwifi.iwlibs.Wireless import getEssid [as 别名]
def main():
    global ip_lst
    # status.noc.stonybrook.edu
    parser = argparse.ArgumentParser(description="man on the side attack detector.")
    parser.add_argument("-i", "--ifname", help="interface to use", type=str, required=False, default="wlp1s0")

    parser.add_argument("-o", "--out-file", help="file to write live ip's to", type=str, required=False, default=None)

    parser.add_argument(
        "-t",
        "--cache-clear-interv",
        help="how long to wait before clearing the ARP cache",
        type=int,
        required=False,
        default=0,
    )

    parser.add_argument(
        "-m", "--mu", help="how long to wait before pinging the next random IP", type=float, required=False, default=0
    )

    args = parser.parse_args()

    ifname = args.ifname

    mask = get_netmask(ifname)
    ip_str = get_ipaddress(ifname)

    print("mask: " + mask)
    print("ip: " + ip_str)

    ip = netaddr.IPNetwork(ip_str + "/" + mask)
    print(ip)

    found_ips = []

    # scan whole network for live computers
    ans, unans = arping(str(ip.network) + "/" + str(ip.prefixlen), iface=ifname)

    # record all of the live IP's
    for i in ans:
        found_ips.append(i[0][ARP].pdst)

    print("found " + str(len(found_ips)) + " IPs")

    # write the IP's to a file if requested
    if args.out_file is not None:
        outfile = open(args.out_file, "w")
        wifi = Wireless(ifname)
        outfile.write("args: " + str(args) + "\n")
        outfile.write("essid: " + wifi.getEssid() + "\n")
        outfile.write("mode: " + wifi.getMode() + "\n")
        outfile.write("mask: " + mask + "\n")
        outfile.write("ip: " + ip_str + "\n")
        outfile.write("network: " + str(ip.network) + "/" + str(ip.prefixlen) + "\n")

        outfile.write("\n".join(found_ips))
        outfile.write("\n")
        outfile.close()

    # schedule the ARP cache clearing
    if args.cache_clear_interv > 0:
        t = threading.Thread(target=clear_cache_timer, args=[args.cache_clear_interv])
        t.start()

    # schedule the pinging
    if args.mu <= 0:
        sys.exit(1)

    ip_lst = found_ips
    random.shuffle(ip_lst)

    # signal.signal(signal.SIGALRM, ping_rnd)
    # signal.setitimer(signal.ITIMER_REAL, args.mu, args.mu)

    while True:
        # signal.pause()
        t = threading.Thread(target=ping_rnd, args=["", ""])
        t.start()
        time.sleep(args.mu)
开发者ID:mjsalerno,项目名称:arptest,代码行数:82,代码来源:arptest.py


注:本文中的pythonwifi.iwlibs.Wireless.getEssid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。