Author Topic: Phone number phaker  (Read 3405 times)

0 Members and 2 Guests are viewing this topic.

Offline Live Wire

  • Knight
  • **
  • Posts: 189
  • Cookies: 4
  • Up on your Net
    • View Profile
Phone number phaker
« on: December 16, 2011, 02:35:43 pm »
Something i had to make for class. Just thoguth i'd pass it along. Not the most elagant piece of code, but got an A+
 
Code: [Select]

 /**
 * Project Name: <Phone Number Spoofer>
 * Author: <Live Wire>
 * Instructor: <Some Guy>
 * Purpose: <To create numbers>
 * Date: <Dec 2, 2011>
 * Assistance: <None>
 */
//Imports
import java.util.Random;

class M3L1T1_2
{
//Static variables
static Random rd = new Random();
public static void main(String[]args)
    {
        //Variable Declarations
       
        //Operating Code
        System.out.printf ("This program was written by Live Wire\n\n"+
        "The random phone number generated was: %03d-%03d-%04d",numberGen(),numberGen(),numberGen());       
    }// end of main method
   
/**
 * This numberGen method creates a random set number
 *
 * No parameters
 */
public static int numberGen()
    {
        int setNum = 1;
        int maxVall = 800;
        int minVal = 100;
        int setValue = 0;
        int numGen = rd.nextInt(999)+1;
       
       
        while ( setNum < 3){
            if (setNum == 1){
                String numString = Integer.toString(numGen);
                if ((numString.contains("8"))|(numString.contains("9"))){       //Separates the 8s and 9s
                    numGen = rd.nextInt(999)+1;
                }else {
                    setValue = numGen;
                setNum++;
            }
           
            }while  (setNum == 2){          //This can produce an 8, it just takes many trials
                if (numGen > 742){
                    numGen = rd.nextInt(999)+1;
                }else {
                    setValue = numGen;
                    setNum++;
            }
           
            }while (setNum == 3) {
                setValue = numGen;               
                setNum++;
            }
        }//end of while 
       
        return setValue;
    }
   
}//end of class

« Last Edit: December 19, 2011, 09:07:31 am by Live Wire »
"There is no right or wrong, there is only fun and boring."

Offline _ANONYMOUS_

  • Serf
  • *
  • Posts: 24
  • Cookies: 0
  • I Prefer To Remain Anonymous
    • View Profile
Re: Phone number phaker
« Reply #1 on: December 16, 2011, 02:50:22 pm »
Well Nice and congratulations on the A+ :D
The only reason people get lost in thought is because it's unfamiliar territory

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: Phone number phaker
« Reply #2 on: December 16, 2011, 08:05:49 pm »
Grats on A+, but what's the point of this app? :D I see it generates a number and that is it...
Explain pl0x Drew Parker ;)
« Last Edit: December 16, 2011, 08:06:21 pm by Kulverstukas »

Offline Tsar

  • Peasant
  • *
  • Posts: 126
  • Cookies: 10
  • turing-recognizable
    • View Profile
Re: Phone number phaker
« Reply #3 on: December 17, 2011, 08:52:04 pm »
Looks like you are basically just generating a number?

Offline sp0rk

  • Serf
  • *
  • Posts: 38
  • Cookies: -1
    • View Profile
Re: Phone number phaker
« Reply #4 on: December 18, 2011, 02:01:51 am »
Thanks for this, I'm just getting into coding. Starting Java as my first application language to learn. I've always wondered how those automated dialers spoofed numbers.

Welcome. Sit on the couch in the corner and I'll bring in the bitches.

Offline Live Wire

  • Knight
  • **
  • Posts: 189
  • Cookies: 4
  • Up on your Net
    • View Profile
Re: Phone number phaker
« Reply #5 on: December 19, 2011, 09:07:11 am »
Basically yes. Ever tried to buy something online, needed a phone gave yours, but you live overseas, so it doesnt recognize it? Well, this generates a number that fits the rubric of a standard U.S. phone number (first section contains no eights or nines, second is no higher than 742, and none but the last can start with zero). Just thought this might be interesting.
"There is no right or wrong, there is only fun and boring."