Results 1 to 8 of 8

Thread: Number Generator - Need Help - Python

  1. #1
    Junior Member
    Join Date
    Aug 2007
    Posts
    85

    Default 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 ...
    How you spend your time is more important than how you spend your money. Money mistakes can be corrected, but time is gone forever. David Norris

  2. #2
    Very good friend of the forum drgr33n's Avatar
    Join Date
    Jan 2010
    Location
    Dark side of the moon ...
    Posts
    699

    Default

    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 
          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 ???

  3. #3
    Senior Member shamanvirtuel's Avatar
    Join Date
    Mar 2010
    Location
    Somewhere in the "Ex" human right country
    Posts
    2,988

    Default

    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)

    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':
      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.
    Watch your back, your packetz will belong to me soon... xD

    BackTrack :
    Giving Machine Guns to Monkeys since 2006

  4. #4
    Junior Member
    Join Date
    Aug 2007
    Posts
    85

    Default

    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 !!
    How you spend your time is more important than how you spend your money. Money mistakes can be corrected, but time is gone forever. David Norris

  5. #5
    Very good friend of the forum drgr33n's Avatar
    Join Date
    Jan 2010
    Location
    Dark side of the moon ...
    Posts
    699

    Default

    OK thats NP m8t

  6. #6
    Member PeppersGhost's Avatar
    Join Date
    Jan 2008
    Posts
    204

    Default

    Quote Originally Posted by Ethical View Post
    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.
    <EeePc 1000HA BT4/W7 USB boot Alfa500 GPS BlueTooth>

  7. #7
    Very good friend of the forum drgr33n's Avatar
    Join Date
    Jan 2010
    Location
    Dark side of the moon ...
    Posts
    699

    Default

    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. #8
    Junior Member
    Join Date
    Apr 2008
    Posts
    48

    Default

    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
  •