EEL Waiting for localhost

191 Views Asked by At

My issue :

Hello!

I'm trying to do a project with scapy (https://scapy.net/ , a tool to create some internet packets) alongside EEL (for the front-end).

In my python i have a function called Attack(). I call this function in js with eel ( SYN() in JS )

I have another function, called returned() (which return a global variable to see if the user clicked on stop button, and a stop() function to change the global variable.

The thing is, because my Attack() is using while, eel cannot execute the returned() function, and i don't know how to solve this problem.

main.py

def SYNActive(target_ipn, dportn):
    #The attack with Scapy



@eel.expose
def Attack(target_ipn, dportn):
    while n == 0:
        _thread.start_new_thread(SYNActive, (target_ipn, dportn))#Launch attack
        _thread.start_new_thread(checkifStop,(),)#Check the JS global variable
        print(n)

pythonEXE.js

var i=0
//function that is triggered with the button
function stop(){
    i=1
}

//function that stop the python function
eel.expose(returned)
function returned(){
    return i
}



//function that call python
function SYN(){
    var IP= document.getElementById("Ipinput").value
    var Port = document.getElementById("PortInput").value
    eel.Attack(IP, Port)


}

Sorry for my english, sorry if i'm not clear, or if i'm doing something wrong, i'm newbie to stackoverflow, thanks!

0

There are 0 best solutions below