polymorph icon indicating copy to clipboard operation
polymorph copied to clipboard

python importing modules into functions

Open majandres opened this issue 4 years ago • 1 comments

Hello Santiago,

I'm trying to use the sleep function from the time module, but when I import in the function, I get an error

Exception ignored in: 'netfilterqueue.global_callback'
Traceback (most recent call last):
  File "/home/andres/polymorph/venv/lib/python3.8/site-packages/polymorph/interceptor.py", line 69, in linux_modify
    pkt = function(self.packet)
TypeError: 'module' object is not callable

how could I use sleep in a function?

thank you

majandres avatar Oct 27 '20 18:10 majandres

Hi @majandres,

Try to perform the import within the function:

def test_func(packet):
    import time
    time.sleep(4)
    return packet

shramos avatar Oct 30 '20 18:10 shramos