Advertisement
Linkcabin

PHPMyAdmin Filter Script

Sep 20th, 2015
726
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.78 KB | None | 0 0
  1. import re, sys, geoip
  2.  
  3. with open("gy.txt", "r") as ins:
  4.     array = []
  5.     for line in ins:
  6.         array.append(line)
  7.  
  8. total = len(array)
  9.  
  10. print "Total: " + str(total)
  11.  
  12. ipfil = []
  13.  
  14. for i in range(total):
  15.     ips = re.findall( r'[0-9]+(?:\.[0-9]+){3}', array[i] )
  16.     ok = len(ips)
  17.     if ok == 1:
  18.         ipfil.append(ips)
  19.  
  20. print "Identifiable IP's: " + str(len(ipfil))
  21. urlest = total - len(ipfil)
  22. print "URL Amount Estimate: " + str(urlest)
  23.  
  24.  
  25. govc = 0
  26.  
  27. for i in range(total):
  28.     if ".gov" in array[i]:
  29.         govc = govc + 1
  30.  
  31. print "Estimated GOV Domains: " + str(govc)
  32.  
  33. countries = (
  34.     '',   'AP', 'EU', 'AD', 'AE', 'AF', 'AG', 'AI', 'AL', 'AM', 'AN', 'AO', 'AQ',
  35.     'AR', 'AS', 'AT', 'AU', 'AW', 'AZ', 'BA', 'BB', 'BD', 'BE', 'BF', 'BG', 'BH',
  36.     'BI', 'BJ', 'BM', 'BN', 'BO', 'BR', 'BS', 'BT', 'BV', 'BW', 'BY', 'BZ', 'CA',
  37.     'CC', 'CD', 'CF', 'CG', 'CH', 'CI', 'CK', 'CL', 'CM', 'CN', 'CO', 'CR', 'CU',
  38.     'CV', 'CX', 'CY', 'CZ', 'DE', 'DJ', 'DK', 'DM', 'DO', 'DZ', 'EC', 'EE', 'EG',
  39.     'EH', 'ER', 'ES', 'ET', 'FI', 'FJ', 'FK', 'FM', 'FO', 'FR', 'FX', 'GA', 'GB',
  40.     'GD', 'GE', 'GF', 'GH', 'GI', 'GL', 'GM', 'GN', 'GP', 'GQ', 'GR', 'GS', 'GT',
  41.     'GU', 'GW', 'GY', 'HK', 'HM', 'HN', 'HR', 'HT', 'HU', 'ID', 'IE', 'IL', 'IN',
  42.     'IO', 'IQ', 'IR', 'IS', 'IT', 'JM', 'JO', 'JP', 'KE', 'KG', 'KH', 'KI', 'KM',
  43.     'KN', 'KP', 'KR', 'KW', 'KY', 'KZ', 'LA', 'LB', 'LC', 'LI', 'LK', 'LR', 'LS',
  44.     'LT', 'LU', 'LV', 'LY', 'MA', 'MC', 'MD', 'MG', 'MH', 'MK', 'ML', 'MM', 'MN',
  45.     'MO', 'MP', 'MQ', 'MR', 'MS', 'MT', 'MU', 'MV', 'MW', 'MX', 'MY', 'MZ', 'NA',
  46.     'NC', 'NE', 'NF', 'NG', 'NI', 'NL', 'NO', 'NP', 'NR', 'NU', 'NZ', 'OM', 'PA',
  47.     'PE', 'PF', 'PG', 'PH', 'PK', 'PL', 'PM', 'PN', 'PR', 'PS', 'PT', 'PW', 'PY',
  48.     'QA', 'RE', 'RO', 'RU', 'RW', 'SA', 'SB', 'SC', 'SD', 'SE', 'SG', 'SH', 'SI',
  49.     'SJ', 'SK', 'SL', 'SM', 'SN', 'SO', 'SR', 'ST', 'SV', 'SY', 'SZ', 'TC', 'TD',
  50.     'TF', 'TG', 'TH', 'TJ', 'TK', 'TM', 'TN', 'TO', 'TL', 'TR', 'TT', 'TV', 'TW',
  51.     'TZ', 'UA', 'UG', 'UM', 'US', 'UY', 'UZ', 'VA', 'VC', 'VE', 'VG', 'VI', 'VN',
  52.     'VU', 'WF', 'WS', 'YE', 'YT', 'RS', 'ZA', 'ZM', 'ME', 'ZW', 'A1', 'A2', 'O1',
  53.     'AX', 'GG', 'IM', 'JE', 'BL', 'MF')
  54.  
  55. #ip to country#
  56. '''countryc = [0]*253
  57.  
  58. for i in range(len(ipfil)):
  59.     print i
  60.     if i == 100000:
  61.         print "100000"
  62.     elif i == 25000:
  63.         print "250000"
  64.     elif i == 50000:
  65.         print "50000"
  66.     ip = ''.join(ipfil[i])
  67.     for i in range(len(countries)):
  68.         if str(geoip.country(ip)) in str(countries[i]):
  69.             countryc[i] = countryc[i] +1
  70.  
  71. with open ("countries.txt", "w") as myfile:
  72.     myfile.write(str(countryc))'''
  73.  
  74. #format#
  75. '''with open("countries.txt", "r") as ins:
  76.     for line in ins:
  77.         splita = line.split(",")
  78.  
  79.  
  80.  
  81. for i in range(253):
  82.  
  83.     construct = ''.join([countries[i], "=>", str(splita[i]).replace(" ", "")])
  84.     print construct'''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement