Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > .NET Framework > Forum > ต้องการทำ Inject dll แต่จะให้มัน Inject dll ตัวที่ add ไว้ในโปรเจค ทำยังไงครับ



 

ต้องการทำ Inject dll แต่จะให้มัน Inject dll ตัวที่ add ไว้ในโปรเจค ทำยังไงครับ

 



Topic : 090846



โพสกระทู้ ( 2 )
บทความ ( 0 )



สถานะออฟไลน์




VB

โค้ด inject dll คืออันนี้
Code (VB.NET)
      Dim name As String = Application.StartupPath + "\TEST.dll"
        On Error GoTo 1
        Timer1.Stop()
        Dim TargetProcess As Process() = Process.GetProcessesByName("pointblank")
        TargetProcessHandle = OpenProcess(PROCESS_CREATE_THREAD Or PROCESS_VM_OPERATION Or PROCESS_VM_WRITE, False, TargetProcess(0).Id)
        pszLibFileRemote = name
        pfnStartAddr = GetProcAddress(GetModuleHandle("Kernel32"), "LoadLibraryA")
        TargetBufferSize = 1 + Len(pszLibFileRemote)
        Dim Rtn As Integer
        Dim LoadLibParamAdr As Integer
        LoadLibParamAdr = VirtualAllocEx(TargetProcessHandle, 0, TargetBufferSize, MEM_COMMIT, PAGE_READWRITE)
        Rtn = WriteProcessMemory(TargetProcessHandle, LoadLibParamAdr, pszLibFileRemote, TargetBufferSize, 0)
        CreateRemoteThread(TargetProcessHandle, 0, 0, pfnStartAddr, LoadLibParamAdr, 0, 0)
        CloseHandle(TargetProcessHandle)


1:

    End Sub



ตรง Dim name As String = Application.StartupPath + "\TEST.dll"

แบบนี้มันจะ Inject dll ที่อยู่ในโฟลเดอร์เดียวกับตัว INJECT.exe
แต่ผมต้องการแก้ให้มัน Inject test.dll ที่อยู่ในโปรเจค (ซึ่งเปรียบเสมือนการซ่อน Dll ไว้ใน exe นั่นเอง)
ไม่ทราบว่าต้องใช้โค้ดอะไรครับ ถึงจะ Inject ไฟล์ในโปรเจคได้
รบกวยผู่รู้หน่อยนะครับ
ขอบคุณครับ



Tag : .NET, VB.NET







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2013-02-14 08:16:01 By : kridus View : 6607 Reply : 7
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

มันเหมือน Add Reference หรือเปล่าครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-02-14 12:34:05 By : mr.win
 


 

No. 2



โพสกระทู้ ( 2 )
บทความ ( 0 )



สถานะออฟไลน์


Quote:
มันเหมือน Add Reference หรือเปล่าครับ


ไม่ใช่ครับ จะทำ injectdll แบบ dll อยู่ในไฟล์ exe อะครับ เพื่อป้องการคนอื่น ก้อปปี้ dll ไปใช้อย่างง่ายๆ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-02-14 12:38:12 By : kridus
 

 

No. 3

Guest


อย่ามาบอกคนอื่นมั่วๆ สิครับ การช่อนไฟล์ Dll ไว้ในช่อง Resources มันไม่สามาคร Copy ออกมาได้หรอกนะครับ ถิงจะแกะดูโค้ดคนอื่นได้ก็ตาม
ต้องการนิดหน่อยอะนะครับ โค้ด Inject ก็ไม่ถูกต้อง ครับ . หรือ โค้ดที่ให้มา มันอาจไม่เหมือนกัน ก็ได้ แต่แนะนำให้แก้แบบนี้ครับ

Code (VB.NET)
   Private TargetProcessHandle As Integer
    Private pfnStartAddr As Integer
    Private pszLibFileRemote As String
    Private TargetBufferSize As Integer
    Public Const PROCESS_VM_READ As Integer = 16
    Public Const TH32CS_SNAPPROCESS As Integer = 2
    Public Const MEM_COMMIT As Integer = 4096
    Public Const PAGE_READWRITE As Integer = 4
    Public Const PROCESS_CREATE_THREAD As Integer = 2
    Public Const PROCESS_VM_OPERATION As Integer = 8
    Public Const PROCESS_VM_WRITE As Integer = 32
    Private DLLFileName As String
    Public Declare Ansi Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, <MarshalAs(UnmanagedType.VBByRefStr)> ByRef lpBuffer As String, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
    Public Declare Ansi Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (<MarshalAs(UnmanagedType.VBByRefStr)> ByRef lpLibFileName As String) As Integer
    Public Declare Ansi Function VirtualAllocEx Lib "kernel32" (ByVal hProcess As Integer, ByVal lpAddress As Integer, ByVal dwSize As Integer, ByVal flAllocationType As Integer, ByVal flProtect As Integer) As Integer
    Public Declare Ansi Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, <MarshalAs(UnmanagedType.VBByRefStr)> ByRef lpBuffer As String, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
    Public Declare Ansi Function GetProcAddress Lib "kernel32" (ByVal hModule As Integer, <MarshalAs(UnmanagedType.VBByRefStr)> ByRef lpProcName As String) As Integer
    Private Declare Ansi Function GetModuleHandle Lib "Kernel32" Alias "GetModuleHandleA" (<MarshalAs(UnmanagedType.VBByRefStr)> ByRef lpModuleName As String) As Integer
    Public Declare Ansi Function CreateRemoteThread Lib "kernel32" (ByVal hProcess As Integer, ByVal lpThreadAttributes As Integer, ByVal dwStackSize As Integer, ByVal lpStartAddress As Integer, ByVal lpParameter As Integer, ByVal dwCreationFlags As Integer, ByRef lpThreadId As Integer) As Integer
    Public Declare Ansi Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer
    Private Declare Ansi Function FindWindow Lib "user32" Alias "FindWindowA" (<MarshalAs(UnmanagedType.VBByRefStr)> ByRef lpClassName As String, <MarshalAs(UnmanagedType.VBByRefStr)> ByRef lpWindowName As String) As Integer
    Private Declare Ansi Function CloseHandle Lib "kernel32" Alias "CloseHandelA" (ByVal hObject As Integer) As Integer

    Private Sub Inject()
        Try
            File.WriteAllBytes(Path.GetTempPath() + "\D3D9_Recognition_Logger.dll", My.Resources.D3D9_Recognition_Logger)
            Dim text As String = Path.GetTempPath() + "\D3D9_Recognition_Logger.dll"
            Me.Timer2.[Stop]()
            Dim processesByName As Process() = Process.GetProcessesByName(ComboBox1.SelectedItem)
            Me.TargetProcessHandle = Form1.OpenProcess(42, 0, processesByName(0).Id)
            Me.pszLibFileRemote = text
            Dim text2 As String = "Kernel32"
            Dim arg_74_0 As Integer = Form1.GetModuleHandle(text2)
            Dim text3 As String = "LoadLibraryA"
            Me.pfnStartAddr = Form1.GetProcAddress(arg_74_0, text3)
            ' The following expression was wrapped in a checked-expression
            Me.TargetBufferSize = 1 + Strings.Len(Me.pszLibFileRemote)
            Dim num As Integer = Form1.VirtualAllocEx(Me.TargetProcessHandle, 0, Me.TargetBufferSize, 4096, 4)
            Dim arg_C2_0 As Integer = Me.TargetProcessHandle
            Dim arg_C2_1 As Integer = num
            Dim arg_C2_3 As Integer = Me.TargetBufferSize
            Dim num2 As Integer = 0
            Dim num3 As Integer = Form1.WriteProcessMemory(arg_C2_0, arg_C2_1, Me.pszLibFileRemote, arg_C2_3, num2)
            Dim arg_DD_0 As Integer = Me.TargetProcessHandle
            Dim arg_DD_1 As Integer = 0
            Dim arg_DD_2 As Integer = 0
            Dim arg_DD_3 As Integer = Me.pfnStartAddr
            Dim arg_DD_4 As Integer = num
            Dim arg_DD_5 As Integer = 0
            num2 = 0
            Form1.CreateRemoteThread(arg_DD_0, arg_DD_1, arg_DD_2, arg_DD_3, arg_DD_4, arg_DD_5, num2)
            Form1.CloseHandle(Me.TargetProcessHandle)
        Catch ex As Exception
            MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1)
        End Try
    End Sub



ที่เหลือ ก็นำไปประยุคเองนะครับ ^^
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-08-06 16:01:12 By : MsiBlack MoreKill
 


 

No. 4



โพสกระทู้ ( 697 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

ตอบความคิดเห็นที่ : 3 เขียนโดย : MsiBlack MoreKill เมื่อวันที่ 2013-08-06 16:01:12
รายละเอียดของการตอบ ::
ลายตาจุงเบยย

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-08-06 16:29:26 By : 01000010
 


 

No. 5



โพสกระทู้ ( 1,348 )
บทความ ( 1 )



สถานะออฟไลน์


VS มี Option Inject แบบอย่างนี้ด้วยเหรอ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-08-06 16:37:32 By : watcharop
 


 

No. 6

Guest



แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-11-30 13:17:28 By : sd
 


 

No. 7

Guest


แค่นี้ ผมเขียนไม่กี่บรรทัดเองก็ได้ละ ผมนี่ไม่ชอบจริงพวกไปก๊อปมาตอบ ถ้าไม่รู้จริงก็อย่ามั่วนะครับ คนรู้เขาจะไม่อยากตอบเพราะกลัวคนจะเสียหน้า
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-02-02 21:25:37 By : เอช่างไฟ
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ต้องการทำ Inject dll แต่จะให้มัน Inject dll ตัวที่ add ไว้ในโปรเจค ทำยังไงครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 02
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่