aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/examples
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2008-02-28 01:34:43 (GMT)
committerJouni Malinen <jm@jm.kir.nu>2008-02-28 01:34:43 (GMT)
commit6fc6879bd55a394f807cbbe927df736c190cb8ab (patch)
treecdf50da0c58f21510a808d53502a060d911ff243 /wpa_supplicant/examples
downloadhostap-6fc6879bd55a394f807cbbe927df736c190cb8ab.zip
hostap-6fc6879bd55a394f807cbbe927df736c190cb8ab.tar.gz
hostap-6fc6879bd55a394f807cbbe927df736c190cb8ab.tar.bz2
Re-initialize hostapd/wpa_supplicant git repository based on 0.6.3 release
Diffstat (limited to 'wpa_supplicant/examples')
-rw-r--r--wpa_supplicant/examples/ieee8021x.conf13
-rw-r--r--wpa_supplicant/examples/plaintext.conf8
-rw-r--r--wpa_supplicant/examples/wep.conf11
-rw-r--r--wpa_supplicant/examples/wpa-psk-tkip.conf12
-rw-r--r--wpa_supplicant/examples/wpa2-eap-ccmp.conf15
-rwxr-xr-xwpa_supplicant/examples/wpas-test.py91
6 files changed, 150 insertions, 0 deletions
diff --git a/wpa_supplicant/examples/ieee8021x.conf b/wpa_supplicant/examples/ieee8021x.conf
new file mode 100644
index 0000000..e8a5503
--- /dev/null
+++ b/wpa_supplicant/examples/ieee8021x.conf
@@ -0,0 +1,13 @@
+# IEEE 802.1X with dynamic WEP keys using EAP-PEAP/MSCHAPv2
+
+ctrl_interface=/var/run/wpa_supplicant
+
+network={
+ ssid="example 802.1x network"
+ key_mgmt=IEEE8021X
+ eap=PEAP
+ phase2="auth=MSCHAPV2"
+ identity="user name"
+ password="password"
+ ca_cert="/etc/cert/ca.pem"
+}
diff --git a/wpa_supplicant/examples/plaintext.conf b/wpa_supplicant/examples/plaintext.conf
new file mode 100644
index 0000000..542ac1d
--- /dev/null
+++ b/wpa_supplicant/examples/plaintext.conf
@@ -0,0 +1,8 @@
+# Plaintext (no encryption) network
+
+ctrl_interface=/var/run/wpa_supplicant
+
+network={
+ ssid="example open network"
+ key_mgmt=NONE
+}
diff --git a/wpa_supplicant/examples/wep.conf b/wpa_supplicant/examples/wep.conf
new file mode 100644
index 0000000..9c7b55f
--- /dev/null
+++ b/wpa_supplicant/examples/wep.conf
@@ -0,0 +1,11 @@
+# Static WEP keys
+
+ctrl_interface=/var/run/wpa_supplicant
+
+network={
+ ssid="example wep network"
+ key_mgmt=NONE
+ wep_key0="abcde"
+ wep_key1=0102030405
+ wep_tx_keyidx=0
+}
diff --git a/wpa_supplicant/examples/wpa-psk-tkip.conf b/wpa_supplicant/examples/wpa-psk-tkip.conf
new file mode 100644
index 0000000..93d7fc2
--- /dev/null
+++ b/wpa_supplicant/examples/wpa-psk-tkip.conf
@@ -0,0 +1,12 @@
+# WPA-PSK/TKIP
+
+ctrl_interface=/var/run/wpa_supplicant
+
+network={
+ ssid="example wpa-psk network"
+ key_mgmt=WPA-PSK
+ proto=WPA
+ pairwise=TKIP
+ group=TKIP
+ psk="secret passphrase"
+}
diff --git a/wpa_supplicant/examples/wpa2-eap-ccmp.conf b/wpa_supplicant/examples/wpa2-eap-ccmp.conf
new file mode 100644
index 0000000..d7a64d8
--- /dev/null
+++ b/wpa_supplicant/examples/wpa2-eap-ccmp.conf
@@ -0,0 +1,15 @@
+# WPA2-EAP/CCMP using EAP-TLS
+
+ctrl_interface=/var/run/wpa_supplicant
+
+network={
+ ssid="example wpa2-eap network"
+ key_mgmt=WPA-EAP
+ proto=WPA2
+ pairwise=CCMP
+ group=CCMP
+ eap=TLS
+ ca_cert="/etc/cert/ca.pem"
+ private_key="/etc/cert/user.p12"
+ private_key_passwd="PKCS#12 passhrase"
+}
diff --git a/wpa_supplicant/examples/wpas-test.py b/wpa_supplicant/examples/wpas-test.py
new file mode 100755
index 0000000..fd7f73d
--- /dev/null
+++ b/wpa_supplicant/examples/wpas-test.py
@@ -0,0 +1,91 @@
+#!/usr/bin/python
+
+import dbus
+import sys, os
+import time
+
+WPAS_DBUS_SERVICE = "fi.epitest.hostap.WPASupplicant"
+WPAS_DBUS_INTERFACE = "fi.epitest.hostap.WPASupplicant"
+WPAS_DBUS_OPATH = "/fi/epitest/hostap/WPASupplicant"
+
+WPAS_DBUS_INTERFACES_INTERFACE = "fi.epitest.hostap.WPASupplicant.Interface"
+WPAS_DBUS_INTERFACES_OPATH = "/fi/epitest/hostap/WPASupplicant/Interfaces"
+WPAS_DBUS_BSSID_INTERFACE = "fi.epitest.hostap.WPASupplicant.BSSID"
+
+def byte_array_to_string(s):
+ import urllib
+ r = ""
+ for c in s:
+ if c >= 32 and c < 127:
+ r += "%c" % c
+ else:
+ r += urllib.quote(chr(c))
+ return r
+
+def main():
+ if len(sys.argv) != 2:
+ print "Usage: wpas-test.py <interface>"
+ os._exit(1)
+
+ ifname = sys.argv[1]
+
+ bus = dbus.SystemBus()
+ wpas_obj = bus.get_object(WPAS_DBUS_SERVICE, WPAS_DBUS_OPATH)
+ wpas = dbus.Interface(wpas_obj, WPAS_DBUS_INTERFACE)
+
+ # See if wpa_supplicant already knows about this interface
+ path = None
+ try:
+ path = wpas.getInterface(ifname)
+ except dbus.dbus_bindings.DBusException, exc:
+ if str(exc) != "wpa_supplicant knows nothing about this interface.":
+ raise exc
+ try:
+ path = wpas.addInterface(ifname, {'driver': dbus.Variant('wext')})
+ except dbus.dbus_bindings.DBusException, exc:
+ if str(exc) != "wpa_supplicant already controls this interface.":
+ raise exc
+
+ if_obj = bus.get_object(WPAS_DBUS_SERVICE, path)
+ iface = dbus.Interface(if_obj, WPAS_DBUS_INTERFACES_INTERFACE)
+ iface.scan()
+ # Should really wait for the "scanResults" signal instead of sleeping
+ time.sleep(5)
+ res = iface.scanResults()
+
+ print "Scanned wireless networks:"
+ for opath in res:
+ net_obj = bus.get_object(WPAS_DBUS_SERVICE, opath)
+ net = dbus.Interface(net_obj, WPAS_DBUS_BSSID_INTERFACE)
+ props = net.properties()
+
+ # Convert the byte-array for SSID and BSSID to printable strings
+ bssid = ""
+ for item in props["bssid"]:
+ bssid = bssid + ":%02x" % item
+ bssid = bssid[1:]
+ ssid = byte_array_to_string(props["ssid"])
+ wpa = "no"
+ if props.has_key("wpaie"):
+ wpa = "yes"
+ wpa2 = "no"
+ if props.has_key("rsnie"):
+ wpa2 = "yes"
+ freq = 0
+ if props.has_key("frequency"):
+ freq = props["frequency"]
+ caps = props["capabilities"]
+ qual = props["quality"]
+ level = props["level"]
+ noise = props["noise"]
+ maxrate = props["maxrate"] / 1000000
+
+ print " %s :: ssid='%s' wpa=%s wpa2=%s quality=%d%% rate=%d freq=%d" % (bssid, ssid, wpa, wpa2, qual, maxrate, freq)
+
+ wpas.removeInterface(dbus.ObjectPath(path))
+ # Should fail here with unknown interface error
+ iface.scan()
+
+if __name__ == "__main__":
+ main()
+