EvilZone

Programming and Scripting => Java => : Live Wire December 16, 2011, 02:35:43 PM

: Phone number phaker
: Live Wire 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+
 
:

 /**
 * 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

: Re: Phone number phaker
: _ANONYMOUS_ December 16, 2011, 02:50:22 PM
Well Nice and congratulations on the A+ :D
: Re: Phone number phaker
: Kulverstukas 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 ;)
: Re: Phone number phaker
: Tsar December 17, 2011, 08:52:04 PM
Looks like you are basically just generating a number?
: Re: Phone number phaker
: sp0rk 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.
: Re: Phone number phaker
: Live Wire 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.