Python Callback function as a Backdoor

by: Dollar, 8 years ago


Im novice at python, Being a Security Analyst, I deal with quite many tools built on Python,  I always wonder
Is there anyway to run the callback function using python (Auto execution based on Timestamp).

I once tried importing 'os' module to hold the shell, but I have failed though the server has python in built. My question is that, what do a python program need to run by itself without any listeners



You must be logged in to post. Please login or register an account.



Not totally sure I follow your question.

If you just want python to run in the background, you can either just run it manually with nohup, or you can setup a cronjob.

If you just want it to run forever, just encase whatever it is you're running within a while True loop.

-Harrison 8 years ago

You must be logged in to post. Please login or register an account.


Thanks for the response Harrison, Allow me to make it clear. When I inject malicious LFI (Local File Inclusion - which is some python script) in the application, it should execute by itself based on the timestamp mentioned in the python script

-Dollar 8 years ago

You must be logged in to post. Please login or register an account.


You cannot simply write a Python script to execute itself at some time step, you need to have another script/application call it, like the crontab or another script that's running. Something has to call it into running.

if it is already running, but you want it to actually DO something at some time, just check the time (import time, then do time.time()) for unix time, or you can use datetime to convert it to something more pleasant.

-Harrison 8 years ago
Last edited 8 years ago

You must be logged in to post. Please login or register an account.