-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpacket.py
24 lines (18 loc) · 843 Bytes
/
packet.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import base64
from scapy.all import *
# Define a function to modify and send packets
def modify_and_send_packet(packet):
# Base64 encode the payload of the packet
packet[Raw].load += b" <a href='https://www.youtube.com/watch?v=2QF0ylMF0pA'>Click here</a>" # Append a weblink to the end of the packet
payload = packet[Raw].load
encoded_payload = base64.b64encode(payload)
# Replace the payload with the base64 encoded payload
packet[Raw].load = encoded_payload
# Send the modified packet out on the network
send(packet)
# Set up a packet capture filter to capture outgoing packets
capture_filter = "dst host not localhost and outbound"
# Set up a packet capture object to capture outgoing packets
capture = sniff(filter=capture_filter, prn=modify_and_send_packet)
# Start the packet capture
capture.run()