Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Questions| is there a way i can make my python script add itself to the registry?

is there a way to make my python script add itself to the registry
when i execute the script for the first time?
maybe this is what you are looking for :
https://docs.python.org/2/library/_winreg.html

There's the hard way (do not recommend):
PHP Code

<?php 
import os
cmd 
= 'reg add "HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run" /V "StartupPythonScript" /t REG_SZ /F /D "C:\\Windows\\System32\\cmd.exe /k \'python {}\'"'.format(os.path.abspath(__file__))
system(cmd) 

I think that'll work. May need some tinkering. Also, must be run as admin. You can also use _winreg (renamed to winreg without underscore in Pythhon3). I can't be bothered to google it, but RiperFish posted a link to everything you need.

Important command:
cmd.exe /k "python script.py"
SRPP Discord Server

I am a professional network/cloud security architect.
My Old Tutorials


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by Bass_ReevesAug 20, 2023 01:44 AM 9 632 Aug 20, 2023 01:44 AM
Last Post: Lucky4L
[Python] by Bane PopaMar 13, 2020 09:49 PM 5 228 Mar 13, 2020 09:49 PM
Last Post: Nulla Misericordia
[Python] by streetlawkarmaOct 12, 2018 11:53 AM 1 167 Oct 12, 2018 11:53 AM
Last Post: m0noxide