佳木斯湛栽影视文化发展公司

主頁 > 知識庫 > 分析攻擊IP來源地與防御IP攻擊的應(yīng)對策略

分析攻擊IP來源地與防御IP攻擊的應(yīng)對策略

熱門標(biāo)簽:鐵路電話系統(tǒng) 網(wǎng)站文章發(fā)布 服務(wù)器配置 呼叫中心市場需求 智能手機 檢查注冊表項 銀行業(yè)務(wù) 美圖手機

分布式拒絕服務(wù)(DDoS)攻擊指借助于客戶/服務(wù)器技術(shù),將多個計算機聯(lián)合起來作為攻擊平臺,對一個或多個目標(biāo)發(fā)動DDoS攻擊,從而成倍地提高拒絕服務(wù)攻擊的威力。通常,攻擊者使用一個偷竊帳號將DDoS主控程序安裝在一個計算機上,在一個設(shè)定的時間主控程序?qū)⑴c大量代理程序通訊,代理程序已經(jīng)被安裝在網(wǎng)絡(luò)上的許多計算機上。代理程序收到指令時就發(fā)動攻擊。利用客戶/服務(wù)器技術(shù),主控程序能在幾秒鐘內(nèi)激活成百上千次代理程序的運行。

此文中的API將臺灣列為國家,非本人立場,臺灣屬于中國,臺灣島生活的人不一定!
上碼:

#!/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() 
  drive.makePiecharts(labels,value,"city.html") 

gevent協(xié)程并發(fā)版

#!/usr/bin/python
# coding=utf-8
'''
http://ip-api.com/json/ip
'''
import plotly
import plotly.graph_objs as abcc
import plotly.plotly

class Piecharts:
  def __init__(self):
    print u'餅圖生成中'

  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 = {}

def locater(url):
  try:
    result = requests.get(url)
    jsontext = result.json()
  except:
    print "Error: Data not retrieved!"
    return
  status = jsontext['status']
  if status == 'fail':
    print "%s failed!" % ip.strip()
    return
  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!"

from gevent import monkey
monkey.patch_socket()
from gevent import pool
import gevent

pool = pool.Pool(40)
glist = []
with open(iplist) as f:
  for ip in f.readlines():
    if ip.strip() != '':
      url = 'http://ip-api.com/json/' + ip.strip()
      glist.append(pool.spawn(locater, url))
  gevent.joinall(glist)

  # 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()
  drive.makePiecharts(labels, value, "city.html")

餅圖效果:

在對網(wǎng)絡(luò)攻擊進(jìn)行上述分析與識別的基礎(chǔ)上,我們應(yīng)當(dāng)認(rèn)真制定有針對性的策略。明確安全對象,設(shè)置強有力的安全保障體系。有的放矢,在網(wǎng)絡(luò)中層層設(shè)防,發(fā)揮網(wǎng)絡(luò)的每層作用,使每一層都成為一道關(guān)卡,從而讓攻擊者無隙可鉆、無計可使。還必須做到未雨稠繆,預(yù)防為主 ,將重要的數(shù)據(jù)備份并時刻注意系統(tǒng)運行狀況。以下是針對眾多令人擔(dān)心的網(wǎng)絡(luò)安全問題,提出的幾點建議:

1、提高安全意識

  (1)不要隨意打開來歷不明的電子郵件及文件,不要隨便運行不太了解的人給你的程序,比如“特洛伊”類黑客程序就需要騙你運行。
  (2)盡量避免從Internet下載不知名的軟件、游戲程序。即使從知名的網(wǎng)站下載的軟件也要及時用最新的病毒和木馬查殺軟件對軟件和系統(tǒng)進(jìn)行掃描。
  (3)密碼設(shè)置盡可能使用字母數(shù)字混排,單純的英文或者數(shù)字很容易窮舉。將常用的密碼設(shè)置不同,防止被人查出一個,連帶到重要密碼。重要密碼最好經(jīng)常更換。
  (4)及時下載安裝系統(tǒng)補丁程序。
  (5)不隨便運行黑客程序,不少這類程序運行時會發(fā)出你的個人信息。
  (6)在支持HTML的BBS上,如發(fā)現(xiàn)提交警告,先看源代碼,很可能是騙取密碼的陷阱。

2、使用防毒、防黑等防火墻軟件。

防火墻是一個用以阻止網(wǎng)絡(luò)中的黑客訪問某個機構(gòu)網(wǎng)絡(luò)的屏障,也可稱之為控制進(jìn)/出兩個方向通信的門檻。在網(wǎng)絡(luò)邊界上通過建立起來的相應(yīng)網(wǎng)絡(luò)通信監(jiān)控系統(tǒng)來隔離內(nèi)部和外部網(wǎng)絡(luò),以阻檔外部網(wǎng)絡(luò)的侵入。

3、設(shè)置代理服務(wù)器,隱藏自已的IP地址。

保護(hù)自己的IP地址是很重要的。事實上,即便你的機器上被安裝了木馬程序,若沒有你的IP地址,攻擊者也是沒有辦法的,而保護(hù)IP地址的最好方法就是設(shè)置代理服務(wù)器。代理服務(wù)器能起到外部網(wǎng)絡(luò)申請訪問內(nèi)部網(wǎng)絡(luò)的中間轉(zhuǎn)接作用,其功能類似于一個數(shù)據(jù)轉(zhuǎn)發(fā)器,它主要控制哪些用戶能訪問哪些服務(wù)類型。當(dāng)外部網(wǎng)絡(luò)向內(nèi)部網(wǎng)絡(luò)申請某種網(wǎng)絡(luò)服務(wù)時,代理服務(wù)器接受申請,然后它根據(jù)其服務(wù)類型、服務(wù)內(nèi)容、被服務(wù)的對象、服務(wù)者申請的時間、申請者的域名范圍等來決定是否接受此項服務(wù),如果接受,它就向內(nèi)部網(wǎng)絡(luò)轉(zhuǎn)發(fā)這項請求。

4、將防毒、防黑當(dāng)成日常例性工作,定時更新防毒組件,將防毒軟件保持在常駐狀態(tài),以徹底防毒。

5、由于黑客經(jīng)常會針對特定的日期發(fā)動攻擊,計算機用戶在此期間應(yīng)特別提高警戒。

總結(jié)

以上就是這篇文章的全部內(nèi)容了,希望本文的內(nèi)容對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,謝謝大家對腳本之家的支持。如果你想了解更多相關(guān)內(nèi)容請查看下面相關(guān)鏈接

您可能感興趣的文章:
  • 淺談html轉(zhuǎn)義及防止javascript注入攻擊的方法
  • 什么是JavaScript注入攻擊?
  • linux抵御DDOS攻擊 通過iptables限制TCP連接和頻率
  • 淺談利用JavaScript進(jìn)行的DDoS攻擊原理與防御
  • Linux系統(tǒng)防CC攻擊自動拉黑IP增強版(Shell腳本)
  • linux封鎖IP簡單防御UDP攻擊
  • IP攻擊升級,程序改進(jìn)以對付新的攻擊
  • php下網(wǎng)站防IP攻擊代碼,超級實用
  • 跨站式腳本(Cross-SiteScripting)XSS攻擊原理分析

標(biāo)簽:滄州 上海 河南 紅河 長治 樂山 沈陽 新疆

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《分析攻擊IP來源地與防御IP攻擊的應(yīng)對策略》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    达州市| 将乐县| 黄骅市| 祁东县| 灌南县| 冀州市| 措美县| 休宁县| 尼勒克县| 宕昌县| 聂拉木县| 开平市| 司法| 休宁县| 科技| 海城市| 武山县| 乌拉特中旗| 久治县| 车险| 平定县| 崇明县| 宜章县| 应城市| 珠海市| 增城市| 贵溪市| 云浮市| 双流县| 遵义县| 汉中市| 新丰县| 社旗县| 东丰县| 五峰| 金乡县| 丹凤县| 北辰区| 集安市| 建德市| 济南市|