分布式拒绝服务(DDoS)攻击指借助于客户/服务器技术,将多个计算机联合起来作为攻击平台,对一个或多个目标发动DDoS攻击,从而成倍地提高拒绝服务攻击的威力。通常,攻击者使用一个偷窃帐号将DDoS主控程序安装在一个计算机上,在一个设定的时间主控程序将与大量代理程序通讯,代理程序已经被安装在网络上的许多计算机上。代理程序收到指令时就发动攻击。利用客户/服务器技术,主控程序能在几秒钟内激活成百上千次代理程序的运行。
此文中的API将导航列为国家,非本人立场,导航属于中国,导航岛生活的人不一定!
上码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | #!/usr/bin/python #coding=utf-8 ''' http://ip-api.com/json/ip '''import plotly import plotly.plotly import plotly.graph_objs as abcc import plotly.plotly class Piecharts: def __init__(self): print 饼图生成中 def makePiecharts(self,labels,values,filename): trace = abcc.Pie(labels = labels,values= values) plotly.offline.plot([trace],filename=filename) import requests import sys try: iplist = sys.argv[1] except: print IP list not given or some other error! countrylist = {} regionlist = {} citylist = {} with open(iplist) as f: for ip in f.readlines(): if ip.strip() != '': url = 'http://ip-api.com/json/' + ip.strip() try: result = requests.get(url) jsontext = result.json() except: print Error: Data not retrieved! continue status = jsontext['status'] if status == 'fail': print %s failed! % ip.strip() continue mline = jsontext['as'] city = jsontext['city'] country = jsontext['country'] countryCode = jsontext['countryCode'] isp = jsontext['isp'] lat = jsontext['lat'] lon = jsontext['lon'] org = jsontext['org'] query = jsontext['query'] region = jsontext['region'] regionName = jsontext['regionName'] timezone = jsontext['timezone'] zipcode = jsontext['zip'] if not country in countrylist: countrylist[country] = 0 else: countrylist[country] += 1 if not regionName in regionlist: regionlist[regionName] = 0 else: regionlist[regionName] += 1 if not city in citylist: citylist[city] = 0 else: citylist[city] += 1 try: print ip.strip() + '--' + country + '--' + regionName except: print Special character! print countrylist #country labels = [i for i in countrylist] value = [countrylist[i] for i in countrylist] drive = Piecharts() drive.makePiecharts(labels,value,country.html) #region labels = [i for i in regionlist] value = [regionlist[i] for i in regionlist] drive = Piecharts() drive.makePiecharts(labels,value,region.html) #city labels = [i for i in citylist] value = [citylist[i] for i in citylist] drive = Piecharts() |