Raised This Month: $32 Target: $400
 8% 

Simple Anti-Cheat


Post New Thread Reply   
 
Thread Tools Display Modes
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 09-24-2010 , 06:08   Re: Simple Anti-Cheat
Reply With Quote #11

Quote:
Originally Posted by padilha007 View Post
Server can be done like SXE; in Metamod?
Yup. You just need to do what server.py is doing: connect to client and send requests.

And I almost raged, Exolent
Seta00 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 09-24-2010 , 14:11   Re: Simple Anti-Cheat
Reply With Quote #12

Quote:
Originally Posted by Seta00 View Post
And I almost raged, Exolent
Heh I wish I was more familiar with Python to completely understand your code. I can understand most of it though so it's okay.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-24-2010 , 14:34   Re: Simple Anti-Cheat
Reply With Quote #13

I prefer SIMS version
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 09-24-2010 , 16:26   Re: Simple Anti-Cheat
Reply With Quote #14

Oh dear, why do you link to Java software on your signature Connor?
Seta00 is offline
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 09-24-2010 , 17:42   Re: Simple Anti-Cheat
Reply With Quote #15

Quote:
Originally Posted by Exolent[jNr] View Post
Heh I wish I was more familiar with Python to completely understand your code. I can understand most of it though so it's okay.
PHP Code:
'''
Created on 21/09/2010

@author: Reuben '
Seta00' Morais
'''
import os # to use exit
import socket
from threading import Thread 
# high-level threading facilities

import pythoncom # access to OS info on multiple threads
import wmi # access to OS info
import ImageGrab # screenshot
from wxPython.wx import #@UnusedWildImport # graphical interface library (wxWidgets binding to Python)

HOST '' # accept all hosts
PORT 41337 # port to listen to

class WorkerThread(Thread): # this is the actual server
    
def __init__(selfsocketlogActivity):
        
Thread.__init__(self)
        
        
self.socket socket
        self
.LogActivity logActivity
        
        self
.shuttingDown False
        
        self
.start()
        
    
def run(self):
        
pythoncom.CoInitialize() #@UndefinedVariable # allow access to OS info on this thread
        
self.wmiConn wmi.WMI() # connect to the local machine
        
while True:
            if (
self.shuttingDown):
                break
            
            
connectionaddress self.socket.accept() # accept a new connection
                  
            
data connection.recv(256# receive the request header
                        
            
self.LogActivity('Received "' data '" from ' str(address) + '.')
            
            if 
data == 'SACRunningRequest'# basic request, check if the client is running
                
connection.send('OK')
                
            
elif data == 'SACProcRequest'# process list request
                
processes self.wmiConn.Win32_Process.instances() # get running processes
                
retData str([proc.Properties_('Name').Value for proc in processes]) # build list of names
                
                
connection.send(str(len(retData))) # send data length
                
                
if connection.recv(32) != None:
                    
connection.send(retData# send actual data
                    
            
elif data == 'SACSSRequest'# sceenshot request
                
img ImageGrab.grab() # take the screenshot
                
connection.send(repr(img.size)) # send the image size first (width x height)
                
if connection.recv(32) == None# wait for confirmation
                    
self.LogActivity("Client didn't respond to image size message.")
                    continue
                
                
retData img.tostring() # convert the img to raw pixel data
                
connection.send(str(len(retData))) # send the data size in bytes
                
if connection.recv(32) == None# wait for confirmation
                    
self.LogActivity("Client didn't respond to data size message.")
                    continue
                
                
connection.send(retData# send the actual data
        
        
pythoncom.CoUnitialize() #@UndefinedVariable # to access OS info on multiple threads

class MainFrame(wxFrame):
    
def __init__(selfparentidtitle): # this is the constructor in Python

        # removed GUI stuff

        
self.socket socket.socket(socket.AF_INETsocket.SOCK_STREAM)
        try:
            
self.socket.bind((HOSTPORT))
        
except socket.error:
            
wxMessageBox("The address is already in use, can't start the client.")
            
self.Destroy()
            
os._exit(1)

        
self.socket.listen(1# set to listen mode, wait for one connection
        
        
self.shuttingDown False
        
        self
.thread WorkerThread(self.socketself.LogActivity# create and start the server thread
    
    
def LogActivity(selfactivity):
        
self.statusUpdater.AppendText(activity '\n')
          
    
def OnCloseWindow(selfevent):
        
self.LogActivity('Shutting down worker thread.')
        
        
self.thread.shuttingDown True
        self
.thread.join(1.0)
        
        
self.socket.close()
             
        
self.Destroy()
        
class 
SACApp(wxApp): # GUI stuff
    
def OnInit(self):
        
frame MainFrame(NULL, -1'Simple Anti-Cheat')
        
frame.Show(true)
        
        
self.SetTopWindow(frame)
        
        return 
true
    
app 
SACApp(NULL)
app.MainLoop()
os._exit(0
Seta00 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:28.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode