Jump to content

Start DLL via Python?


DasSchwarzeT

Recommended Posts

  • Premium

You can do so: (like Fusion-Network // credits  to iSouli)

Run a batch via python, move the  dll to the client , and/or rename it to mix, then start the client exe. 

move "C:UsersiSouliDesktopiSouli~1Dark-FusionFusion-Networkcoreswitchbotv3.mix" "C:UsersiSouliDesktopiSouli~1Dark-FusionFusion-Networkswitchbotv3.mix"
taskkill /im Fusion-Network.exe
ping -n 2 127.0.0.1 > NUL
chdir C:UsersiSouliDesktopiSouli~1Dark-FusionFusion-Network
start Fusion-Network.exe
ping -n 2 127.0.0.1 > NUL
move "C:UsersiSouliDesktopiSouli~1Dark-FusionFusion-Networkswitchbotv3.mix" "C:UsersiSouliDesktopiSouli~1Dark-FusionFusion-Networkcoreswitchbotv3.mix"

You must just run the batch with a python command :)

  • Love 1
Link to comment
Share on other sites

  • Bronze

use to ctype module.

from ctypes import *
import sys,ctypes
import dbg

PAGE_RW_PRIV = 0x04
PROCESS_ALL_ACCESS = 0x1F0FFF
VIRTUAL_MEM = 0x3000

kernel32 = windll.kernel32

def dllInject(PID,dllPath):
	if(PID == 0 or dllPath == ""):
		dbg.LogBox("PID or dll path not entered.")
		sys.exit(0)
	
	LEN_DLL = len(dllPath)
	hProcess = kernel32.OpenProcess(PROCESS_ALL_ACCESS,False,PID)
	
	if(hProcess == None):
		dbg.LogBox("Unable to get process handle.")
		sys.exit(0)
	
	DLL_PATH_ADDR = kernel32.VirtualAllocEx(hProcess,0,LEN_DLL,VIRTUAL_MEM,PAGE_RW_PRIV)
	
	bool_Written = c_int(0)
	
	kernel32.WriteProcessMemory(hProcess,DLL_PATH_ADDR,dllPath,LEN_DLL,byref(bool_Written))
	kernel32DllHandler_addr = kernel32.GetModuleHandleA("kernel32")
	LoadLibraryA_func_addr = kernel32.GetProcAdress(kernel32DllHandler_addr,"LoadLibraryA")
	
	thread_id = c_ulong(0)
	
	if(not kernel32.CreateRemoteThread(hProcess,None,0,LoadLibraryA_func_addr,DLL_PATH_ADDR,0,byref(thread_id))):
		dbg.LogBox("Injection failed.")
		sys.exit(0)
	

Regards HaveBeen ;)

  • Love 1

Plain logic saves lives.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.