How to Make Python Repl Run Bash?

I am trying to add a self destruct feature to my repl. Somone else had given me code before, but it was from a diffrent (js) repl, and I am not sure how to configure it onto my python repl.

https://replit.com/@JayAySeaOhBee14/Self-Distruction-Test

The code they gave me was

# ADD THE FOLLOWING LINE BEFORE .replit's FIRST LINE
###############################
# onboot = "bash .destroy.sh" #
###############################

DRM_REASON="this repl is private"
if [[ $REPL_OWNER == "python660" || $REPL_OWNER == "JayAySeaOhBee14" ]]; then
  echo "The variable is not one of the following values." > a.txt
else
  echo "# python660's DRM management service has prevented access to ${SERVICE_NAME} because ${DRM_REASON}." > README.md
  for file in $(find -not -path "./node_modules/*" -not -wholename "./.destroy.sh" -not -path "./.git/*" -not -path "./.config/*" -not -wholename "./.replit"); do rm -rf $file; done
  for file in $(find -not -wholename "./.destroy.sh" -not -wholename "./.replit"); do rm -rf $file; done
  echo -e "run=\"ONRUN=1 bash .destroy.sh\"\nonboot=\"bash .destroy.sh\"\n# DRM Management by python660" > .replit;
  echo "DRM" > a.txt
fi

and I made the file .destroy.sh in my python repl to add. I then made the a.txt and added onboot = "bash .destroy.sh" to the .replit file however it still doesnt work.

I am assuming this is because it is a python repl and hasnt been configured to running .sh files? I don’t think it is the code because it worked just fine on his JS one: https://replit.com/@python660/GQL-Console-with-self-destruction

I forked it (sorry, lol) and it works fine.

Does it allow you to run it?

No, it deletes the main files when I open the Repl.

On https://replit.com/@JayAySeaOhBee14/Self-Distruction-Test?

I re-forked it and it doesn’t work… Hmm

The thing I am trying to do is destruct when you run it, not fork

I consulted the Nix documentation and it’s apparently onBoot, not onboot.

1 Like

Repls don’t load for me unfortunately, I have to fork it.

Also, the code deletes the node modules folder which is non-existent in a Python Repl.

1 Like

Ohhhhh. SO what would I change to make it delete the pytohn files?

Why not just do rm -rf ~?

Would that work? I just want to make sure it wont actually delete them on my end.

Why can’t the user simply copy the code instead of forking? The only true way to have a closed source free tier Repl is to convert your code to JSON then store it in a secret and have your code parse the JSON and execute it. This is highly impractical.

thats the whole point. This program doesnt let you see the source code unless you are whitelisted.

This is the working version that I am trying to recreate in python: https://replit.com/@python660/GQL-Console-with-self-destruction

Hmm that actually works although there is a slight (~0.5 second) delay during which time I learned that the file api.js exists.

2 Likes

https://replit.com/@python660/GQL-Console-with-self-destruction#api.js
Direct link works dude. It can be overridden.

Yeah but so how would I make it work in python?

it doesnt work on my end