It's kind of hard to explain by situation. I'll try the best I can.
I'm making a program to make using driftnet easier for new users.
You first enter the gateway IP and then the target IP, the your interface. In the program, once you enter all those, it opens a new terminal window, you then start the second program which flips the original order of the IPs. I could have it for the user to manually switch it, but I want it to just automatically switch it. To do that I have to use global
to keep the input information, so it will just switch it. The problem is when I run the second program it just starts the first one all over again.
#This it the first program
#"Driftnet.py"
import os
import time
from subprocess import call
def drift():
global gateway
gateway = raw_input("Gateway IP > ")
time.sleep(0.5)
global target
target = raw_input("Target IP > ")
time.sleep(0.5)
global inter
inter = raw_input("Interface > ")
drift()
call(["gnome-terminal"])
os.system("arpspoof -i " + inter + " -t " + gateway + " " + target)
I run that, input everything, then it opens the second terminal, and I run the second program where it switches the IPs.
#This is the second program
#"Driftnet2.py"
import os
import time
from subprocess import call
import Driftnet
os.system("arpspoof -i " + Driftnet.inter + " -t " + Driftnet.target + " " + Driftnet.gateway)
When I run that it pretty much just runs the frist program, starting with the question of "Gateway IP > "
I have utterly no clue what I'm doing wrong.
Thanks