Bug bounty: Kill the 'Cyan flash of death'

I’m working on a project and found lots of great information on this data stream. I also purchased some Adafruit CC3000 chips and was able to port functionality from that code into a solution that worked for me. Hopefully it will work for you, too. I’m not a professional developer, so please forgive sloppy formatting. BSD license applies.

    typedef struct Result_Struct{
        uint32_t        num_networks;
        uint32_t        scan_status;
        uint8_t         rssiByte;
        uint8_t         Sec_ssidLen;
        uint16_t        time;
        uint8_t         ssid_name[32];
        uint8_t         bssid[6];
    } ResultStruct_t;       /**!ResultStruct_t : data struct to store SSID scan results */
    
    void structSSID(){
    char ssidname[32];
    ResultStruct_t SSIDScanResultBuff;
    int res = (wlan_ioctl_get_scan_results(0, (uint8_t* ) &SSIDScanResultBuff)); //loads results into struct
    if (res != 0) {
        Serial.println("Could not get WiFi Scan results.");
        }
    int index = SSIDScanResultBuff.num_networks;
    int i = 0;
    while (i<index){
        int _rssi = (SSIDScanResultBuff.rssiByte >> 1);
        int _mode = (SSIDScanResultBuff.Sec_ssidLen & (~0xFC));
        uint8_t ssidLen = (SSIDScanResultBuff.Sec_ssidLen >> 2);
        strncpy(ssidname, (char *)SSIDScanResultBuff.ssid_name, 
          ssidLen);
        ssidname[ssidLen] = 0;
        long rssi = _rssi-128;	
        String myrssi = String(rssi, (unsigned char)DEC);
        String encrypted = "";
        switch (_mode) {
    		case 0:
    		    encrypted = "OPEN";
    			break;
    		case 1:
    		    encrypted = "WEP";
    			break;
    		case 2:
    		    encrypted = "WPA";
    			break;
    		case 3:
    		    encrypted = "WPA2";
    			break;
    	}
    	String SSID = ssidname;
    	String results = SSID + "," + myrssi + "," + encrypted;
    	Serial.println(results);
    	int res1 = (wlan_ioctl_get_scan_results(0, (uint8_t* ) 
            &SSIDScanResultBuff)); //iterates the buffer
    	if (res1 != 0) Serial.println("Get Scan Results iteration 
            failed");
    	i++;
        }
    }
1 Like