Full text
TREBALL FINAL DE GRAU Títol: Implementation of a programmable Wi-Fi jammer (论可编译 Wi-Fi干扰器的可行性) Autor: Yifei Ge (戈一飞) Director: Eduard Garcia Villegas Data: 13 de Febrer de 2017
Títol: Implementación de un jammer Wi-Fi programable (论可编译 Wi-Fi干扰器的可行性) Autor: Yifei Ge (戈一飞) Director: Eduard Garcia Villegas Data: 13 de Febrero de 2017 Resum En nuestra sociedad, los dispositivos Wi-Fi aumentan a una velocidad exponencial. Los usuarios cada día tienen más necesidad de la tecnología inalámbrica. A pesar de todo ello, la seguridad en la red Wi-Fi se considera un reto grande que todavía no ha recibido toda la atención que merece. Millones de ataques han sido inventados aprovechando las vulnerabilidades que existen en la tecnología Wi-Fi. Especialmente, el ataque de denegación de servicio (DoS) se considera como un problema grave porque causa una interrupción total en el sistema de comunicación y, potencialmente, una inmensa pérdida económica. El ataque se puede llevar a cabo por un dispositivo asequible y económico en el mercado. Un jammer Wi-Fi es un dispositivo diseñado para realizar un ataque DoS enviando una señal con potencia alta a un determinado canal. Además, el control del acceso medio en WLAN está basado en el mecanismo CSMA/CA, es muy vulnerable a un ataque DoS porque los atacantes pueden aprovechar el diseño de algunos mensajes del dicho mecanismo y bloquear la comunicación. Por lo tanto, esta investigación tiene su objetivo principal en demostrar la vulnerabilidad de la red Wi-Fi frente ataques de denegación de servicio usando un chip programable, TI SimpleLink CC320. Para alcanzar nuestro objetivo, analizamos diferentes aspectos de la tecnología IEEE 802.11, nos familiarizamos con el entorno de desarrollo del chip, y estudiamos el código de los ejemplos para adaptar nuestra implementación. EL trabajo se completa con pruebas sobre su efectividad y eficiencia. Para ello, usamos software como Tera-term, Wireshark, Iperf, TI radio tool como herramientas de testing. Se trata de buscar el daño máximo en función de la menor potencia consumida. En esa búsqueda, hemos creado una serie de experimentos para estudiar el efecto de la distancia junto el nivel de la potencia transmitida y el consumo energético según la variación de la potencia transmitida.
Overview In our society, Wi-Fi devices increase at an exponential rate. Users are increasingly in need of wireless technology. In spite of all this, security in the Wi-Fi network is considered a big challenge that has not yet received all the attention it deserves. Millions of attacks have been invented exploiting the vulnerabilities that exist in Wi-Fi technology. In particular, the denial of service (DoS) attack is considered to be a serious problem because it causes a total disruption in the communication system and potentially an immense economic loss. Such attack can be carried out using an affordable and economical device on the market. A Wi-Fi jammer is a device designed to perform a service DoS attack by sending a signal with high power to a particular channel. In addition, the WLAN medium access control is based on the CSMA / CA mechanism, it is very vulnerable to a DoS attack because the attackers can take advantage of the design of some messages of the mechanism and block the communication. Therefore, this research has its main objective in demonstrating the vulnerability of Wi-Fi network denial of service attacks using a programmable chip, TI SimpleLink CC320. To reach our goal, we analyze different aspects of IEEE 802.11 technology, become familiar with the development environment of the chip, and study the code of the examples to adapt our implementation. The work is completed with evidence of its effectiveness and efficiency. To do this, we use software such as Tera-term, Wireshark, Iperf, TI radio tool as testing tools. It is about finding the maximum damage based on the lowest power consumed. In this search, we have created a series of experiments to study the effect of the distance together the level of transmitted power and the energy consumption according to the variation of transmitted power. Title: Implementation of a programmable Wi-Fi jammer (论可编译 Wi-Fi干扰器的可行性) Author: Yifei Ge (戈一飞) Director: Eduard Garcia Villegas Date: February, 13th 2017
仅将本文献给我的母亲与外婆 感谢她们多年来的支持与理解 没有她们无条件的关怀与母爱 我亦无法完成学业及本篇论文 To my mother and grandmother, For all the support and understanding, Without their unconditional love, I would not be able to finish my study and this thesis. 感谢我的挚友 Néstor 和 我的导师 Eduard 他们在学术上的建议与帮助, 对本文起到了推波助澜的巨大作用。 To my best friend Néstor and my tutor Eduard Their constructive academic advices and suggestions have been a significant help to this thesis.
Index Introduction......................................................................................................... 3 Chapter 1. About IEEE 802.11 ........................................................................... 3 1.1. IEEE 802.11 Overview: ......................................................................... 3 1.2. Medium Access Control in IEEE 802.11 ................................................ 5 1.3. IEEE 802.11 messages ......................................................................... 6 1.4. IEEE 802.11 security issues .................................................................. 8 Chapter 2. Jamming Attack .............................................................................. 12 2.1. What is a jammer ................................................................................ 12 2.2. Jamming in WLAN networks ............................................................... 13 Chapter 3. Implementation Environment .......................................................... 15 3.1. Possible jammer Implementations ...................................................... 15 3.2. About TI CC3200 ................................................................................ 19 3.3. IDE for CC3200 development ............................................................. 22 3.4. Quick start project 0 guide ................................................................... 26 Chapter 4. Constant Jammer ........................................................................... 32 4.1. Theoretical study ................................................................................. 32 4.2. Implementation .................................................................................... 33 4.3. constant jammer by TI radio tool ......................................................... 35 4.4. Evaluation ........................................................................................... 38 Chapter 5. Deceive jammer .............................................................................. 44 5.1. Theoretical study ................................................................................. 44 5.2. Implementation .................................................................................... 45 5.3. Evaluation ........................................................................................... 46 Conclusion:....................................................................................................... 51 References ....................................................................................................... 53 Acronyms ......................................................................................................... 55 Annex ............................................................................................................... 56
Introduction 3 Introduction: In this modern society, we more and more rely on technologies, specially, on information and communications technology. It’s evolving at an incredible pace since the last decades, time during which the concept of “computer” has been completely changed. For instance, today’s definition of computer isn’t related to the traditional desktop or laptop device anymore, a single mobile phone might have a stunning computational capacity to process large amount of data. Its physical design doesn’t need to be a folding device with keyboard but a simple tactile screen or wearable device that satisfy all our needs. One of the biggest reasons that we can enjoy our life with these “magical” objects would be that the network infrastructures are well developed and implemented. In other words, network operators have prepared a robust condition for us, the end-users. There are so many options to connect to the Internet. At the beginning, devices like desktops or laptops can transmit data using wires (e.g. Ethernet cable). However, as mentioned before, more and more small sized computing devices are involved in our daily-life. Wired solutions aren’t always feasible. Therefore, wireless technology has become a major player. Among the available WPAN, WLAN and WWAN technologies in use today, those based on the set of standards defined by the IEEE 802.11 can be considered one of the most popular and rapidly growing alternatives. According to the recent statistics, Wi- Fi devices were already over 15 billion at the end of 2016 [21]. Such standard, popularly known as Wi-Fi, seems a perfect and ideal solution for the smart objects due to its acceptable throughput, wireless characteristic and flexible mobility inside the sign coverage. But, is it a really reliable and secure network environment? Could we 100% assume the data integrity? In the following chapters demonstrate that Wi-Fi networks are extremely vulnerable under jamming attack because of its channel access scheme. All these questions are the major objectives and reasons for this investigation; more precisely, it is focused in WLAN network availability and the network strength under jamming attacks. Once the global aim of the project is settled, the specific objectives of this dissertation are the following: first, we studied the literature on jamming Wi-Fi networks, and then we study the hardware platform that will be used to build different types of jammers. One of the contributions of this project is the production of documentation regarding the installation and operation of the development environment chosen. Finally, we implement our jammer and evaluate its efficiency with a set of experiments. The hardware exploration, development environment installation, the study state of the art on jamming Wi-Fi networks, the attack technique implementation and the measurements of fundamental network parameters in order to evaluate and optimize the jammer performance is collected and hereby documented as my final degree project.
Implementation of a programmable Wi-Fi jammer 4 As the index showed, this study will be divided in six chapters. The first chapter briefly introduces the IEEE802.11 standard’s history and some fundamental mechanisms, relevant to this project. Chapter 2 focuses on the concept of jammer, types of jammer and how it works in a WLAN. In chapter 3, we give details about the hardware platform used to implement the jammer its development environment and some deployment details such as compilation, programming language, useful function library, etc. Chapter 4 and 5 will provide more details about the jamming implementation. In this study, we first develop two types of jammer: constant jammer and deceive jammer to then measure its impact and the energy consumed. Finally, we will review all the significant points of each chapter and discussing whether we have achieved our goals as proposed initially.
About IEEE 802.11 3 Chapter 1. About IEEE 802.11 1.1. IEEE 802.11 Overview: The widely known wireless local area network (WLAN) IEEE 802.11 Standard, the main objective of which is to create a Local Area Network (LAN) environment using RF communication techniques. It appeared after the the Federal Communications Commission (FCC) announced the availability of spectrum from 2.4-2.5 GHz for individual and non-licensed use in 1985 [1]. Turs, this lead to up and coming developers of wireless communications technologies implemented their projects in this license free frequency. The IEEE 802.11 Standard has undergone constant amendment and updating, striving to provide new services and features for expanding the use case set of WLANs. The following figure shows all the IEEE 802.11 amendments in different time period: Table 1 Evolution timeline of 802.11 standards In the original standard, adopted in 1997, the maximum physical rate was only 2Mbps using direct sequence and frequency hopping for interference mitigation. The key success of 802.11 is definitely its compatibility with current 802 networks, specifically, the 802.3 wired Ethernet networks. It’s possible due to the independence of its PHY access and MAC access from overlaying communication layers. [1]
Implementation of a programmable Wi-Fi jammer 10 Figure 5 Man in the Middle attack 3. Denial of service Denial of service (DoS) defines as the inability of users or systems to access needed resources. The attack is especially against WLAN networks at physical layer and link layer [5]. Physical layer attack: The attacker tries to generate a high power level signal in order to drown out the RF signal transmitted by the legal STA on WLAN. Since the hacker has a high power signal, it effectively causes a DoS scenario, since IEEE 802.11 compliant stations will always sense the medium busy. Link layer attack: Normally, it exploits the processing of certain management frames exchange within a WLAN. The attacker generates gratuitous WLAN management or control frames, which are difficult to be ignored by the STA and the AP. In consequence, STAs will be denied access to the WLAN as long as the attacker continues to transmit those forged frames.
About IEEE 802.11 11 Figure 6 Dos scenario at layer 2 All these attack techniques mentioned previously are only a tiny peak of the iceberg. The physical factor and the lack of security considerations made the WLAN network a paradise for the cyber attackers. In consequence, IEEE 802.11w was ratified in 2009 to increase the security of its management frames improving the IEEE 802.11 Medium Access Control layer in order to increase the data confidentiality of management frames. According to this amendment, it protects critical messages such as disassociation, de-authentication and reassociation etc. However, a DoS attack using frames like RTS/CTS will still be very effective despite this amendment since RTS/CTS are very significant frames and they must be able to be decoded for all the nearby devices sharing the medium, therefore no encryption would be applied to RTS/CTS. In the next chapter, a more specific study of DoS attacks would be introduced, such as the basic concept of a jammer, type of jammers and possible implementations to create a jamming device to attack WLAN networks.
Jamming Attack 12 Chapter 2. Jamming Attack 2.1. What is a jammer A brief concept about security threats in IEEE 803.11x networks has been demonstrated in the previous chapter. In this section, a detailed study about denial of service attack techniques using jammer devices will be explained. At the beginning, it’s important to be aware of the definition of a jammer and its mechanisms. According to several related academic papers, a jammer could be defined as “an entity who is purposefully trying to interfere with the physical transmission and reception of wireless communication” [6]. Most DoS attacks based on jammer devices are layer-1 attacks with non-Wi-Fi devices trying to generate a high power signal at the same channel as the legitimate stations. Normally, it spreads energy over the targeted spectrum where it becomes difficult for a legitimate receiver to distinguish the expected signal from the interference. Such attack intends to interrupt the communication in a WLAN network. To archive this objective, it’s enough only using a low-priced and easily accessible RF generator which is capable producing 2.4GHz or 5GHz signals. Most of them are well encapsulated with a simple on-off switch to turn on and off the jammer; usually, they are battery-powered since such device should have autonomy. In [19] a link is provided as an example of a simple jammer in the market. Furthermore, it’s interesting to notice that, in order to produce a communication disorder in WLAN network, sometimes it’s not always necessary the transmission of a high power signal. A low power transmission could be significantly harmful if the jammer is well settled and configured. For example, it could be designed to only jam certain frames such as the acknowledgement frames to make the transmitter misunderstand that the data is lost or broken during the communication. This creates retransmissions (with increasing backoff timer values) until the network gets into a vicious loop to freeze the communication. Jamming techniques are cost-effective attacks in terms of the harm they produce as breaking down the core communication line, VoIP service, mail service, web etc. Each of these services unavailability leads to huge economic losses for the companies who rely their business activity on staying connected.
Implementation of a programmable Wi-Fi jammer 13 Figure 7 a Wi-Fi jamming device 2.2. Jamming in WLAN networks As previously explained, this contention-based MAC mechanism is very vulnerable to DoS attacks using jamming techniques. As we know, typical jammers generate a powerful signal at the same frequency as the Wi-Fi devices. In consequence, the medium is always sensed as occupied, which can prevent the nodes to perform legitimate MAC operations or can cause the collision of frames, thus increasing backoff waiting times. Furthermore, based on a large amount of studies and many observations on the jammers’ performance during the experiments; there could be a well justified classification of jammers as the following [6]: Constant jammers Deceptive jammers Random jammers Reactive jammers Constant jammer are those low-priced simple jammers that we are familiar with; it transmits radio signal without following any MAC layer protocol. It tries to occupy a specific channel during a given period. Deceptive jammers continuously sending regular frames (normally, IEEE802.11 management frames) without any gap. This leads to a fraud to other communicating nodes to believe that a legal transmission is occurring. Random jammers that transmit for a time and goes to sleep, where both the transmission time and the sleep time can be random. Reactive jammers that start transmitting jamming signals as soon as it detects activity on the shared medium and goes to sleep when there is no one transmitting.
Jamming Attack 14 In this study, investigation about constant jammer and deceptive jammer would be shown in the further chapters. Despite the major focus would be on the deceptive jammer. Even though, all the type of jammers is able to produce an unimaginable negative result to the IEEE802.11 network communication. But, their costefficiency would be rather different. For example, some may need to generate a higher power signal to archive the same result which implies more electric consumption and less battery life. For this matter, there are several factors could significantly impact the jamming result [23]: 1. Distance between jammer and wireless device 2. Transmission power of jammer and the network devices 3. Modulation and coding scheme used by the WLAN STAs 4. Frame size and the role of the attacked device Each factor plays a critical role in the jamming attack. In the further chapter, a more specific analysis would be demonstrated with experiments carried out in an isolated, low interferences condition. Thus, the experiment results would be more trustworthy and help us to compare the efficiency of each jammer based on different factors.
Implementation Environment 15 Chapter 3. Implementation Environment After the introduction on IEEE 802.11 operation and the mechanisms used by jammers, this chapter evolves our objectives towards the implementation of a low-cost, low-energy jamming device. For that objective, we first study different hardware platforms and then we detail the environment chosen: the TI CC3200. 3.1. Possible jammer Implementations At this point, it would be more oriented to the implementation of a jammer with chipset that has basic computational capacity and Wi-Fi modules such as Wi-Fi radio signal generator, send and receive antennas etc. This chapter guides us into a more practical perspective of this investigation. At the beginning of this study, three types of chipsets from different manufactures were proposed: 1. ATWINC1500 from Atmel 2. ESP8266EX from ESPRESSIF 3. CC3200 from Texas Instrument Despite that these three chipsets are from completely different fabricants, they all share the same kind of main purpose: implement solutions to Internet of the Things (IoT). All of them are described as a low-power, highly-integrated Wi-Fi solution. These devices are normally implemented with acceptable CPU to process basic tasks, limited RAM memory to save data temporarily, reduced TCP/IP stack is implemented to allow developers built simple applications; such as read the current temperature in the room and forward it to an external server through Internet (using Wi-Fi in the Link-layer). Figure 8 Internet of the things Nevertheless, the design principal of these chipsets is to communicate small objects and control them through Internet. As explained before, there is a high
Implementation of a programmable Wi-Fi jammer 16 degree of liberty to create very different applications with common protocols like IP, TCP, UDP and HTTP. Due to their flexibility in the low layer control (PHY and Link Layer) and the easy accessibility with a very economic price; these chipsets almost become a nuclear weapon for hackers who want to initiate a DoS attack. It’s necessary to insist that, for the reason of the hardware limitation, a complete security coverage inside these devices could be a big challenge as secure protocols require more computational capacity and bigger memory space. This innate weakness makes the hacking process even more convenient. To choose the best chipset for our project, a summarized hardware introduction of each board is shown in the following: Atmel ATWINC1500: ATWINC1500 is a chip designed to adapt the IEEE 802.11 b/g/n standards. It’s optimized for low-power mobile solution and IoT. The chip operates at 2.4GHz ISM band with a FCS engine checks the CRC of Tx and Rx packets. It also implements a cipher engine, which performs all the required encryption and decryption operations for the WEP, WPA-TKIP, WPA2, CCMP-AES, WAPI. Furthermore, it works in different modulation: 802.11b with DSSS-CCK, 802.11g and 802.11n with OFDM. ATWINC1500 allow developers to use C as the main program language. Furthermore, Atmel Studio is a powerful Integrated Development Environment (IDE) with C/C++ compiler, Debugger and code editor. ATWINC1500B implements an APS3 32-bit processor, it performs many MAC functions such as association, authentication, power management, security key management and MSDU aggregation/de-aggregation etc. It also supports different modes of operations such as STA and AP modes. The core CPU uses 128KB instruction/boot ROM along with a 160KB instruction RAM and a 64KB data RAM. ATWINC1500 also has 4MB flash memory, which can be used for system software. In addition, the device uses a 12Bkb shared RAM, accessible by the processor and MAC. [7] In terms of power consumption, ATWINC1500 defines different states; each state has its own power consumption level. The following table shows the detail of the power consumption in each state:
Implementation Environment 17 Figure 9 current consumption ATWINC1500 ESP8266: Espressif’s ESP8266EX offers a highly integrated Wi-Fi SoC solution to complete users’ cautious demands for efficient power usage. ESP8266 has 2.4 to 2.5 GHz as its working frequency range. It adapts different 802.11 standards such as 802.11b/g/b/n/e/i. In order to optimize the tasks, it implements a hardware accelerator for CCMP (CBC-MAC, counter mode), TKIP (MIC, RC4), WAPI (SMS4), WEP (RC4), CRC. It also uses WEP, TKIP and AES algorithms for software encryption. The ESP chip works with several modulations such as CCK (802.11b), OFDM (802.11g) and MSC7 (802.11n). ). Espressif does not have its own IDE to develop the chip. Therefore, other C/C++ like Eclipse could be an alternative for the development; it also allows developers use the official Arduino IDE for the implementation and other environments such as javascript-based Node.js. ESP8266 implements Tensilica L106 32-bit processor and an ultra-low-power 16-bits RISC. CPU oscillates at 80 MHz up to the maximum value of 160 MHz. It integrates the memory controller and memory units, including SRAM and ROM. MCU can access the memory units through iBus, dBus and AHB
Implementation of a programmable Wi-Fi jammer 18 interfaces. Unfortunately, there is no programmable ROM in the chip. Therefore, the user program must be saved in and external SPI flash. [8] The following figure shows the power consumption of ESP8266 in different situation: Figure 10 Current consumption ESP8266 CC3200: SimpleLink CC3200 device is a wireless MCU that integrates a high-performance ARM Cortex-M4 MCU, allowing customers to develop a wide range of IoT solutions. CC3200 generates Wi-Fi signal at 2.4 GHz. It works with 3 different IEEE 802.11 standards: 802.11b/g/n. It implements hardware crypto engine for advanced fast security including: AES, DES,3DES, SHA2, MD5, CRC and checksum. Different modulation as DSSS, CCK, OFDM, MCS7 are used for 802.11b, 802.11g and 802.11n respectively. The high-performance ARM Cortex-M4 processor provides a low-coast platform that requires minimal memory implementation, reduced pin count, and low power consumption. CC3200 includes on-chip SRAM to which application programs are downloaded and executed, it provides up to 256KB of zero-wait- state, on-chip SRAM. CC3200 power consumption also differs depending on the state to optimize the chip performance. The following table shows a detail about the chip current consumption:
Implementation Environment 19 Figure 11 current consumption CC3200 So, to simplify the comparison, a table contents different hardware characteristic has been made: ATWINC1500 ESP8266 CC3200 802.11 standards b/g/n b/g/n b/g/n Power consumption 294(mA) 170(mA) 278(mA) Radio test tool No No Yes CCA override No Yes Yes Table 2 Chipsets comparison Obviously, all the chips are well designed to implement wireless IoT applications. However, due to our major objective, it’s necessary to deactivate the Clear Channel Assessment (CCA) option, which allows the chip to send information without proceeding with the CSMA/CA algorithm. So, the best candidate could be ESP8266 and CC3200. But the further investigation shows Texas Instrument has more detailed user guide documents and a very sophisticated API documentation with detailed examples to allow developers get familiar with the chip as fast as possible. Moreover, Texas Instrument has created an official forum where developers can find many chip related tutorials and, in terms of questions or doubts, there are many professional engineers, who offer answers and advises online. After all the analysis, we have decided to use CC3200 for our jammer implementation. 3.2. About TI CC3200 As commented in the previous section, CC3200 SimpleLink from Texas Instrument has been chosen as the best candidate for our jammer implementation. Before further development, a more detailed CC3200 chip description is given in this section.
Implementation of a programmable Wi-Fi jammer 26 Figure 18 Tera Term setup At this point, all tools for CC3200 development should be all successfully settled up. More details about IDE installation and pre-requirements could be found at this link: [12] 3.4. Quick start project 0 guide The objective of this section is to describe briefly how to build a demo project (“Hello World” equivalent) in CCS and running it on CC3200 chipset. Most of this section is based on this tutorial [13], which helps us to import a demo project from SDK, modify some part of the codes and try to build and compile the project. After the compilation, we execute the program and observe the result with a terminal. As the next figure indicates, the demo project performs an internet connectivity test to a TI server: Figure 19 demo scheme CC3200 chipset will set as Station mode and try to send ping to an external server. For this, it should be previously connected to the router connecting to the Internet network. To import the CSS project, SDK path should be indicated. In this case, the path is shown as below. Please adapt the project path for each case.
Implementation Environment 27 Figure 20 project path In order to build the project successfully, the following libraries should be imported from the SDK directory: - driverlib - oSlib - simplelink - ti_rtos_config - wlan_station Note: Do not check the option “copy project into workspace” for the importation. The demo project will be wlan_station and the other imported projects are needed as libraries for the correct compilation. After importing the project, it’s necessary to verify the project configuration. Therefore, go to “ti_rtos_config” project, right click, and click properties option as shown:
Implementation of a programmable Wi-Fi jammer 28 Figure 21 ti_rtos_config In the RTSC tab Verify that XDCtools uses the last version (see fig. 24(?)). Also make sure the target name and platform value are set as as shown in the figure24(?). A building project process should be performed after the previous configurations. simplelink project would the first project for building. For this, select the simplelink project and click Project option on CCS menu and then select the build project option: Figure 22 Build Project option Once that building process finishes, please repeat the same procedure to: 1. ti_rtos_config 2. driverlib 3. oslib It’s strongly recommended to build each project in the above order.
Implementation Environment 29 Now, after the code modification, just build the wlan_station project as before. For a correct debugging process, it’s important to set the target configuration (set the CC3200.ccxml as the default target for the debugging); for this, click view option on the CCS menu and then click the target configuration option>import target configuration. Find the correct path to the CC3200.ccxml file for the import: “Your CC3200 SDK path”\tools\ccs_patch\CC3200.ccxml Note: Please select the copy file option to do the import. Figure 23 target configuration option Please set the CC3200.ccxml as the default target for the debugging. At this point, the demo project is all prepared for debugging. To verify the correct functionality, it’s necessary to connect the CC3200 chipset and click the debug option on the CCS menu. If there is no compilation error, it will generate and executable binary file and automatically switch to the debug interface: Figure 24 demo Project debug interface
Implementation of a programmable Wi-Fi jammer 30 In order to visualize or interact with CC3200, Tera-term terminal has been used (monitoring messages and keyboard input). To connect between the terminal and the chip, simply select the Serial COM port where the chip is connected: Figure 25 Tera-term After the connection, the baud rate should be changed to 115200. Figure 26 Tera-term configuration So, if we want to connected to the router, we will have to modify some code in the demo project. To be more specific, we should edit the common.h file located at: wlan_station>inludes>example/common>common.h The following lines must be modified accordingly: Figure 27 common.h file It is necessary to know the name of the Wi-Fi network and put its value to SSID_NAME variable. Next, configure the security mechanism matching that of the router. For the most common case it should be WPA/WPA2. Obviously, you need to provide the security key to the demo project for the correct authentication.
Implementation Environment 31 If the project runs successfully on the chip, it will try to ping the router first and then ping a remote TI server trying to establish the internet connectivity. A similar dialog should be visualized in Tera-term as below: Figure 28 Demo Project final result
Constant Jammer 32 Chapter 4. Constant Jammer In this chapter, we are going to implement two types of constant jammer; first, we are going to create a jammer that sends beacon frames continuously. Then, TI radio tool will allow us to achieve the same goal. 4.1. Theoretical study At the first part of the jammer implementation, a constant jammer has been created to test the Wi-Fi channel interference by sending an 802.11 manage frames at a specific channel constantly. As mentioned in chapter 2, beacon frame is one of the significant 802.11 management frames that announces the presence of a WLAN network, provides association information and network capacity. Therefore, such frame is a good exploit point to start with our implementation. The main idea is forging beacon frames by the CC3200 and sending it through the 2.4GHz radio. Before programing the chip, it’s necessary to determinate the period or delay between frames to make the transmission continuously. The following figure shows a trace with a typical beacon frame: Figure 29 beacon frame As the above information shows, we could determinate that the Beacon frame size is typically around 254 bytes (changes slightly with AP model). In this study, all the frame transmissions are done at 2Mbits/s. Thus the period between consecutive frames should be: 𝑃𝑒𝑟𝑖𝑜𝑑 =𝐹𝑟𝑎𝑚𝑒 𝑠𝑖𝑧𝑒(𝑏𝑖𝑡𝑠)÷ 𝑇𝑟𝑎𝑛𝑠𝑚𝑖𝑠𝑠𝑖𝑜𝑛 𝑠𝑝𝑒𝑒𝑑 (𝑏𝑖𝑡𝑠 𝑠) Since beacon frames are broadcast and, hence, are not followed by an ACK frame. We could conclude the period should be: 𝑃𝑒𝑟𝑖𝑜𝑑 =254∗ 8 (𝑏𝑖𝑡𝑠) ÷2 ∙ 106(𝑏𝑖𝑡𝑠 𝑠)=0.001016 (𝑠)=1.016 (𝑚𝑠)
Implementation of a programmable Wi-Fi jammer 33 The APIs provided in TI CC3200 Software Development Kit (SDK), offer a delay function based on the inter clock. It converts cycles to seconds and pause the program execution. The delay function is: MAP_UtilsDelay (cycles); As the result of a constant test, we know that 4∙106 (cycles) correspond to 300 ms. So 𝐶𝑦𝑐𝑙𝑒𝑠 = 4∙106×𝐷𝑒𝑙𝑎𝑦 300 To determine the number of cycles corresponding to 1.016 ms of delay: 𝐶𝑦𝑐𝑙𝑒𝑠 = 4×106×1.016 300 = 4112000 300 ≈13547 (𝑐𝑦𝑐𝑙𝑒𝑠) As mentioned previously, in order to obtain the delay in microseconds, it’s necessary to know the correspond cycles and using function MAP_UtilsDelay () For this matter, we can obtain 1.028 microseconds like this: MAP_UtilsDelay (13547); 4.2. Implementation After the amount of preparations, we could now focus on the implementation part to develop our constant jammer. The entire program is based on a SDK example project called “Transceiver Mode” which allow us to communicate directly over the Wi-Fi PHY layer by using a raw socket. Mode detail information about the example project could be found on the link [15]. It’s very important to know that, with RAW sockets, the developer is responsible to generate the complete frame manually and sending it through the radio transmitter of the chip. So, a well-known data structure is a must to create our frames. As mentioned in chapter 1, each field of a beacon frame now has a significant meaning for us since we are going to manually create each field by using hexadecimal value. One smart thing to do is to capture an IEEE 802.11 level 2 traffic and dissect one beacon frame message, and reproduce it replacing the relevant values. In the figure 29 shows all the beacon frame fields, we should replace these important values such as transmitter address, source address, BSS ID etc. Catching all the information, we should be forging our own frame by creating a vector variable and putting each hexadecimal value. Each new field should be beginning in a new line. The following example is a handcrafted beacon frame:
Constant Jammer 34 Figure 30 a part of a beacon frame in hexadecimal value We define this vector as “RawData” and we send this variable using the following function: iSoc = sl_Socket(SL_AF_RF,SL_SOCK_RAW,iChannel); lRetVal = sl_Send(iSoc,RawData,sizeof(RawData),\ SL_RAW_RF_TX_PARAMS(iChannel, rate, iTxPowerLevel, PREAMBLE)); Before sending the data, it’s necessary to establish a Socket and configure it as “AF_RF” mode, which gains the radio access directly. After successfully having the socket, we should be sending our “RawData” through the socket and passing other parameters such as the channel, transmission rate and the power level. At the end, it’s important to close the socket using this function: lRetVal = sl_Close(iSoc); If the code works, CC3200 should be able to generate our “Raw Data” which is a fake beacon frame and directly sends it to a specific channel with a custom rate and power. Figure 31 beacon frame by CCS In wireshark, if there are beacon messages sent from “Texas_Ins”, it means our code has achieved its functionality.
Implementation of a programmable Wi-Fi jammer 35 4.3. constant jammer by TI radio tool After the amount of preparations, we could now focus on the implementation part to develop our constant jammer. In fact, as Texas Instrument provides different testing tools to simplify the development; a very useful radio testing tool is available to allow user check the chipset functionality in the PHY and Link layers. More information could be found on the official wiki page of the software [14]. Note: It’s indispensable to have the correct service pack for the corresponding version of radio testing tool!!! The following figure shows all the version and service pack information: Figure 32 radio tool version and service park information TI radio tool allows developer access to the radio directly in order to testing the PHY part of the chipset. After a success installation, the first run of the program should look like this: Figure 33 Radio Tool
Constant Jammer 42 Second strange phenomenon is the peak observed at 50 m. It’s difficult to determine the reason of such phenomenon. The result is very suspicious, which led us to repeat the experiment at the same point several times. However, the throughput still being higher than other surrounding points. After discussing such observation, we suppose that based on the geometrical form of the cellar, it produces a multipath scenario, reducing the jammer’s signal, which raise the throughput accidently. 4.3.3 Energy consumption test: In this experiment, we have measured the energy consumption of the constant jammer in different power levels and transmission rates since it’s important to know how these factors would affect the energy use. We have tested our chip sending data at 1Mbps and 2Mbps using three different power levels as the previous experiment. The following tables show the result of the constant jammer’s energy consumption, where each result is an average value during 100ms measurement using Agilent N6705A power analyzer [24] Energy consumption @ 1Mbps: Txp/Power(W) Results 0 0,87 (w) 7 0,63 (w) 15 0,61 (w) Table 7 constant jammer energy consumption @ 1Mbps Energy consumption @ 2Mbps: Txp/Power(W) Results 0 0,92 (w) 7 0,64 (w) 15 0,64 (w) Table 8 constant jammer energy consumption @ 2Mbps Note: All the results shown in the previous tables were measured in average values. Figure 43 constant jammer power consumption @ 2Mbps
Implementation of a programmable Wi-Fi jammer 43 In order to verify the constancy of the jammer, we have measured the time between frames and its probability. We have generated a Cumulative Distributed Function (CFD). In the figure 46, the constant jammer first transmits in a clear environment (i.e. no other transmitters) while running wireshark on a receiver. We can observe that no frames has a period inferior than 6 (ms). Which means each frames are sending constantly at 6 (ms). However, after we added our communication through Iperf, we can observe that there is a transition curve because other transmissions were possible during the jammer activity making the jamming frames reception not uniformly distributed as before. This explains why legitimate IEEE 802.11 transmissions are not completely prevented by the continuous jammer. Figure 44 CDF of time between consecutive frames received from the constant jammer 0 0,2 0,4 0,6 0,8 1 1,2 0 0,02 0,04 0,06 0,08 0,1 Probability Time(s) CDF Comparision CDF without iperf CDF with Iperf
Deceive Jammer 44 Chapter 5. Deceive jammer In this chapter, we are going to implement a deceive jammer. We also start analyzing some important background as a previous preparation. Then, we will concentrate in the implementation and development. Finally, we test our jammer with a set of experiments and conclude our result. 5.1. Theoretical study As mentioned in chapter 1, RTS/CTS are very important control messages for preventing “hidden node” problem. However, these messages could be exploited maliciously in order to produce a link layer DoS attack. More specifically, “duration” is the key field for such attack; it is coded with 16 bits and the value is expressed in microseconds, which indicates the amount of airtime the sending radio is reserving the channel for the pending frame and the acknowledgment. Radios on channel in earshot of this transmission (i.e. can demodulate this frame) will use this value in their NAV calculation. According to [16], the maximum value of duration field is 32767 microseconds; also a duration encoding table was provided to facilitate our further development. Figure 45 duration encoding table All the previous information give us a major help for our deceive jammer’s design and its mechanism. The objective is clear; forge gratuitous RTS/CTS messages and set duration field to the maximum value since we want to reserve a silent time as long as possible. Thus, all the devices who can decode this message will update their NAV value and hold their transmission since the channel supposed to be busy. In this way, it’s significant for us to know the maximum duration value in hexadecimal. In the previous figure, we can observe that duration is coded in 16 bits or 2 bytes; a valid duration value in microseconds must set the last bit into zero. In order to code the Duration Field correctly, we have to be aware of the endianness of the system, so the order of the bytes written needs to be carefully chosen.
Implementation of a programmable Wi-Fi jammer 45 Figure 46 reading order from left to right Figure 47 reading order from right to left After some observations in wireshark, we have determinate that the second figure is the correct reading order. Above binary value in hexadecimal would be FFF7 Unfortunately, FFF7 is not the correct value to interpret 32767 (ms). This occurs because. It reads following the little endian criteria with least significant bit first. So, this leads the byte interpreted as 0xFF 0x7F. Figure 48 maximum duration in CTS frame 5.2. Implementation The implementation of deceive jammer follows the same idea of the constant jammer using the same type of socket and sending data whereby using the same function. The only difference here is that we generate a legitimate (apparently) CTS frame as our raw data; CTS frames have a very simple structure compared to beacon frames: Figure 49 CTS frames in hexadecimal As we can see in the figure, duration has been defined in the third row. For different duration just change this field and leave the rest idem.
Deceive Jammer 46 The successful execution of the jammer leads forged CTS frames appear in our network as the following wireshark capture shows: Figure 50 CTS frames generated by CC3200 5.3. Evaluation We keep the same evaluation methods to test our deceive jammer: 1. Configuring different parameters to find the maximum damage point 2. Testing the effectiveness in different power level at different distance 3. Evaluates the different power consumption at different power level Note: All the experiments including the ideal measurement are realized in a cellar where could consider an isolated space with low Wireless interference. 5.3.1 Jammer efficiency test: Deceive jammer has two configurable variables, value of duration field and delay (time between consecutive packets). In this experiment, we have tried different combinations of these variables with maximum transmission power for the purpose of finding the maximum damage. We set eight different delay (De) values for each duration value (Du). Our principle is to set De close to Du. The following figure brings us the result of this experiment: We have used five different duration values from the maximum (32ms) to small values like 4 or 2 ms in order to test how the effectiveness changes while we vary those parameters. In general, we could observe that throughput decreases when the De is very close or similar to Du. In case of Du = De, we are completely blocking the communication; Iperf server and client are totally disconnected from AP and couldn’t even find the corresponding SSID in the network list. This is due to the fact that our CTS messages has reserved the target channel for 32 ms but no transmissions were really carried out. After 32 ms, it resends the same frame to block the channel again until the network is absolutely congested. Such jamming wouldn’t even allow APs to send beacon frames that makes the target network undiscoverable and unreachable.
Implementation of a programmable Wi-Fi jammer 47 Figure 51 deceive jammer effectiveness test 5.3.2 jammer distance test: In this experiment, we use the same method as we did with the constant jammer. We set eight different points; each point tested with three different power levels. Our goal is to determinate how is the jammer performance under a variation of the parameters above. The following table shows the test result: Txp(level)/Distance(m) 15 24,4 35 48 52 57,6 67,2 105 0 5,21 5,79 5,91 5,70 6,37 7,63 8,88 32,31 7 5,98 5,56 6,45 5,58 4,98 15,49 7,43 31,75 15 5,85 4,91 5,90 5,24 6,32 9,16 6,84 31 Table 9 deceive jammer Distance test result Note: transmission power Txp unit is defined in the chipset datasheet, where 0 level is the maximum transmission power and 15 is the minimum. All the throughput results are in Mbits/s 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 024681012141618202224262830323436384042444648505254565860 ThroughPut (Kbits/s) Delay (ms) Throughput VS Duration CTS duration = 32(ms) CTS duration = 16(ms) CTS duration = 8(ms) CTS duration = 4(ms) CTS duration = 2(ms)
Deceive Jammer 48 Figure 52 deceive jammer distance test result In the previous result, we can notice that in the longest distance (105 m), the system is operates close to the maximum throughput, which means, our deceive jammer is not affecting the network. As we mentioned in the previous chapter, in such long distance, jammer’s frames become only background noise with the potential of being really harmful. However, deceive jammer doesn’t transmit constantly, this added noise doesn’t cause a significant damage as constant jammer does. 5.3.3 Energy consumption test: We have tested our chip sending data at 1Mbps and 2Mbps using three different power levels as the previous experiment. The following tables show the result of the constant jammer’s energy consumption, where each result is an average value during 1-minute measurement using Agilent N6705A power analyzer [24] Energy consumption @ 1Mbps: Txp/Power(W) Results 0 0,089 (w) 7 0,084 (w) 15 0,083 (w) Table 10 deceive jammer energy consumption @ 1Mbps Energy consumption @ 2Mbps: Txp/Power(W) Results 0 0,084 (w) 7 0,082 (w) 15 0,083 (w) Table 11 deceive jammer energy consumption @ 2Mbps 0 5 10 15 20 25 30 35 020 40 60 80 100 120 ThroughPut(Kbit/s) Distance(m) Distance VS ThroughPut ThroughPut @0Txp ThroughPut @7Txp ThroughPut @15Txp
Implementation of a programmable Wi-Fi jammer 49 Note: All the results shown in the previous tables were measured in average values. Figure 53 deceive jammer power consumption @ 2Mbps After the power consumption of both type of jammers, we have made a comparison using the above results: Figure 54 constant jammer vs deceive jammer @1Mbps 0 0,1 0,2 0,3 0,4 0,5 0,6 0,7 0,8 0,9 1 0 7 15 Watts Power level Constant jammer VS Deceive jammer @ 1Mbps constant jammer @ 1Mbps Deceive jammer @ 1Mbps
Deceive Jammer 50 Figure 55 constant jammer vs deceive jammer @2Mbps We could see that deceive jammer is very efficient in terms of power consumption due to its periodic frame transmission. This result plays a significant role in the jammer evaluation since it affects our jammer’s life cycle. (More optimal in power consumption, longer life cycle jammer will have). For example, assuming that our external battery has 2,6 watts-hour (Wh) and our deceive jammer consumes 0,082 (w).This leads to an 31,70 hours working time. Figure 56 CC3200 with external power supply 0 0,1 0,2 0,3 0,4 0,5 0,6 0,7 0,8 0,9 1 0 7 15 Watts Power level Constant jammer VS Deceive jammer @ 2Mbps constant jammer @ 2Mbps Deceive jammer @ 2Mbps
Conclusion 51 Conclusion: In the end of this study, I would love to remark all the important points that we have gone through during this investigation. We have achieve the initial goal as proposed at the beginning as this document demonstrates the security issues of actual Wi-Fi devices and such problem is becoming a considerable threat since the huge amount of devices connecting the Internet using this technology. In order to reach the objective, we have first analyzed our project theoretically introducing some basic concepts of IEEE 802.11 standard both the historical and the technical. This leads to us to know that the current implementation has some vulnerabilities, which can be used with malicious intentiosn. We also exploited some control messages like Beacon frame and CTS/RTS, how they works and why it’s necessary to use these messages in a Wi-Fi network. In the technical part, we have chosen CC3200 of Texas Instrument to implement our jammer because of its stunning computational capacity, low power consumption and a wide range of programming guides and examples offered in the official web site. As a contribution, we have also made a step-by- step tutorial to build our demo project using code compose studio. In addition, we have made two types of jammer coding our chip; constant jammer and deceive jammer. Both devices have caused serious interferences to the target channel. Furthermore, a set of experiments have been designed to test the limit and efficiency of both jammers. We first have configured our chip in order to maximize the damage. We have known from this experiment that constant jammer will have the maximum damage if we maximize the size of the payload. For deceive jammer, we can jam the entire system if we configure properly the duration field of RTS/CTS frames and the periodicity of those frames. After we have tested how distance and transmission power will affect our jammer’s performance. In this experiment, we have noticed a very interesting phenomenon, which the worst throughput of the constant jammer was found in the longest distance. This happens because jammer’s signal couldn’t be decoded successfully, it simply converts to an extra noise that interferes the channel. Finally, we have tested the power consumption in both devices. In this experiment, we have observed that constant jammer is very inefficient due to its constant transmission and accessing the radio continuously. On the other hand, the deceive jammer saves 10 times energy than constant jammer as it transmits periodically. In the end, it was a very interesting project, which I could apply all the knowledge I have learnt from the career (signal analysis, network monitoring, programming etc.). It would be an interesting point to investigate other possible jammer implementations in the future such as a reactive jammer, which only initialize
Annex 58 0xdd, 0x1c, 0x00, 0x50, 0xf2, 0x01, 0x01, 0x00, 0x00, 0x50, 0xf2, 0x02, 0x02, 0x00, 0x00, 0x50, 0xf2, 0x04, 0x00, 0x50, 0xf2, 0x02, 0x01, 0x00, 0x00, 0x50, 0xf2, 0x02, 0x0c, 0x00, 0xdd, 0x18, 0x00, 0x50, 0xf2, 0x02, 0x01, 0x01, 0x80, 0x00, 0x03, 0xa4, 0x00, 0x00, 0x27, 0xa4, 0x00, 0x00, 0x42, 0x43, 0x5e, 0x00, 0x62, 0x32, 0x2f, 0x00, 0x00,0x00,0x60,0x20}; //fabricamos un CTS /*char RawData[] = { //---- wlan header start -----// 0xc4, 0x00, 0xFF, 0x7F, //duration field 0xF4, 0xB8, 0x5E, 0x04, 0xF5, 0x7C, 0x00, 0x00, 0x00, 0x20}; //---YFG+15-09-2016+FIN*/ //correct RTS /*char RawData[] = { //Fabricamos un beacon //fabricamos un RTS 0xb4, 0x00, 0xFF, 0x7F, 0x58, 0x23, 0x8C, 0x04,0x89, 0x9B, 0xF4, 0xB8, 0x5E, 0x04,0xF5, 0x7D, 0x00, 0x20, 0x00, 0x00};*/ //---YFG+15-09-2016+FIN #if defined(ccs) extern void (* const g_pfnVectors[])(void); #endif #if defined(ewarm) extern uVectorEntry __vector_table; #endif //*************************************************************************** ** // GLOBAL VARIABLES -- End //*************************************************************************** ** //*************************************************************************** * // LOCAL FUNCTION PROTOTYPES //*************************************************************************** * static UserIn UserInput(); static int Tx_continuous(int iChannel,SlRateIndex_e rate,int iNumberOfPackets,\ int iTxPowerLevel,long dIntervalMiliSec); static int RxStatisticsCollect(); static void DisplayBanner(char * AppName); static void BoardInit(void);
Implementation of a programmable Wi-Fi jammer 59 //*************************************************************************** ** // SimpleLink Asynchronous Event Handlers -- Start //*************************************************************************** ** //*************************************************************************** ** // //! \brief The Function Handles WLAN Events //! //! \param[in] pWlanEvent - Pointer to WLAN Event Info //! //! \return None //! //*************************************************************************** ** void SimpleLinkWlanEventHandler(SlWlanEvent_t *pWlanEvent) { switch(pWlanEvent->Event) { case SL_WLAN_CONNECT_EVENT: { SET_STATUS_BIT(g_ulStatus, STATUS_BIT_CONNECTION); // // Information about the connected AP (like name, MAC etc) will be // available in 'slWlanConnectAsyncResponse_t' - Applications // can use it if required // // slWlanConnectAsyncResponse_t *pEventData = NULL; // pEventData = &pWlanEvent->EventData.STAandP2PModeWlanConnected; // // Copy new connection SSID and BSSID to global parameters memcpy(g_ucConnectionSSID,pWlanEvent->EventData. STAandP2PModeWlanConnected.ssid_name, pWlanEvent->EventData.STAandP2PModeWlanConnected.ssid_len); memcpy(g_ucConnectionBSSID, pWlanEvent->EventData.STAandP2PModeWlanConnected.bssid, SL_BSSID_LENGTH); UART_PRINT("[WLAN EVENT] STA Connected to the AP: %s , " "BSSID: %x:%x:%x:%x:%x:%x\n\r", g_ucConnectionSSID,g_ucConnectionBSSID[0], g_ucConnectionBSSID[1],g_ucConnectionBSSID[2], g_ucConnectionBSSID[3],g_ucConnectionBSSID[4], g_ucConnectionBSSID[5]); } break; case SL_WLAN_DISCONNECT_EVENT: { slWlanConnectAsyncResponse_t* pEventData = NULL; CLR_STATUS_BIT(g_ulStatus, STATUS_BIT_CONNECTION);
Annex 60 CLR_STATUS_BIT(g_ulStatus, STATUS_BIT_IP_AQUIRED); pEventData = &pWlanEvent->EventData.STAandP2PModeDisconnected; // If the user has initiated 'Disconnect' request, //'reason_code' is SL_WLAN_DISCONNECT_USER_INITIATED_DISCONNECTION if(SL_WLAN_DISCONNECT_USER_INITIATED_DISCONNECTION == pEventData- >reason_code) { UART_PRINT("[WLAN EVENT]Device disconnected from the AP: %s," " BSSID: %x:%x:%x:%x:%x:%x on application's" " request \n\r", g_ucConnectionSSID,g_ucConnectionBSSID[0], g_ucConnectionBSSID[1],g_ucConnectionBSSID[2], g_ucConnectionBSSID[3],g_ucConnectionBSSID[4], g_ucConnectionBSSID[5]); } else { UART_PRINT("[WLAN ERROR]Device disconnected from the AP AP: %s," " BSSID: %x:%x:%x:%x:%x:%x on an ERROR..!! \n\r", g_ucConnectionSSID,g_ucConnectionBSSID[0], g_ucConnectionBSSID[1],g_ucConnectionBSSID[2], g_ucConnectionBSSID[3],g_ucConnectionBSSID[4], g_ucConnectionBSSID[5]); } memset(g_ucConnectionSSID,0,sizeof(g_ucConnectionSSID)); memset(g_ucConnectionBSSID,0,sizeof(g_ucConnectionBSSID)); } break; default: { UART_PRINT("[WLAN EVENT] Unexpected event [0x%x]\n\r", pWlanEvent->Event); } break; } } //*************************************************************************** ** // //! \brief This function handles network events such as IP acquisition, IP //! leased, IP released etc. //! //! \param[in] pNetAppEvent - Pointer to NetApp Event Info //! //! \return None //! //*************************************************************************** ** void SimpleLinkNetAppEventHandler(SlNetAppEvent_t *pNetAppEvent) { switch(pNetAppEvent->Event) { case SL_NETAPP_IPV4_IPACQUIRED_EVENT:
Implementation of a programmable Wi-Fi jammer 61 { SlIpV4AcquiredAsync_t *pEventData = NULL; SET_STATUS_BIT(g_ulStatus, STATUS_BIT_IP_AQUIRED); //Ip Acquired Event Data pEventData = &pNetAppEvent->EventData.ipAcquiredV4; //Gateway IP address g_ulGatewayIP = pEventData->gateway; UART_PRINT("[NETAPP EVENT] IP Acquired: IP=%d.%d.%d.%d , " "Gateway=%d.%d.%d.%d\n\r", SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.ip,3), SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.ip,2), SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.ip,1), SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.ip,0), SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.gateway,3), SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.gateway,2), SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.gateway,1), SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.gateway,0)); } break; default: { UART_PRINT("[NETAPP EVENT] Unexpected event [0x%x] \n\r", pNetAppEvent->Event); } break; } } //*************************************************************************** ** // //! \brief This function handles HTTP server events //! //! \param[in] pServerEvent - Contains the relevant event information //! \param[in] pServerResponse - Should be filled by the user with the //! relevant response information //! //! \return None //! //*************************************************************************** * void SimpleLinkHttpServerCallback(SlHttpServerEvent_t *pHttpEvent, SlHttpServerResponse_t *pHttpResponse) { // Unused in this application } //*************************************************************************** ** // //! \brief This function handles General Events //! //! \param[in] pDevEvent - Pointer to General Event Info
Annex 62 //! //! \return None //! //*************************************************************************** ** void SimpleLinkGeneralEventHandler(SlDeviceEvent_t *pDevEvent) { // // Most of the general errors are not FATAL are are to be handled // appropriately by the application // UART_PRINT("[GENERAL EVENT] - ID=[%d] Sender=[%d]\n\n", pDevEvent->EventData.deviceEvent.status, pDevEvent->EventData.deviceEvent.sender); } //*************************************************************************** ** // //! This function handles socket events indication //! //! \param[in] pSock - Pointer to Socket Event Info //! //! \return None //! //*************************************************************************** ** void SimpleLinkSockEventHandler(SlSockEvent_t *pSock) { // // This application doesn't work w/ socket - Events are not expected // } //*************************************************************************** ** // SimpleLink Asynchronous Event Handlers -- End //*************************************************************************** ** //*************************************************************************** ** // //! \brief This function initializes the application variables //! //! \param None //! //! \return None //! //*************************************************************************** ** static void InitializeAppVariables() { g_ulStatus = 0; g_ulGatewayIP = 0;
Implementation of a programmable Wi-Fi jammer 63 memset(g_ucConnectionSSID,0,sizeof(g_ucConnectionSSID)); memset(g_ucConnectionBSSID,0,sizeof(g_ucConnectionBSSID)); } //*************************************************************************** ** //! \brief This function puts the device in its default state. It: //! - Set the mode to STATION //! - Configures connection policy to Auto and AutoSmartConfig //! - Deletes all the stored profiles //! - Enables DHCP //! - Disables Scan policy //! - Sets Tx power to maximum //! - Sets power policy to normal //! - Unregister mDNS services //! - Remove all filters //! //! \param none //! \return On success, zero is returned. On error, negative is returned //*************************************************************************** ** static long ConfigureSimpleLinkToDefaultState() { SlVersionFull ver = {0}; _WlanRxFilterOperationCommandBuff_t RxFilterIdMask = {0}; unsigned char ucVal = 1; unsigned char ucConfigOpt = 0; unsigned char ucConfigLen = 0; unsigned char ucPower = 0; long lRetVal = -1; long lMode = -1; lMode = sl_Start(0, 0, 0); ASSERT_ON_ERROR(lMode); // If the device is not in station-mode, try configuring it in stationmode if (ROLE_STA != lMode) { if (ROLE_AP == lMode) { // If the device is in AP mode, we need to wait for this event // before doing anything while(!IS_IP_ACQUIRED(g_ulStatus)) { #ifndef SL_PLATFORM_MULTI_THREADED _SlNonOsMainLoopTask(); #endif } } // Switch to STA role and restart lRetVal = sl_WlanSetMode(ROLE_STA); ASSERT_ON_ERROR(lRetVal); lRetVal = sl_Stop(0xFF); ASSERT_ON_ERROR(lRetVal);
Annex 64 lRetVal = sl_Start(0, 0, 0); ASSERT_ON_ERROR(lRetVal); // Check if the device is in station again if (ROLE_STA != lRetVal) { // We don't want to proceed if the device is not coming up in STA-mode return DEVICE_NOT_IN_STATION_MODE; } } // Get the device's version-information ucConfigOpt = SL_DEVICE_GENERAL_VERSION; ucConfigLen = sizeof(ver); lRetVal = sl_DevGet(SL_DEVICE_GENERAL_CONFIGURATION, &ucConfigOpt, &ucConfigLen, (unsigned char *)(&ver)); ASSERT_ON_ERROR(lRetVal); UART_PRINT("Host Driver Version: %s\n\r",SL_DRIVER_VERSION); UART_PRINT("Build Version %d.%d.%d.%d.31.%d.%d.%d.%d.%d.%d.%d.%d\n\r", ver.NwpVersion[0],ver.NwpVersion[1],ver.NwpVersion[2],ver.NwpVersion[3], ver.ChipFwAndPhyVersion.FwVersion[0],ver.ChipFwAndPhyVersion.FwVersion[1], ver.ChipFwAndPhyVersion.FwVersion[2],ver.ChipFwAndPhyVersion.FwVersion[3], ver.ChipFwAndPhyVersion.PhyVersion[0],ver.ChipFwAndPhyVersion.PhyVersion[1], ver.ChipFwAndPhyVersion.PhyVersion[2],ver.ChipFwAndPhyVersion.PhyVersion[3]); // Set connection policy to Auto + SmartConfig // (Device's default connection policy) lRetVal = sl_WlanPolicySet(SL_POLICY_CONNECTION, SL_CONNECTION_POLICY(1, 0, 0, 0, 1), NULL, 0); ASSERT_ON_ERROR(lRetVal); // Remove all profiles lRetVal = sl_WlanProfileDel(0xFF); ASSERT_ON_ERROR(lRetVal); // // Device in station-mode. Disconnect previous connection if any // The function returns 0 if 'Disconnected done', negative number if already // disconnected Wait for 'disconnection' event if 0 is returned, Ignore // other return-codes // lRetVal = sl_WlanDisconnect(); if(0 == lRetVal) { // Wait while(IS_CONNECTED(g_ulStatus)) { #ifndef SL_PLATFORM_MULTI_THREADED _SlNonOsMainLoopTask(); #endif }
Implementation of a programmable Wi-Fi jammer 65 } // Enable DHCP client lRetVal = sl_NetCfgSet(SL_IPV4_STA_P2P_CL_DHCP_ENABLE,1,1,&ucVal); ASSERT_ON_ERROR(lRetVal); // Disable scan ucConfigOpt = SL_SCAN_POLICY(0); lRetVal = sl_WlanPolicySet(SL_POLICY_SCAN , ucConfigOpt, NULL, 0); ASSERT_ON_ERROR(lRetVal); // Set Tx power level for station mode // Number between 0-15, as dB offset from max power - 0 will set max power ucPower = 0; lRetVal = sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, WLAN_GENERAL_PARAM_OPT_STA_TX_POWER, 1, (unsigned char *)&ucPower); ASSERT_ON_ERROR(lRetVal); // Set PM policy to normal lRetVal = sl_WlanPolicySet(SL_POLICY_PM , SL_NORMAL_POLICY, NULL, 0); ASSERT_ON_ERROR(lRetVal); // Unregister mDNS services lRetVal = sl_NetAppMDNSUnRegisterService(0, 0); ASSERT_ON_ERROR(lRetVal); // Remove all 64 filters (8*8) memset(RxFilterIdMask.FilterIdMask, 0xFF, 8); lRetVal = sl_WlanRxFilterSet(SL_REMOVE_RX_FILTER, (_u8 *)&RxFilterIdMask, sizeof(_WlanRxFilterOperationCommandBuff_t)); ASSERT_ON_ERROR(lRetVal); lRetVal = sl_Stop(SL_STOP_TIMEOUT); ASSERT_ON_ERROR(lRetVal); InitializeAppVariables(); return lRetVal; // Success } //*************************************************************************** ** // //! Application startup display on UART //! //! \param AppName //! //! \return none //! //*************************************************************************** ** static void DisplayBanner(char * AppName) { UART_PRINT("\n\n\n\r"); UART_PRINT("\t\t *************************************************\n\r"); UART_PRINT("\t\t\t CC3200 %s Application \n\r", AppName);
Annex 66 UART_PRINT("\t\t *************************************************\n\r"); UART_PRINT("\n\n\n\r"); } //*************************************************************************** ** // //! Board Initialization & Configuration //! //! \param None //! //! \return None // //*************************************************************************** ** static void BoardInit(void) { /* In case of TI-RTOS vector table is initialize by OS itself */ #ifndef USE_TIRTOS // // Set vector table base // #if defined(ccs) MAP_IntVTableBaseSet((unsigned long)&g_pfnVectors[0]); #endif #if defined(ewarm) MAP_IntVTableBaseSet((unsigned long)&__vector_table); #endif #endif // // Enable Processor // MAP_IntMasterEnable(); MAP_IntEnable(FAULT_SYSTICK); PRCMCC3200MCUInit(); } //*************************************************************************** ** // //! UserInput //! //! This function //! 1. Function for reading the user input. //! //! \return none // //*************************************************************************** ** static UserIn UserInput() { UserIn User; //el char array que guarda los datos que escribe el usuario por la consola, tamany maximo 521 bits (0-511) char acCmdStore[512];
Implementation of a programmable Wi-Fi jammer 67 int iRetVal; //el valor inicial para el bucler int iRightInput = 0; //---YFG+06-10-2016+INI UART_PRINT("Starting Jammer... "); UART_PRINT("\n\r"); //forzamos que solo hay una opción una vez ejecutar el menu principal... User.choice = 1; //---YFG+06-10-2016+FIN if (User.choice == 1) { /*channel*/ do { UART_PRINT("Enter the jamming channel [1:13]: "); iRetVal = GetCmd(acCmdStore, sizeof(acCmdStore)); if(iRetVal == 0) { // // No input. Just an enter pressed probably. Display a prompt. // UART_PRINT("\n\rEnter Valid Input."); iRightInput = 0; } else { User.channel = (int)strtoul(acCmdStore,0,10); if(User.channel <= 0 || User.channel > 13) { UART_PRINT("\n\rWrong Input"); iRightInput = 0; } else { iRightInput = 1; } } UART_PRINT("\r\n"); }while(!iRightInput); /*Number of packets*/ do { UART_PRINT("Enter the number of packets to send : "); iRetVal = GetCmd(acCmdStore, sizeof(acCmdStore)); if(iRetVal == 0) { // // No input. Just an enter pressed probably. Display a prompt. // UART_PRINT("\n\rEnter Valid Input."); iRightInput = 0; } else { User.packets = (int)strtoul(acCmdStore,0,10); //No se puede enviar mas de 65535 paquetes...
Annex 74 // envia raw data constante... lRetVal = Tx_continuous(User.channel,User.rate,User.packets, \ User.Txpower,0); if(lRetVal < 0) { UART_PRINT("Error during transmission of raw data\n\r"); LOOP_FOREVER(); } UART_PRINT("\n\rEnter \"1\" to restart or \"0\" to quit: "); // // Wait to receive a character over UART // cChar = MAP_UARTCharGet(CONSOLE); // // Echo the received character // MAP_UARTCharPut(CONSOLE, cChar); UART_PRINT("\n\r"); iFlag = atoi(&cChar); } UART_PRINT("\r\nEnding the application...."); // // power off network processor // lRetVal = sl_Stop(SL_STOP_TIMEOUT); LOOP_FOREVER(); } //*************************************************************************** ** // // Close the Doxygen group. //! @} // //*************************************************************************** **