通過LyScript實(shí)現(xiàn)從文本中讀寫ShellCode_第1頁
通過LyScript實(shí)現(xiàn)從文本中讀寫ShellCode_第2頁
通過LyScript實(shí)現(xiàn)從文本中讀寫ShellCode_第3頁
全文預(yù)覽已結(jié)束

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

第通過LyScript實(shí)現(xiàn)從文本中讀寫ShellCodeLyScript插件通過配合內(nèi)存讀寫,可實(shí)現(xiàn)對(duì)特定位置的ShellCode代碼的導(dǎo)出,或者將一段存儲(chǔ)在文本中的ShellCode代碼插入到程序堆中,此功能可用于快速將自己編寫的ShellCode注入到目標(biāo)進(jìn)程中,以用于后續(xù)測試工作。

LyScript項(xiàng)目地址:/lyshark/LyScript

將本地ShellCode注入到堆中:第一種用法是將一個(gè)本地文本中的ShellCode代碼導(dǎo)入到堆中。

首先準(zhǔn)備一個(gè)文本文件,將生成的shellcode放入文件內(nèi)。

然后可以循環(huán)讀取文本,并逐個(gè)將shellcode注入到目標(biāo)堆空間中。

fromLyScript32importMyDebug

#將shellcode讀入內(nèi)存

defread_shellcode(path):

shellcode_list=[]

withopen(path,"r",encoding="utf-8")asfp:

forindexinfp.readlines():

shellcode_line=index.replace('"',"").replace("","").replace("\n","").replace(";","")

forcodeinshellcode_line.split("\\x"):

ifcode!=""andcode!="\\n":

shellcode_list.append("0x"+code)

returnshellcode_list

if__name__=="__main__":

dbg=MyDebug()

dbg.connect()

#開辟堆空間

address=dbg.create_alloc(1024)

print("開辟堆空間:{}".format(hex(address)))

ifaddress==False:

exit()

#設(shè)置內(nèi)存可執(zhí)行屬性

dbg.set_local_protect(address,32,1024)

#從文本中讀取shellcode

shellcode=read_shellcode("d://shellcode.txt")

#循環(huán)寫入到內(nèi)存

forcode_byteinrange(0,len(shellcode)):

bytef=int(shellcode[code_byte],16)

dbg.write_memory_byte(code_byte+address,bytef)

#設(shè)置EIP位置

dbg.set_register("eip",address)

input()

dbg.delete_alloc(address)

dbg.close()

執(zhí)行后,堆空間內(nèi)會(huì)自動(dòng)填充。

如果把這個(gè)過程反過來,就是將特定位置的匯編代碼保存到本地。

fromLyScript32importMyDebug

#將特定內(nèi)存保存到文本中

defwrite_shellcode(dbg,address,size,path):

withopen(path,"a+",encoding="utf-8")asfp:

forindexinrange(0,size-1):

#讀取機(jī)器碼

read_code=dbg.read_memory_byte(address+index)

if(index+1)%16==0:

print("\\x"+str(read_code))

fp.write("\\x"+str(read_code)+"\n")

else:

print("\\x"+str(read_code),end="")

fp.write("\\x"+str(read_code))

if__name__=="__main__":

dbg=MyDebug()

dbg.connect()

eip=dbg.ge

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論