View Full Version : Number Generator - Need Help - Python
Ethical
05-12-2008, 03:04 PM
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 ...
Dr_GrEeN
05-12-2008, 09:06 PM
I cant understand why or what you want to do ?
But I'l take a guess and add this code :D
#!/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
add = str(i)
# Print Output
print mobile + add
elif option == 'home':
for i in range(0000000,9999999):
add = str(i)
print home + add
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 ???
shamanvirtuel
05-13-2008, 12:40 AM
just my 2 cents to help you
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)
#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':
FILE = open('homenums.list','w');
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.
Ethical
05-14-2008, 03:48 PM
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 !!
Dr_GrEeN
05-14-2008, 10:07 PM
OK thats NP m8t ;)
PeppersGhost
05-15-2008, 12:21 AM
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.
Dr_GrEeN
05-15-2008, 08:15 AM
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 :D
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 :D Not trying to dog you ethical :D
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 :D
Siph0n
05-26-2008, 02:09 PM
I hear using xrange is faster. You might want to use that instead of range. Also, xrange can use bigger numbers.
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.