Created
February 21, 2013 21:37
-
-
Save mannytoledo/5008487 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import cgi | |
import cgitb; cgitb.enable() | |
import socket | |
# addressing information of target | |
IPADDR = '8.4.2.1' | |
PORTNUM = 10000 | |
# enter the data content of the UDP packet as hex | |
PACKETDATA = 'f1a525da11f6'.decode('hex') | |
# initialize a socket, think of it as a cable | |
# SOCK_DGRAM specifies that this is UDP | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0) | |
# connect the socket, think of it as connecting the cable to the address location | |
s.connect((IPADDR, PORTNUM)) | |
# send the command | |
s.send(PACKETDATA) | |
# close the socket | |
s.close() | |
print "Content-type: text/html" | |
print """ | |
<html> | |
<head><title>Sample CGI Script</title></head> | |
<body> | |
<p>Packet Sent</p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment