51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

查看: 1246|回复: 1
打印 上一主题 下一主题

介绍一款安全测试工具——LOIC

[复制链接]
  • TA的每日心情
    无聊
    昨天 09:14
  • 签到天数: 938 天

    连续签到: 5 天

    [LV.10]测试总司令

    跳转到指定楼层
    1#
    发表于 2022-3-10 09:58:20 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
     一、什么是LOIC
      LOIC是一款专著于web应用程序的Dos/DDOS攻击工具,它可以用TCP数据包、UDP数据包、HTTP请求于对目标网站进行DDOS/DOS测试,不怀好意的人可能利用LOIC构建僵尸网络。
      LOIC是一个非常好的DOS/DDOS攻击工具,禁止用于非法用途,使用它你自己承担风险,与本帖无关。

    二、LOIC的功能用法
      界面上的功能比较清晰明显,根据提示的相应字段输入被攻击的信息即可。
      1、URL:输入被攻击的URL,如:www.xxx.com,需要注意的是URL而不是域名。IP:输入被攻击的IP。
      2、Lock on:点击【Lock on】可以获取目标URL的ip地址。
      3、Port:设置被攻击的端口号。
      4、Method:设置被攻击的Method方法。
      5、Thread:设置线程数。
      6、Speed:设置攻击速度(攻击速度一般默认)。
      7、点击IMMA CHARGIN MAH LAZER开始发报文。

    三、其他工具
    #!/usr/bin/python
      #coding=utf-8
      import dpkt
      import socket
      import optparse
      # 默认设置检测不正常数据包的数量的阈值为1000
      THRESH = 1000
      def findDownload(pcap):
          for (ts, buf) in pcap:
              try:
                  eth = dpkt.ethernet.Ethernet(buf)
                  ip = eth.data
                  src = socket.inet_ntoa(ip.src)
                  # 获取TCP数据
                  tcp = ip.data
                  # 解析TCP中的上层协议HTTP的请求
                  http = dpkt.http.Request(tcp.data)
                  # 若是GET方法,且请求行中包含“.zip”和“loic”字样则判断为下载LOIC
                  if http.method == 'GET':
                      uri = http.uri.lower()
                      if '.zip' in uri and 'loic' in uri:
                          print "[!] " + src + " Downloaded LOIC."
              except:
                  pass
      def findHivemind(pcap):
          for (ts, buf) in pcap:
              try:
                  eth = dpkt.ethernet.Ethernet(buf)
                  ip = eth.data
                  src = socket.inet_ntoa(ip.src)
                  dst = socket.inet_ntoa(ip.dst)
                  tcp = ip.data
                  dport = tcp.dport
                  sport = tcp.sport
                  # 若目标端口为6667且含有“!lazor”指令,则确定是某个成员提交一个攻击指令
                  if dport == 6667:
                      if '!lazor' in tcp.data.lower():
                          print '[!] DDoS Hivemind issued by: '+src
                          print '[+] Target CMD: ' + tcp.data
                  # 若源端口为6667且含有“!lazor”指令,则确定是服务器在向HIVE中的成员发布攻击的消息
                  if sport == 6667:
                      if '!lazor' in tcp.data.lower():
                          print '[!] DDoS Hivemind issued to: '+src
                          print '[+] Target CMD: ' + tcp.data
              except:
                  pass
      def findAttack(pcap):
          pktCount = {}
          for (ts, buf) in pcap:
              try:
                  eth = dpkt.ethernet.Ethernet(buf)
                  ip = eth.data
                  src = socket.inet_ntoa(ip.src)
                  dst = socket.inet_ntoa(ip.dst)
                  tcp = ip.data
                  dport = tcp.dport
                  # 累计各个src地址对目标地址80端口访问的次数
                  if dport == 80:
                      stream = src + ':' + dst
                      if pktCount.has_key(stream):
                          pktCount[stream] = pktCount[stream] + 1
                      else:
                          pktCount[stream] = 1
              except:
                  pass
          for stream in pktCount:
              pktsSent = pktCount[stream]
              # 若超过设置检测的阈值,则判断为进行DDoS攻击
              if pktsSent > THRESH:
                  src = stream.split(':')[0]
                  dst = stream.split(':')[1]
                  print '[+] ' + src + ' attacked ' + dst + ' with ' + str(pktsSent) + ' pkts.'
      def main():
          parser = optparse.OptionParser("
  • Usage python findDDoS.py -p <pcap file> -t <thresh>")
          parser.add_option('-p', dest='pcapFile', type='string', help='specify pcap filename')
          parser.add_option('-t', dest='thresh', type='int', help='specify threshold count ')
          (options, args) = parser.parse_args()
          if options.pcapFile == None:
              print parser.usage
              exit(0)
          if options.thresh != None:
              THRESH = options.thresh
          pcapFile = options.pcapFile
          # 这里的pcap文件解析只能调用一次,注释掉另行修改
          # f = open(pcapFile)
          # pcap = dpkt.pcap.Reader(f)
          # findDownload(pcap)
          # findHivemind(pcap)
          # findAttack(pcap)
          with open(pcapFile, 'r') as f:
              pcap = dpkt.pcap.Reader(f)
              findDownload(pcap)
          with open(pcapFile, 'r') as f:
              pcap = dpkt.pcap.Reader(f)
              findHivemind(pcap)
          with open(pcapFile, 'r') as f:
              pcap = dpkt.pcap.Reader(f)
              findAttack(pcap)
      if __name__ == '__main__':
          main()




  • 本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有帐号?(注-册)加入51Testing

    x
    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    收藏收藏
    回复

    使用道具 举报

  • TA的每日心情
    开心
    2021-6-9 14:08
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    2#
    发表于 2022-3-11 16:45:26 | 只看该作者
    这个不太能够看懂呀
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-4-27 11:03 , Processed in 0.063026 second(s), 23 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表