RE:detectar programa en memoria
losiento mucho por no explicarme mejor. tengo un servidor de juegos que los usuarios usan un cliente para logearse al servidor.. todo bien hasta hay.. el problema es que algunos de ellos usan programas ilegales como boots. que emulan el funcionamiento del cliente y se conectan mediante el boots, asi tienen muchos beneficios como dejar el chararter jugando horas y horas y horas sin parar.
Entonce pense en un plan. Cree un launcher. Los launcher en el ambiente de juego.
es una aplicacion creada en vb.net ho c++ cualquier lenguaje predilecto y este launcher se encarga de cargar el cliente y de actualizar el cliente si es necesario..
Bueno pense un un plan para evitar los bots y era que el jugador obligatoriamente tiene que usar el launcher para poder ejecutar el cliente.. y el luncher tendria que tener una funcion para detectar el boots corriendo. Al principio puse una funcion sensilla. y era que diera kill al proseso con el nombre del boot
por ejemplo si el boot se llama hackgames.exe pues el launcher aplique kill a esta aplicacion.
pero es tan sensillo como darle ranme al exe y fuera protecion.
asi que me puse apensar. si podria leer alguna firma que dejara en la memoria el programa.
como sabes cuando un programa se ejecuta no importa que nombre le cambies al exe. simpre su codigo interno es igual. por tal razon pense en una funcion
llamada CRC32 que analisa el exe y me tira de retorno un Hash
que me funciona de maravillas. con esta funcion puedo crear una lista de Hash y el luncher analise los exe abiertos en el systema y compare con el Hash de la lista negra si esta en lista negra no deja jugar al pj.... ya tengo la funcion casi lista. el problema es que solamente analisa el codigo en la ubicacion del archivo.
me faltaria la manera que pueda leer los processe de windows y luego leer la ubicacion del disco duro. para luego ir uno por uno analizando.
aqui pongo cun codigo fuente. de lo que tengo echo asta ahora
Option Strict On
Option Explicit On
Imports System.Security.Cryptography
Imports System.IO
Namespace xous.Security.Cryptography
Public Class CRC32
Inherits HashAlgorithm
Private Const _DefaultPolynomial As Integer = &HEDB88320
#Region " Member Variables "
Private _Table() As Integer
Private _CRC32 As Integer = &HFFFFFFFF
Private _Polynomial As Integer
#End Region
#Region " Contructors "
Public Sub New()
Me.HashSizeValue = 32 ' CRC32 is a 32bit hash
_Polynomial = _DefaultPolynomial
Initialize()
End Sub
Public Sub New(ByVal Polynomial As Integer)
_Polynomial = Polynomial
End Sub
#End Region
#Region " HashAlgorithm "
Protected Overrides Sub HashCore(ByVal array() As Byte, ByVal ibStart As Integer, ByVal cbSize As Integer)
Dim intLookup As Integer
For i As Integer = 0 To cbSize - 1
intLookup = (_CRC32 And &HFF) Xor array(i)
'This is a workaround for a right bit-shift because vb.net
'does not support unsigned Integers, so _CRC32 >> 8
'gives the wrong value (any better fixes?)
_CRC32 = ((_CRC32 And &HFFFFFF00) \ &H100) And &HFFFFFF
_CRC32 = _CRC32 Xor _Table(intLookup)
Next i
End Sub
Protected Overrides Function HashFinal() As Byte()
Return BitConverter.GetBytes(Not _CRC32)
End Function
Public Overrides Sub Initialize()
_CRC32 = &HFFFFFFFF
_Table = BuildTable(_Polynomial)
End Sub
#End Region
#Region " Helper Methods "
''' <summary>
''' Generates the CRC32 Table
''' </summary>
''' <param name="Polynomial">A polynomial that should be used to generate the table.</param>
''' <returns>The CRC32 Table based on the Polynomial given</returns>
Private Shared Function BuildTable(ByVal Polynomial As Integer) As Integer()
Dim Table(255) As Integer
Dim Value As Integer
For I As Integer = 0 To 255
Value = I
For X As Integer = 0 To 7
If (Value And 1) = 1 Then
'This is a workaround for a right bit-shift because vb.net
'does not support unsigned Integers, so _CRC32 >> 1
'gives the wrong value (any better fixes?)
Value = Convert.ToInt32(((Value And &HFFFFFFFE) \ 2&) And &H7FFFFFFF)
Value = Value Xor Polynomial
Else
'Same as above.
Value = Convert.ToInt32(((Value And &HFFFFFFFE) \ 2&) And &H7FFFFFFF)
End If
Next
Table(I) = Value
Next
Return Table
End Function
#End Region
End Class
End Namespace
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim crc As New xous.Security.Cryptography.CRC32
Dim fs As New FileStream("C:\New folder (4)\VBMySQLDirect.dll", FileMode.Open)
Dim CRC32 As Integer = BitConverter.ToInt32(crc.ComputeHash(CType(fs, Stream)), 0)
fs.Close()
MessageBox.Show(String.Format("The CRC is: {0:X8}", CRC32))
End Sub
End Class