一区二区日本_久久久久久久国产精品_无码国模国产在线观看_久久99深爱久久99精品_亚洲一区二区三区四区五区午夜_日本在线观看一区二区

Python利用LyScript插件實現(xiàn)批量打開關(guān)閉進程

LyScript是一款x64dbg主動化操控插件,經(jīng)過Python操控X64dbg,完成了遠程動態(tài)調(diào)試,解決了逆向開發(fā)者剖析漏洞,尋覓指令片段,原生不行強壯得問題,經(jīng)過與Python相結(jié)合使用Python語法得靈活性以及豐富得第三方庫,進步剖析功率,完成主動化剖析代碼。

python包請裝置與插件一致得版別,在cmd命令行下履行pip命令即可裝置。

裝置Python包:pipinstallLyScript32或者pipinstallLyScript64

其次你需求手動下載對應(yīng)x64dbg版別得驅(qū)動文件,并放入指定目錄下。

插件下載好以后,請將該插件復(fù)制到x64dbg目錄下得plugins目錄下,程序運轉(zhuǎn)后會主動加載插件文件。

當插件加載成功后,會在日志方位看到具體得綁定信息以及輸出調(diào)試,該插件并不會在插件欄顯示。

假如需求遠程調(diào)試,則只需求在初始化MyDebug()類是傳入對端IP地址即可,假如不填寫參數(shù)則默認使用127.0.0.1地址,請保證對端放行了6589端口,不然無法銜接。

運轉(zhuǎn)x64dbg程序并手動載入需求剖析得可履行文件,然后我們能夠經(jīng)過connect()方法銜接到調(diào)試器,銜接后會創(chuàng)建一個持久會話直到python完畢則銜接會被強制斷開,在此期間可調(diào)用is_connect()查看該鏈接是否還存在,具體代碼如下所示。

fromLyScript32importMyDebugif__name__==”__main__”:#初始化dbg=MyDebug()#銜接到調(diào)試器connect_flag=dbg.connect()print(“銜接狀況:{}”.format(connect_flag))#檢測套接字是否還在???????ref=dbg.is_connect()print(“是否在銜接:”,ref)dbg.close()

LyScript插件默認沒有批量載入功能,導(dǎo)致用戶只能手動將被調(diào)試進程拖入到x64dbg中才可以調(diào)試,使用python模擬快捷鍵即可解決這個問題,具體使用代碼如下。

import win32apiimport win32gui, win32conimport win32clipboardimport reimport timefrom LyScript32 import MyDebugclass cWindow:    def __init__(self):        self._hwnd = None    def SetAsForegroundWindow(self):        win32gui.SetForegroundWindow(self._hwnd)    def Maximize(self):        # 最大化        win32gui.ShowWindow(self._hwnd, win32con.SW_MAXIMIZE)    def _window_enum_callback(self, hwnd, regex):        if self._hwnd is None and re.match(regex, str(win32gui.GetWindowText(hwnd))) is not None:            self._hwnd = hwnd    def find_window_regex(self, regex):        self._hwnd = None        win32gui.EnumWindows(self._window_enum_callback, regex)    def hide_always_on_top_windows(self):        win32gui.EnumWindows(self._window_enum_callback_hide, None)    def _window_enum_callback_hide(self, hwnd, unused):        if hwnd != self._hwnd:            if win32gui.IsWindowVisible(hwnd) and win32gui.GetWindowLong(hwnd, win32con.GWL_EXSTYLE) & win32con.WS_EX_TOPMOST:                className = win32gui.GetClassName(hwnd)                if not (className == 'Button' or className == 'Shell_TrayWnd'):                    win32gui.ShowWindow(hwnd, win32con.SW_FORCEMINIMIZE)    def OpenFile(self,path):        # 按下F3        win32api.keybd_event(0x72, 0, 0, 0)        win32api.keybd_event(0x72, 0, win32con.KEYEVENTF_KEYUP, 0)        # 打開剪貼板        win32clipboard.OpenClipboard()        # 清空剪貼板        win32clipboard.EmptyClipboard()        # 設(shè)置剪貼板內(nèi)容        win32clipboard.SetClipboardData(win32con.CF_UNICODETEXT, path)        # 獲取剪貼板內(nèi)容        date = win32clipboard.GetClipboardData()        print("[*] OpenFile = {}".format(date))        # 關(guān)閉剪貼板        win32clipboard.CloseClipboard()        time.sleep(0.2)        # 按下ctrl+v        win32api.keybd_event(0x11, 0, 0, 0)        win32api.keybd_event(0x56, 0, 0, 0)        win32api.keybd_event(0x56, 0, win32con.KEYEVENTF_KEYUP, 0)        win32api.keybd_event(0x11, 0, win32con.KEYEVENTF_KEYUP, 0)        # 按下回車        win32api.keybd_event(0x0D, 0, 0, 0)        win32api.keybd_event(0x0D, 0, win32con.KEYEVENTF_KEYUP, 0)    def deatch(self):        # 按下Ctrl+Alt+F2        win32api.keybd_event(0x11, 0, 0, 0)        win32api.keybd_event(0x12, 0, 0, 0)        win32api.keybd_event(0x71, 0, 0, 0)        win32api.keybd_event(0x11, 0, win32con.KEYEVENTF_KEYUP, 0)        win32api.keybd_event(0x12, 0, win32con.KEYEVENTF_KEYUP, 0)        win32api.keybd_event(0x71, 0, win32con.KEYEVENTF_KEYUP, 0)# 打開調(diào)試程序def OpenFile(path):    regex = ".*x32dbg.*"    cWindows = cWindow()    cWindows.find_window_regex(regex)    cWindows.SetAsForegroundWindow()    cWindows.SetAsForegroundWindow()    cWindows.OpenFile(path)# 關(guān)閉調(diào)試程序def DeatchFile():    regex = ".*x32dbg.*"    cWindows = cWindow()    cWindows.find_window_regex(regex)    cWindows.SetAsForegroundWindow()    cWindows.SetAsForegroundWindow()    cWindows.deatch()# 得到返回值def GetScriptValue(dbg,script):    try:        ref = dbg.run_command_exec("push eax")        if ref != True:            return None        ref = dbg.run_command_exec(f"eax={script}")        if ref != True:            return None        reg = dbg.get_register("eax")        ref = dbg.run_command_exec("pop eax")        if ref != True:            return None        return reg    except Exception:        return None    return Noneif __name__ == "__main__":    dbg = MyDebug()    dbg.connect()    # 批量打開一個列表    for item in ["D:Win32Project.exe","D:Windows ToolsC32ASMc32asm.exe"]:        OpenFile(item)        time.sleep(3)        for i in range(1,100):            dbg.set_debug("StepIn")            time.sleep(0.2)        eip = dbg.get_register("eip")        print("eip = > {}".format(hex(eip)))        time.sleep(3)        DeatchFile()

到此這篇關(guān)于Python利用LyScript插件實現(xiàn)批量打開關(guān)閉進程得內(nèi)容就介紹到這了,更多相關(guān)Python批量打開關(guān)閉進程內(nèi)容請搜索之家以前得內(nèi)容或繼續(xù)瀏覽下面得相關(guān)內(nèi)容希望大家以后多多支持之家!

聲明:所有內(nèi)容來自互聯(lián)網(wǎng)搜索結(jié)果,不保證100%準確性,僅供參考。如若本站內(nèi)容侵犯了原著者的合法權(quán)益,可聯(lián)系我們進行處理。
發(fā)表評論
更多 網(wǎng)友評論1 條評論)
暫無評論

返回頂部

主站蜘蛛池模板: 黄色大片免费观看 | 欧美一区二区三区免费在线观看 | 黄色一级大片在线免费看产 | 日韩中文字幕网 | 国产一区二区免费在线 | 免费在线观看av的网站 | 久久久激情视频 | 91资源在线| 免费视频一区 | 欧美在线视频网站 | 黄色成人在线 | 亚洲精品视频免费 | jlzzjlzz欧美大全 | 午夜在线影院 | 国产精品18hdxxxⅹ在线 | 色偷偷噜噜噜亚洲男人 | 日韩精品专区在线影院重磅 | 男女爱爱福利视频 | 亚洲乱码国产乱码精品精98午夜 | 91精品国产91久久久久游泳池 | 羞羞视频一区二区 | 免费观看黄色片视频 | 国产精品一区二区不卡 | 另类在线 | 久久精品黄色 | 四虎成人在线播放 | 日韩av免费在线观看 | 国产精品久久亚洲 | 一区二区视频在线 | 欧美黄色片 | 亚洲成人精选 | 亚洲人在线 | 日韩成人免费视频 | 欧美亚洲一区二区三区 | 日韩欧美国产精品 | 99热在线播放| 日韩成人精品在线 | 日韩亚洲视频 | 99热在线免费 | 成年免费在线观看 | 国产精品亚洲精品 |