Skip to content

Commit

Permalink
move to folder
Browse files Browse the repository at this point in the history
  • Loading branch information
fulldecent committed Mar 4, 2016
2 parents 1c15f93 + b68776c commit 9f91ae1
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@
*.dSYM/

/main
main
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,10 @@ Publicly available documents already discuss exfiltration from secured systems u

How to Use It
------------------
Compile the program using make:
Enter the `Using _mm_stream_si128` folder and compile using make. (There are also other flavors you can `make` and try in different folders!)

make

And run it on an Apple MacBook Air (13-inch, Early 2015):

./main

Then use a Sony STR-K670P radio receiver with the included antenna and tune it to 1580 kHz on AM.

You should hear the "Mary Had a Little Lamb" song playing repeatedly. Other equipment and tuning may work as well. On the equipment above, the author has achieved clear transmission over two meters of open air or one meter through drywall. Different results will be achievable with different equipment.
Expand Down
21 changes: 21 additions & 0 deletions Using counter and threads/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
all : gmain cmain

clean :
rm -f gmain
rm -f cmain

grun : gmain
./gmain

crun : cmain
./cmain


gmain : main.cpp
g++ -Wall -O2 -std=c++11 -pthread -lrt -o gmain main.cpp

cmain : main.cpp
clang++ -Wall -O2 -std=c++11 -stdlib=libc++ -pthread -lrt -o cmain main.cpp


.PHONY : all clean run
103 changes: 103 additions & 0 deletions Using counter and threads/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
// SYSTEM BUS RADIO
// https://github.com/fulldecent/system-bus-radio
// Copyright 2016 William Entriken
// C++11 port by Ryou Ezoe

#include <iostream>
#include <iomanip>
#include <chrono>
#include <thread>
#include <atomic>
#include <mutex>
#include <condition_variable>

std::mutex m ;
std::condition_variable cv ;
std::chrono::high_resolution_clock::time_point mid ;
std::chrono::high_resolution_clock::time_point reset ;


void boost_song()
{
using namespace std::chrono ;

while( true )
{
std::unique_lock<std::mutex> lk{m} ;
cv.wait( lk ) ;

std::atomic<unsigned> x{0} ;
while( high_resolution_clock::now() < mid )
{
++x ;
}
std::this_thread::sleep_until( reset ) ;
}
}

void square_am_signal(float time, float frequency)
{
using namespace std::chrono ;

std::cout << "Playing / " << time << " seconds / " << frequency << " Hz\n" ;

seconds const sec{1} ;
nanoseconds const nsec{ sec } ;
using rep = nanoseconds::rep ;
auto nsec_per_sec = nsec.count() ;

nanoseconds const period( static_cast<rep>( nsec_per_sec / frequency) ) ;

auto start = high_resolution_clock::now() ;
auto const end = start + nanoseconds( static_cast<rep>(time * nsec_per_sec) ) ;

while (high_resolution_clock::now() < end)
{
mid = start + period / 2 ;
reset = start + period ;

cv.notify_all() ;
std::this_thread::sleep_until( reset ) ;
start = reset;
}
}

int main()
{

for ( unsigned i = 0 ; i < std::thread::hardware_concurrency() ; ++i )
{
std::thread t( boost_song ) ;
t.detach() ;
}

while (1)
{
square_am_signal(0.400, 2673);
square_am_signal(0.400, 2349);
square_am_signal(0.400, 2093);
square_am_signal(0.400, 2349);
square_am_signal(0.400, 2673);
square_am_signal(0.400, 2673);
square_am_signal(0.790, 2673);
square_am_signal(0.400, 2349);
square_am_signal(0.400, 2349);
square_am_signal(0.790, 2349);
square_am_signal(0.400, 2673);
square_am_signal(0.400, 3136);
square_am_signal(0.790, 3136);
square_am_signal(0.400, 2673);
square_am_signal(0.400, 2349);
square_am_signal(0.400, 2093);
square_am_signal(0.400, 2349);
square_am_signal(0.400, 2673);
square_am_signal(0.400, 2673);
square_am_signal(0.400, 2673);
square_am_signal(0.400, 2673);
square_am_signal(0.400, 2349);
square_am_signal(0.400, 2349);
square_am_signal(0.400, 2673);
square_am_signal(0.400, 2349);
square_am_signal(0.790, 2093);
}
}

0 comments on commit 9f91ae1

Please sign in to comment.