Last active
August 29, 2015 13:57
-
-
Save geoff-nixon/9691580 to your computer and use it in GitHub Desktop.
Generate random but valid names and addresses.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env sh # "somebodyrandom" -- random but REAL names and addresses. # | |
| #=- G. Nixon, 2014; Public domain or license of your choice. DO NOT ABUSE. -=# | |
| #==------------------------------------------------------------------------==# | |
| # # | |
| # Randomly generate (from census data and white pages) a valid name, address # | |
| # and phone number. THIS IS NOT stealing anyone's identity, as it is public # | |
| # information. It is not meant for harassing/spamming people, but for online # | |
| # registration forms where this type infomation is required (and validated), # | |
| # and one wishes to remain anonymous, along with a throw-away email address. # | |
| # # | |
| #==- Please respect peoples' privacy. Never use an entry more than once. --==# | |
| # # | |
| #==------------------------------------------------------------------------==# | |
| # This script consists of a list of (100 each): | |
| # - The top 200 most populous cities in US, with cities and states with | |
| # whitespace in their names excluded, which eliminates ~70 cities. | |
| # The remaning cities are reuced to exactly 100 in number by eleminating | |
| # the least populous cities remaining in the list in Texas and California. | |
| # This gives a slightly more geographically random distribution. Ref: | |
| # - The most common surnames and male female given names in the US. | |
| # Data was collected from: | |
| # http://en.wikipedia.org/wiki/list_of_united_states_cities_by_population | |
| # http://names.mongabay.com/data/1000.html | |
| # http://names.mongabay.com/male_names.htm | |
| # http://names.mongabay.com/female_names.htm | |
| # We flip a coin for male/female, then generate three random numbers beween | |
| # 1 and 100, picking a first name, a last name, and a city. We then search | |
| # the white pages for a published phone and address listing for that combo, | |
| # which is very likely to exist, given that we're strategically selecting | |
| # common names and places. If we fail, try again, on sucess, show findings. | |
| # 100 first names *2 genders *100 last names *100 cities = 2 million people! # | |
| #==------------------------------------------------------------------------==# | |
| phonebook='http://411.com'; list(){ list=$phonebook/name/$n/$w; echo $list ;} | |
| dlcurl(){ curl -Ls --user-agent 'Mozilla/5.0' "$@" ;} # Only works with curl | |
| dlwget(){ wget -e robots=off -U 'Mozilla/5.0' -qO - "$@" ;} # right now, fix. | |
| dltest(){ alias dl=dlcurl; dlcurl "$phonebook" >/dev/null 2>&1 && return 0 || | |
| alias dl=dlwget; dlwget "$phonebook" >/dev/null 2>&1 && return 0 || | |
| echo "Cannot download with curl or wget ..?" >&2 && exit 1 ;}; dltest | |
| #==------------------------------------------------------------------------==# | |
| havephone(){ grep -C2 'n by p' | tail -1 | sed -e's|.*ef="||' -e's|".*||' ;} | |
| listphone(){ listing="$(dlcurl $(dlcurl $(list) | havephone) 2>/dev/null)" ;} | |
| try(){ pick; printf "\nGuess $try: \033[34m$f" | |
| printf "\033[33m $surname\033[0m from " | |
| printf "\033[35m$where\033[0m ?"; sleep 1 ;} | |
| yay(){ printf "\033[36m ...yep!\033[0m" ;} | |
| boo(){ printf "\033[31m ...nope.\033[0m" ;} | |
| dldl(){ try=$(($try + 1)); try; listphone && yay && return 0 || boo; dldl ;} | |
| oneinahundred(){ echo $((100 * $(od -An -N1 -i /dev/urandom) / 256)) ;} | |
| coinflip(){ chance=$(oneinahundred); case $chance in | |
| 1) family=Adams female=Alice male=Aaron city=Chesapeake state=Virginia ;; | |
| 2) family=Allen female=Annie male=Carlos city=Alexandria state=Virginia ;; | |
| 3) family=Anderson female=Amy male=Alan city=Anaheim state=California ;; | |
| 4) family=Bailey female=Andrea male=Albert city=Anchorage state=Alaska ;; | |
| 5) family=Baker female=Angela male=Andrew city=Arlington state=Texas ;; | |
| 6) family=Barnes female=Rose male=Anthony city=Atlanta state=Georgia ;; | |
| 7) family=Butler female=Barbara male=Antonio city=Augusta state=Georgia ;; | |
| 8) family=Bennett female=Anne male=Arthur city=Aurora state=Colorado ;; | |
| 9) family=Brooks female=Amanda male=Benjamin city=Aurora state=Illinois ;; | |
| 10) family=Cooper female=Ashley male=Clarence city=Austin state=Texas ;; | |
| 11) family=Bell female=Anna male=Bobby city=Bakersfield state=California ;; | |
| 12) family=Campbell female=Beverly male=Brandon city=Boise state=Idaho ;; | |
| 13) family=Collins female=Betty male=Brian city=Birmingham state=Alabama ;; | |
| 14) family=Carter female=Bonnie male=Bruce city=Baltimore state=Maryland ;; | |
| 15) family=Clark female=Brenda male=Adam city=Boston state=Massachusetts ;; | |
| 16) family=Cook female=Carol male=Carl city=Bridgeport state=Connecticut ;; | |
| 17) family=Brown female=Carolyn male=Charles city=Chandler state=Arizona ;; | |
| 18) family=Cruz female=Debra male=Chris city=Chattanooga state=Tennessee ;; | |
| 19) family=Reed female=Cheryl male=Christopher city=Columbus state=Ohio ;; | |
| 20) family=Davis female=Christina male=Billy city=Cincinnati state=Ohio ;; | |
| 21) family=Diaz female=Christine male=Craig city=Chicago state=Illinois ;; | |
| 22) family=Edwards female=Cynthia male=Daniel city=Cleveland state=Ohio ;; | |
| 23) family=Evans female=Catherine male=David city=Garland state=Texas ;; | |
| 24) family=Fisher female=Deborah male=Dennis city=Columbus state=Georgia ;; | |
| 25) family=Flores female=Denise male=Donald city=Glendale state=Arizona ;; | |
| 26) family=Foster female=Diana male=Douglas city=Dallas state=Texas ;; | |
| 27) family=Garcia female=Diane male=Peter city=Dayton state=Ohio ;; | |
| 28) family=Gomez female=Donna male=Edward city=Denver state=Colorado ;; | |
| 29) family=Gonzalez female=Doris male=Eric city=Fresno state=California ;; | |
| 30) family=Green female=Dorothy male=Ernest city=Eugene state=Oregon ;; | |
| 31) family=Gray female=Elizabeth male=Eugene city=Detroit state=Michigan ;; | |
| 32) family=Harris female=Evelyn male=Frank city=Fremont state=California ;; | |
| 33) family=Hall female=Emily male=Fred city=Clarksville state=Tennessee ;; | |
| 34) family=Gutierrez female=Frances male=Gary city=Gilbert state=Arizona ;; | |
| 35) family=Hernandez female=Gloria male=George city=Akron state=Ohio ;; | |
| 36) family=Hill female=Heather male=Gerald city=Henderson state=Nevada ;; | |
| 37) family=Howard female=Helen male=Gregory city=Hialeah state=Florida ;; | |
| 38) family=Hughes female=Irene male=Harold city=Hollywood state=Florida ;; | |
| 39) family=Jackson female=Jacqueline male=Harry city=Houston state=Texas ;; | |
| 40) family=Johnson female=Jane male=Henry city=Huntsville state=Alabama ;; | |
| 41) family=Jenkins female=Janet male=Howard city=Irvine state=California ;; | |
| 42) family=James female=Janice male=Jack city=Indianapolis state=Indiana ;; | |
| 43) family=Jones female=Jean male=James city=Milwaukee state=Wisconsin ;; | |
| 44) family=King female=Jessica male=Jason city=Jackson state=Mississippi ;; | |
| 45) family=Kelly female=Jennifer male=Jeffrey city=Joliet state=Illinois ;; | |
| 46) family=Reyes female=Joan male=Jeremy city=Jacksonville state=Florida ;; | |
| 47) family=Lewis female=Joyce male=Jerry city=Knoxville state=Tennessee ;; | |
| 48) family=Long female=Judith male=Jesse city=Lakewood state=Colorado ;; | |
| 49) family=Lopez female=Judy male=Jimmy city=Minneapolis state=Minnesota ;; | |
| 50) family=Martin female=Julia male=Paul city=Lexington state=Kentucky ;; | |
| 51) family=Martinez female=Julie male=John city=Lincoln state=Nebraska ;; | |
| 52) family=Moore female=Karen male=Johnny city=Louisville state=Kentucky ;; | |
| 53) family=Morris female=Kathryn male=Jonathan city=Lubbock state=Texas ;; | |
| 54) family=Miller female=Kathleen male=Jose city=Madison state=Wisconsin ;; | |
| 55) family=Morgan female=Kelly male=Joseph city=Memphis state=Tennessee ;; | |
| 56) family=Morales female=Kimberly male=Patrick city=Mesa state=Arizona ;; | |
| 57) family=Mitchell female=Katherine male=Juan city=Miami state=Florida ;; | |
| 58) family=Murphy female=Kathy male=Joshua city=Richmond state=Virginia ;; | |
| 59) family=Myers female=Laura male=Keith city=Riverside state=California ;; | |
| 60) family=Nelson female=Lillian male=Kenneth city=Mobile state=Alabama ;; | |
| 61) family=Nguyen female=Linda male=Kevin city=Modesto state=California ;; | |
| 62) family=Ortiz female=Lisa male=Lawrence city=Montgomery state=Alabama ;; | |
| 63) family=Roberts female=Lois male=Larry city=Naperville state=Illinois ;; | |
| 64) family=Perez female=Martha male=Louis city=Nashville state=Tennessee ;; | |
| 65) family=Powell female=Louise male=Mark city=Oakland state=California ;; | |
| 66) family=Peterson female=Maria male=Martin city=Norfolk state=Virginia ;; | |
| 67) family=Phillips female=Marie male=Matthew city=Omaha state=Nebraska ;; | |
| 68) family=Perry female=Margaret male=Michael city=Orlando state=Florida ;; | |
| 69) family=Parker female=Marilyn male=Nicholas city=Peoria state=Arizona ;; | |
| 70) family=Cox female=Lori male=Joe city=Philadelphia state=Pennsylvania ;; | |
| 71) family=Ramirez female=Melissa male=Justin city=Phoenix state=Arizona ;; | |
| 72) family=Ward female=Mary male=Earl city=Pittsburgh state=Pennsylvania ;; | |
| 73) family=Richardson female=Michelle male=Philip city=Plano state=Texas ;; | |
| 74) family=Rivera female=Mildred male=Phillip city=Portland state=Oregon ;; | |
| 75) family=Rodriguez female=Nancy male=Raymond city=Reno state=Nevada ;; | |
| 76) family=Robinson female=Nicole male=Randy city=Savannah state=Georgia ;; | |
| 77) family=Price female=Norma male=Richard city=Seattle state=Washington ;; | |
| 78) family=Rogers female=Pamela male=Ralph city=Rockford state=Illinois ;; | |
| 79) family=Ross female=Paula male=Roger city=Sacramento state=California ;; | |
| 80) family=Russell female=Patricia male=Robert city=Salem state=Oregon ;; | |
| 81) family=Sanchez female=Phyllis male=Ronald city=Irving state=Texas ;; | |
| 82) family=Sanders female=Rebecca male=Roy city=Scottsdale state=Arizona ;; | |
| 83) family=Thomas female=Rachel male=Russell city=Laredo state=Texas ;; | |
| 84) family=Lee female=Ann male=Ryan city=Springfield state=Massachusetts ;; | |
| 85) family=Smith female=Robin male=Samuel city=Spokane state=Washington ;; | |
| 86) family=Stewart female=Ruby male=Sean city=Shreveport state=Louisiana ;; | |
| 87) family=Sullivan female=Stephanie male=Thomas city=Toledo state=Ohio ;; | |
| 88) family=Taylor female=Ruth male=Scott city=Springfield state=Missouri ;; | |
| 89) family=Scott female=Sandra male=Shawn city=Stockton state=California ;; | |
| 90) family=Turner female=Sara male=Stephen city=Tacoma state=Washington ;; | |
| 91) family=Torres female=Sarah male=Steve city=Tallahassee state=Florida ;; | |
| 92) family=Thompson female=Sharon male=Steven city=Tampa state=Florida ;; | |
| 93) family=Walker female=Shirley male=Terry city=Tempe state=Arizona ;; | |
| 94) family=Watson female=Susan male=Timothy city=Topeka state=Kansas ;; | |
| 95) family=White female=Tammy male=Willie city=Tucson state=Arizona ;; | |
| 96) family=Williams female=Teresa male=Victor city=Tulsa state=Oklahoma ;; | |
| 97) family=Wilson female=Theresa male=Walter city=Warren state=Michigan ;; | |
| 98) family=Wood female=Tina male=Todd city=Worcester state=Massachusetts ;; | |
| 99) family=Wright female=Virginia male=William city=Wichita state=Kansas ;; | |
| 100) family=Young female=Wanda male=Wayne city=Vancouver state=Washington ;; | |
| esac ;} | |
| pick(){ for each in first last where; do coinflip; case $each in | |
| first) [ $(( $(oneinahundred) %2 )) = 0 ] && f=$female || f=$male ;; | |
| last) surname=$family; n="$f-$surname"; name="$f $surname"; given=$f ;; | |
| where) w="$city-$state"; where="$city, $state" ;; | |
| esac; done ;} | |
| for x in $(seq 1 $1); do try=0; dldl; echo; echo | |
| phone=$(echo $(echo "$listing" | grep -C2 landline) | sed 's|.*Home ||') | |
| address=$(echo "$listing" | grep -C2 indicator | tail -2 | sed 's| *||') | |
| printf "\033[3mSuceeded in $try tries.\033[0m\n\n"|sed 's|1 tries|1 try|' | |
| printf "\033[37m$name\n"; echo "$address"; echo; printf "$phone\033[0m\n\n" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment