{"id":2186,"date":"2016-02-07T19:20:44","date_gmt":"2016-02-07T19:20:44","guid":{"rendered":"https:\/\/zed.inguardians.com\/?p=2186"},"modified":"2019-02-07T20:15:30","modified_gmt":"2019-02-07T20:15:30","slug":"grc-transmission-analysis-getting-to-the-bytes","status":"publish","type":"post","link":"https:\/\/zed.inguardians.com\/blog\/grc-transmission-analysis-getting-to-the-bytes\/","title":{"rendered":"GRC Transmission Analysis: Getting To the Bytes"},"content":{"rendered":"
Post Author: Don C. Weber [Twitter:\u00a0@cutaway<\/a>] I have not picked up my\u00a0HackRF Jawbreaker<\/a>\u00a0in a while (Figure 0x0). Family and billable work trump side projects. Lucky for me\u00a0Tom Liston<\/a>\u00a0and I started teaching the\u00a0Assessing and Exploiting Control Systems<\/a>class which leverages the\u00a0Samurai Project’s Security Testing Framework for Utilities (SamuraiSTFU)<\/a>. I say \u201clucky\u201d because I have a few updates I want to work into the courseware that center around improving the\u00a0GNU Radio Companion (GRC)<\/a>\u00a0frequency analysis labs. Even with the SamuraiSTFU updates I still found myself busy. I kept putting this off until\u00a0Jay Radcliffe<\/a>\u00a0asked me to take another look at a radio capture he had grabbed from his insulin monitor\/pump setup. He wanted to see if we could use GRC pull the transmitted data out of the air and into a file as I had done a couple months before with RFcat.<\/p>\n <\/a><\/p>\n Figure 0x0: HackRF Jawbreaker<\/p>\n Both of these projects had a similar issue: we were having difficulty moving from the captured radio transmission to actual demodulated data representing a \u201cpacket\u201d of bytes. There are several reasons for this predicament, but the biggest issue is the recent advances to GRC. The rapid development and growth of the GRC code over the last year has been staggering. All of my old GRC files use blocks that are listed as \u201cOld\u201d or the blocks that do not appear in the main GRC window at all. The most frustrating case, of course, is when the blocks don\u2019t appear at all because I have to try to remember what I was trying to accomplish a year ago. Imagine opening up a script you wrote a year ago (one you didn\u2019t really fully understand at the time) only to find out that fifty percent of the functions had been deleted, seemingly at random.<\/p>\n Another general issue related to proper signal processing is that each block has its own parameters that are specific to efficient processing of the signal into a demodulated state. For those of us who are not radio engineers and do not work with GRC every day, understanding these parameters is extremely difficult. If you don\u2019t understand exactly what they do, how can you know how some of these parameter values are obtained or modified? Let\u2019s face it, there is a LOT of math involved with frequency analysis and demodulation. Fortunately, tools like GRC exist to do the majority of the difficult math for us. However, many of these math functions require very specific values so that the results of the computations are accurate for the specific signals being analyzing.<\/p>\n Like everyone else, my family and billable work issues never let up. Thus, I found myself, as most of us do, working deep into the night on these \u201cside projects.\u201d Here are a few things I learned \u2013 by asking questions, reading blogs, using default settings, and (in true hacker fashion) guessing through trial-and-error.<\/p>\n Before we start, I have created a white paper for those people who are impatient, do not like the conversational tone of a blog post, or want to have this information in a document to read and pass around:Converting Radio Signals to Data Packets<\/a>. Additionally, for quick reference, I will be using a tool called\u00a0GRC Bit Converter<\/a>\u00a0to help analyze and print the captured data.<\/p>\n When using a HackRF or one of the many RTL-SDR dongles there is a large spike at the center frequency to which the radio has been tuned. This is the Direct Current (DC) spike (demonstrated using\u00a0SDR#<\/a>\u00a0in Figure 0x1), that occurs naturally in radios that have not specifically accounted for this spike via hardware \/ firmware. The HackRF team does a great job explaining why this occurs and what can be done with it in their website\u2019s\u00a0Frequently Asked Questions (FAQ)<\/a>.<\/p>\n <\/a><\/p>\n Figure 0x0: HackRF Jawbreaker’s DC Spike<\/p>\n As described in the HackRF FAQ, the DC spike can simply ignore it. However, because I have had a hard time successfully demodulating the signals recently, I want my data to be as clean as possible (yes, I am probably a little naive, but learning this also method helps when I \u201cdo\u201d need it).<\/p>\n To avoid the DC Spike, I like to create my captures by leveraging the \u201cDC Offset\u201d method. Capturing with an offset is easy enough to understand and easy to accomplish with the currently available GRC blocks. The challenge here is to select an offset that moves our DC Spike outside of our source\u2019s transmitted signal while still staying within the bandwidth that is being captured. There are two methods can be leveraged to determine this offset. The first is to conduct data sheet analysis to determine the radio and devices capabilities. These documents will outline \u201cChannel Spacing.\u201d The channel spacing is the distance between the center frequencies of two transmission areas configurable by the radio. While this helps, and is often enough information to adjust for the DC Spike, the channel spacing is not necessarily related to the size of the transmission. We see this in Wi-Fi which has fourteen (14) channels but the transmission of a wireless adapter will engulf approximately six (6) of those channels. To compensate for this possibility I use spectrum analysis software, as shown in Figure 0x2.<\/p>\n <\/a><\/p>\n Figure 0x2: DC Spike Inside TX Signal<\/p>\n The spectrum analyzer allows me to visually select a frequency in an area outside the transmission. Once I have selected a frequency, I note the distance between them and configure my GRC variable blocks appropriately. In this example I will add a variable block named \u201cchannel_spacing.\u201d This allows me to configure the Frequency Offset in another variable block, named \u201cfreq_offset\u201d, with the equation: “(channel_spacing \/ 2) * (channel_spacing * .1)<\/i>“. Dividing the channel spacing by two gives me the distance from the center frequency to the edge of the transmission. Using this number should move the DC Spike to the very edge of the transmission. Adding an additional 10 percent to this offset \u201cshould\u201d move it completely outside the transmission. Figure 0x3 demonstrates the \u201cfreq_offset\u201d variable block configuration and Figure 0x4 shows how it is implemented within the source block.<\/p>\n <\/a><\/p>\n Figure 0x3: GRC “freq_offset” Variable Block Configuration<\/p>\n \n <\/a><\/p>\n Figure 0x4: GRC “osmocom Source” Block Configuration<\/p>\n Once this is all configured, each of the blocks in the primary GRC window will display the computed values after doing the math for us. Each of these values is shown in Figure 0x5.<\/p>\n
\nDate Published: 15 May 2014<\/p>\nManaging Direct Current Spike<\/h2>\n