Category Archives: Howto

Blizzard Box (c) GNU WeakNet Labs 2014

For the recording functionality, I made a few global variables,

boolean recording = 0; // are we recording?
boolean recorded = 0; // we have a stored number
char recTones[20] = {'x','x','x','x','x','x','x','x','x','x',
'x','x','x','x','x','x','x','x','x','x'}; // don't dial x digits.
char heldButton; // which button was held.

And basically listen for a long press on key 'D' with,

  if(keypad.getState() == HOLD){
int intB = heldButton - 48; // get Blue Box element index
if(intB==52){ // long press D
recording=0; // stop recording
recording=1; // save the digit pressed
for(int i=0;i<=19;i++){ // reset array
recTones[i] = 'x';


heldButton is assigned just under the if(button) because button was being overwritten in memory before it was triggering HOLD for some odd reason.

if (button){
int intB = button - 48; // get Blue Box element index
heldButton = button; // store this for later (hack)

Then I simply delay() when ‘d’ is pressed between stored digits in the playTone() function,

void playTone(int freqElement,int delayMs){ // pass frequency element from array
if(freqElement==-13){ freqElement=10; } // KP
if(freqElement==-6){ freqElement=11; } // ST
delay(delayMs); // play tone for delay milliseconds.
stopTone(); // stop the tone
if(heldButton == 'd'){ delay(delayMs); } // need to delay between playing too.

The full code (could be cleaned up a bit, it was a school night and I have been running on ‘E’ lately.):

Schematic to come shortly! Enjoy, Phreaks!


testing out keypad for new Phone Phreaking box

Combination of Blue and Red box, made with an Arduino.

Parts list

  • Velleman 16 keys matrix output
  • Project Box
  • 9V Battery
  • Arduino (UNO) (I used the Make version)
  • Wire
  • Switch (on/off)
  • Potentiometer (volume)
  • Speaker (I used one from old Phone handset)
  • Push button (2600Hz Tone button)

The Box design is large, (Radioshack boxes are strangely shaped), but that’s okay, this is my very first implementation. I simply used a Dremmel Tool and a knife to drill out the holes and cut the square in the box for the keypad. (not very efficient, but I have little resources.)

The Keypad came in the mail:

The Keypad has a pinout, so no messing around with finding the matrix

Soldered wire onto each pin carefully

Wired the keypad into the Arduino from pin 1 on the keypad to pin 2 on the Arduino in sequence up to pin 8 of the keypad into pin 10 of the Arduino.

Tested the pinout by printing to the serial connection to the computer. In the Arduino IDE, click on Tools->Serial Monitor and make sure you create a serial connection with the code:


The code which displays the key presses is in the loop() function as:

char customKey = keypad.getKey();
if (customKey){

And the output looks like so:

Next, I wrote some prototype code. The Arduino “sketch” or C++ class, begins by importing two libraries, Tone and Keypad for playing tones simultaneously when a key is pressed from a keypad.


Next we create a few global variables, and comments provide what they are for.

// array of tone output pins:
int bbt1[12] = {1300,700,700,900,700,900,1100,700,900,1100,1100,1500}; // blue box tone 1
int bbt2[12] = {1500,900,1100,1100,1300,1300,1300,1500,1500,1500,1700,1700}; // bluebox tone 2
int delayTime = 100; // 100 ms
const byte rows = 4; //four rows
const byte cols = 4; //three columns
char keys[rows][cols] = { // matrix layout used by the Keypad library
byte rowPins[rows] = {5,4,3,2}; //connect to the row pinouts of the keypad
byte colPins[cols] = {9,8,7,6}; //connect to the column pinouts of the keypad

Then we create two objects, a Tone object, which is an array of the two sound output pins, freq[2], and a Keypad object simply called keypad.

Tone freq[2];
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, rows, cols );

In our setup() function, we only do two things, and that’s to call the begin() method on the Tone sound-output-pin objects. I left the Serial connection commented out in there for debugging purposes. You can uncomment it if you are experiencing strange behavior with your pin layout.

void setup(void){
   // Serial.begin(9600); // Debugging Serial connection for printing to screen
   // simply call the print method from the Serial class and pass a var
 freq[0].begin(11); // Initialize our first tone generator
 freq[1].begin(12); // Initialize our second tone generator

The main loop() function of the device needs to create a button object from the getKey() method each time, as the underlying code must get the voltage difference. IN the test code, if the button is pressed, if(button){} we check it’s value by converting the returned value from keys[rows][cols]{} into an integer. We do so by taking the ASCII value and subtracting 48 from it. Since the C char '1' is actually (decimal) ASCII for 49, '2' is (decimal) ASCII for 50, etc. The values now will be 0-9 for button presses 0-9 and 49-52 for A,B,C,D respectively and -13,-6 for * and # respectively.

void loop(){ // main(){}
 char button = keypad.getKey();
 if (button){
  int i = button – 48;

Again, we can simply un-comment the Serial object line in the setup() function and do Serial.println(i); to reveal in the serial console which numbers i pertains to when a button is pressed.

Finally, we have two new functions to play and stop the tones. The playTone() function called from the loop() function after a button is pressed calls the stopTone() function, which delays for a specified delayTime (global variable).

void playTone(int freqElement){ // pass frequency element from array
 stopTone(); // stop the tone
void stopTone(){ // stop them if they are playing

The isPlaying() method returns a Boolean which is ‘true‘ when playing a tone, or ‘false‘ when not. That’s our prototype. The entire code sauce can be downloaded below and a schematic of the pin arrangement that I have used as well.


References and Learning Links

Arduino 3rd Party Tone Library:

Arduino Keypad tutorial (including links to download the latest version):

Red Box (Phreaking):

Blue Box (Phreaking):

Be sure to check out the compilation of info on phone phreaking we have here as well in the navigation bar above! (work in progress)

In the next part of this tutorial (part II), I will cover how to modify the play function to accept a delay time and Red Box tones.


This box still worked for seizing the trunk line in Livingood Alaska years ago. It is a simple schematic that produces a sine wave 2600Hz, along with a wide range of ther frequencies. It is tuned by a B5k potentiometer, or variable resister. I have added a Phone Phreaking section to the navigation above for anyone interested in the subject enough to learn or see more.

Here is the design (which could probably be remodeled even more efficiently as well):


  1. 555 timer (texas instruments)
  2. switch
  3. B5K potentiometer
  4. .1uF disc capacitor
  5. 68uF (switched from 100 to 68 in the diagram above) cat capacitor
  6. 1k resistor
  7. 32 Ohm speaker from old telephone
  8. 9 Volt battery
  9. Breadboard and wires (mine in the video are from the Arduino kit)

Video of 2600Hz box working in Alaskan switch

Anyways, I am currently working on an Arduino project which will be a BlueBox and Red Box in one design. I am just waiting patiently for a 16 key 0-9a-d telephony keypad to come in the mail to begin. Here is a video of that prototype:

When this project is done, I will be releasing the C++ code for the PIC and more pictures and videos.

Capacitor capacitance calculator
Resistor band calculator


Rather than write a “free” article for an online magazine, I figured I’d just put this right here on my site. It’s a simple proposal for credential analysis from leaked credentials and from those gleaned during a penetration test for more accurate, targeted credential attack vectors. I propose not only simple methodology practices as examples, but even terminologies for the practice as well.

Hope you enjoy,

Linkage and Automatic Variables

There are two different kinds of linkage for C variables; internal and external. And, of course, can also have variables with no linkage at all. But, what is linkage? Well linkage refers to the life span and scope of the variable. When we went over for() loops in tutorial 7, we were using an automatic variable i. i only lived within the for() loop and the scope only allowed i to be accessed inside the block, or compound statement of it’s parent for() loop. This is an automatic variable and we say that it has no linkage at all. In fact, we can use the auto storage class specifier like so:

int main(void){
  auto int i;
  return 0;

The integer i would then be freed when the main() function exits.

Static Variables

How could we make i live throughout the application? Well, we define a new storage class, static. The static storage class retains variables throughout the duration of the program’s execution. Let’s take a look at a quick example:

int inc(void){
  static int i = 0;
  return i;

The above code defines a static variable i which has no linkage. It can only be accessed via the inc() function, but lives throughout the application’s execution time. It looks like we define i each time we call the function inc(), but the C code actually recognizes that this variable is static after initially defining it. So it simply refers to it’s memory space with each consecutive call to inc() rather than redefining it as we see in our full code example below.

int main(void){
  return 0;
int inc(void){
  static int i = 0;

The code above, when compiled and ran, returns the result:


And as we see, we didn’t “redefine” the integer i. We may have also noticed that the inc() function is supposed to return an integer according to it’s definition. This is true because the creation and modification of i is returning an integer! The variable i has static storage duration, no linkage and only block scope. Block scope, again, simply means that the variable can only be accessed by the block in which it was created.

No Linkage

Automatic variables that are thrown away at the end of a function or block of code, such as i in the for() loop, have absolutely no linkage. They don’t live throughout the duration of execution, so they cannot be accessed just anywhere within the application- just the block which creates them.

Internal Linkage

Static variables with internal linkage can be thought of as a global variable that can only be accessed by the file in which it was created. Now, up to this point, we have only created single file C programs. C programs can be comprised of multiple files and linkage can occur throughout, as external linkage.

static int i = 0;
int main(void){
  extern int i;
  return 0;

The code above set the integer i to be static, outside of any function. This defines the variable with Internal Linkage. It is global to the file in which it lives, but only to that file.

External Linkage

Static variables with external linkage can be thought of as a global variable which can be accessed anywhere from any file in our C program. Below, is the simplest form of a static variable with external linkage.

int i = 0;
int main(void){
  extern int i;
  return 0;

The integer i is an external variable of the external storage class that was defined outside of any function. It can be used by any file within our C program. We have re-declared (this process is optional according to most documentations on the subject), i using the external storage class specifier. This is a good example to use when trying to understand the difference of defining and declaring a variable. The extern specifier for int i is declaring that we want to use the i integer defined elsewhere. The first int i = 0; line is a declaration AND definition as we tell the compiler to set aside memory for it and place in the integer value 0.

Storage Classes in C

Now that we have covered different linkage, storage classes and examples of each, let’s take a look at four storage classes and summarize what we have learned above.

1. auto - automatic storage duration variables, thrown away at the end of the block in which they are created.
  auto int i = 0;
2. register - stored in either the CPU registers, or the fastest storage available. These are also of automatic storage duration.
  register int i = 0;
3. static - static storage duration makes a variable live throughout the execution of our program.
These are defined outside of any function and can have the static specifier omitted.
  static int i = 0;
4. extern - external storage class, external variable which also has static storage duration. These are defined and declared outside of any function.
  extern int i = 0;

Static and External Functions

Functions can also have static or external storage classes. A static function prototyped and defined as,
static int func(void);
Can be accessed anywhere within the file in which it was defined. We can have external functions like so,
extern int func(void);
which can be accessed by any file within our C program. Let’s take a look at a simple static function. To define a static function, it must be prototyped before main().

static void callIt(register int i);
int main(void){
  return 0;
static void callIt(register int i){

This entire tutorial should offer help in understanding different storage classes, duration types, defining and declaring, and linkage.

Layout mode
Predefined Skins
Custom Colors
Choose your skin color
Patterns Background
Images Background