Meta

snippet

So.. I started programming in python this weekend. I’ve touched on it before but never really gave it a fair chance. I was looking for a while on how to set an interface into promiscuous mode for some arp spoofing tool that i’m creating and while searching couldn’t really find anything….

so here is my little snippet for anyone looking to do the same thing:

import socket;import struct;import fcntl;

SIOCGIFFLAGS = 0x8913;SIOCSIFFLAGS = 0x8914;IFF_PROMISC = 0x100;

current_flags = 0;

sd = socket.socket(socket.PF_PACKET, socket.SOCK_RAW);

# This will return the current flags present on the interfaceifreq = fcntl.ioctl(sd, SIOCGIFFLAGS, “eth0” + “” * 256);