0

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!

  • Is it possible for you to ask the question with fewer details and still expose the problem (i.e. does this have anything to do with scapy and does this have everything to do with the python/js interface)? Take a look at https://stackoverflow.com/help/minimal-reproducible-example – Ross Jacobs May 04 '21 at 01:01
  • I edited my post so it's easier to answer. Don't hesitate to tell me if i need to re-improve my post @RossJacobs . Thanks – Victor Soler May 04 '21 at 15:54

0 Answers0