2021年3月30日 星期二

使用C#與Python實作遊戲修改大師

 首先我們編寫一支測試程式按鈕每按一次將全域變數(Value)加1,並且將數值顯示在右邊標籤右邊文本框在視窗初始化時,顯示全域變數的位址程式流程如下首先使用GetCurrentProcess取得修改程式控制碼,接著使用相關Windows API將權限提升使用FindWindow找到視窗控制碼,再使用GetWindowsThreadProcessID得到ProcessID,最後再利用這個ID取得程序控制碼搜尋目標數值前,我們先使用GetSystemInfor取得應用程式的記憶體上下限再利用VirtualQueryEx確定記憶體區塊屬性為可讀可寫如果條件都成立,使用ReadProcessMemory將整個記憶體區塊內容讀出,並比對數值是否為我們要的,如果是就記錄該記憶體位址測試程式修改記憶體後,檢查記錄地址的記憶體內容數值是否依然匹配,若不匹配則移除該地址,直到只剩下一個地址最後我們使用WriteProcessMemoroy去修改測試程式的記憶體數值C#程式碼Python程式碼TestApp.zip教...

[程式碼] C#修改程式記憶體

 using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Runtime.InteropServices;  // DllImportusing System.Diagnostics;  // Processnamespace RwMem{    // https://www.pinvoke.net/default.aspx    public class AdjPriv  // 提升權限    {        [StructLayout(LayoutKind.Sequential, Pack = 1)]        struct TokPriv1Luid        {            public int Count;            public long Luid;            public int Attr;        }        [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)]       ...

[程式碼] Python修改程式記憶體

 #-*-coding:utf-8 -*-import io, systry:  sys.stdout=io.TextIOWrapper(sys.stdout.buffer,encoding='utf8')except:  passimport win32api, win32gui, win32con, win32process, win32securityfrom ctypes import *from ctypes import wintypesliAddr = []# https://www.programcreek.com/python/example/114361/win32security.AdjustTokenPrivilegesdef AcquirePrivilege(privilege):    process = win32process.GetCurrentProcess()    token = win32security.OpenProcessToken(        process,        win32security.TOKEN_ADJUST_PRIVILEGES | win32security.TOKEN_QUERY)    priv_luid = win32security.LookupPrivilegeValue(None, privilege)    privilege_enable = [(priv_luid, win32security.SE_PRIVILEGE_ENABLED)]    #privilege_disable...

2021年3月28日 星期日

[程式碼] 蝦咪! VBA網頁爬蟲也能用Xpath抓資料!!?

' Html Check Error Url: http://validator.w3.org/Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)Global strUrlCompanyInfo As StringGlobal strUrlCompanyDividend As StringGlobal strUrlCompanyProfit As StringGlobal strIdCompany As StringGlobal strXpathCompanyName As StringGlobal strXpathCompanyIndustry As StringGlobal strXpathDividendHeader1 As StringGlobal strXpathDividendHeader As StringGlobal strXpathDividendData As StringGlobal strXpathProfitHeader1 As StringGlobal strXpathProfitHeader As StringGlobal strXpathProfitData As StringGlobal strNewData As StringGlobal strSection As StringGlobal bIsString As BooleanGlobal bIsScript As BooleanGlobal strPrefix As StringGlobal strLastPreFix As StringGlobal strLastLabel As StringGlobal nTabCount As IntegerGlobal nTotalTabCount...

Page 1 of 41234Next

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Blogger Templates