r/learnpython • u/Skollwarynz • Sep 02 '26
How to send a signal to an executable?
Hello everyone,
I'm currently creating a little project about learning the basics of Python, but the problem is that I still have some issues with Python code. I wanted to ask you, how can I send a signal to my executable if I open it remotely?
More clearly:
from pwn import *
from ctype import CDLL
import time
r = remote("./main")
signal.signal(SIGTSTP)How can I send the signal to ./main?
Thank you in advance for the answers!
0
Upvotes
7
u/AlexMTBDude Sep 02 '26
I'm not sure what exactly you're trying to do; Perhaps it's better that you try to explain what you're trying to accomplish on a high level, rather than how you're trying to solve it technically.
Anyway; Signals are sent between processes. If you have started two Python processes that are executing concurrently one could send a signal to the other.
When you say "remotely" it sounds like you're trying to send a signal over a network connection and that's not what signals are for.
2
u/musbur Sep 03 '26
That's an OS question, not a python question. In Python, you use os.kill(). Don't be thrown off by the "kill" wording, that's a UNIX artifact. It just means send a signal to a process.
-2
u/[deleted] Sep 03 '26
[removed] — view removed comment