# Thread: Number Generator - Need Help - Python

1. ## Number Generator - Need Help - Python

Hi every 1 -
i want Number Generator in Python Lang - i start learning on it . so i want make list of 7 digits from 1,000,000 to 9,999,999 ... i did it and this is the code

>>> for i in range(1000000,10000000): print i

very simple i know ; )

what i need next is to add to this area code like 099 or 070 >>

so it will look like
0701000000
0701000001
0701000002
.
...
..... So on .

for those who is asking why ? oki i want make a list of
1.List of number's -
2.List of Tel Number's
3.List of Mobile Number's

Many thanks .
and if i found it ill post it ...

2. I cant understand why or what you want to do ?

But I'l take a guess and add this code

Code:
```#!/usr/bin/python
# Simple Example of nothing ???? by drgr33n :D

import sys

# def static

mobile = '070'
home = '090'

# Print error if no argument

if len(sys.argv) < 2:
print 'No action specified.'
sys.exit(0)

# Add the -- tag to the sys argv

if sys.argv[1].startswith('--'):
option = sys.argv[1][2:]

# Generate and print mobile list

if option == 'mobile':
for i in range(0000000,9999999):
# Convert I to string
# Print Output
elif option == 'home':
for i in range(0000000,9999999):
else:
print 'Eh? Try again :D.'```
--home for home no and --mobile for a mobile number. Again I don't know what you wana do ??? this would create a long list of tel numbers 9999999 to be exact lol ???

i added the fact that all is saved to a file
and that you can hit ctrl+c cleanly to abort operations (took less 30 secs to complete)

Code:
```#Phone Nums Generator

import sys;

if len(sys.argv) != 2:
print "Usage: ./python phonenums.py [--mobile] [--home]";
sys.exit(1);

try:

if sys.argv[1]=="--mobile":
FILE = open('mobilenums.list','w');
print 'Wait when generating Mobile Phone List or Hit Ctrl+C in order to Abort';
for i in range(0000000,9999999):
FILE.write('070' + str(i)+'\n');
print 'Mobile Phone Nums Written in mobilenums.list';

elif sys.argv[1] == '--home':
print 'Wait when generating Home Phone List or Hit Ctrl+C in order to Abort';
for i in range(0000000,9999999):
FILE.write('090' + str(i)+'\n');
print 'Home Phone Nums Written in homenums.list';

else:
print 'Error !! UnHandled Option';sys.exit(1);

except KeyboardInterrupt:
print 'Aborted by User';```
it's quite crude coding and could be better , but after all you just ask for hints and we have both Mr Green and Me provided more than that.

4. Many thanks Dr_Green , Shamanvirtuel ...
i think i don't explain it properly . But you code REALLY help me a lot & solve it for me in 2 Mints .... all i want was --- str(i) which both of you mention it in your code

i hate my self when this error come again and again >>

TypeError: cannot concatenate 'str' and 'int' objects

>>> n = " 070 "
>>> for i in range ( 1000000 , 2000000 ) : print n + str(i)

that what i need then after that i change the variable to "090"

then save it in Mobilelist.py ....chmod 777 Mobilelist.py ....
then ./Moblielist.py > Mlist.txt

So Dr_green as i mention that im still n00b in this Python .. and in the same time i want start using python ... So here n my country our mobile No's like this 070******* total of 10 digits >> and many of my relative , friends using their mobile # as Passpharse for their WPA so by generating this list from 1000000 to 10000000 ill cover all the # ... + airolib-ng will make it FASTER ,
also i used to use my name + date of birth as Password like ( Mike1975 ) .. So by time practicing on python and making lists >>> : ) but really thanks for the help !!

5. OK thats NP m8t

6. Originally Posted by Ethical
here n my country our mobile No's like this 070******* total of 10 digits >> and many of my relative , friends using their mobile # as Passpharse for their WPA so by generating this list from 1000000 to 10000000 ill cover all the # ... + airolib-ng will make it FASTER ,
also i used to use my name + date of birth as Password like ( Mike1975 ) ..
While you're explanation for motive is "pluasable" there are many uses for such a list. Such as phone spamming. 070*******@worldphown.com and email spamming when combined with other scripts mentioned lately. However, I know no1 would dare think of such a thing.

7. I was going to point that out PeppersGhost, but like you said I don't think he would dream of asking questions like that here

Anyway the code provided was 30 seconds work as shaman pointed out, and most half savvy computer user would be able to knock this code up in the same time Not trying to dog you ethical

So I can't see ethical being a threat to anyone but himself if he tried to execute any email spamming or anything else but his own pentesting I hope

8. I hear using xrange is faster. You might want to use that instead of range. Also, xrange can use bigger numbers.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•