banjalukaforum.com

Dobrodošli na banjalukaforum.com
Danas je 18 Jul 2025, 16:32

Sva vremena su u UTC [ DST ]




Započni novu temu Odgovori na temu  [ 14 Posta ] 
Autoru Poruka
 Tema posta: CounterStrike script
PostPoslato: 05 Dec 2004, 19:33 
OffLine
Urednik
Urednik

Pridružio se: 26 Jun 2003, 21:50
Postovi: 2669
Hocu da napravim jedan programcic da se konektuje na Counter-Strike server i da i onda pribavi informacije kao sto su imena igraca, mapa, vrijeme i slicno.

Problem je to sto ne znam u kom formatu trebam da se prijavim i kako CS salje te podatke i uopste na koji nacin se odvija komunikacija izmedju CS servera i clienta. Pa da li neko zna neki sajt (od milion njih koji su posveceni cs scriptingu) na kojem je fino objasnjen format komunikacije , ie protokol ili nazovi-kako-hoces ???


Vrh
 Profil  
 
 Tema posta:
PostPoslato: 06 Dec 2004, 23:54 
OffLine
Početnik
Početnik
Korisnikov avatar

Pridružio se: 16 Apr 2002, 01:00
Postovi: 70
ili da sniffas trafic koji ide od tebe do cs servera i nazad ?


Vrh
 Profil  
 
 Tema posta:
PostPoslato: 07 Dec 2004, 16:31 
OffLine
Urednik
Urednik

Pridružio se: 26 Jun 2003, 21:50
Postovi: 2669
IgAc je napisao:
ili da sniffas trafic koji ide od tebe do cs servera i nazad ?

Komplikovano.


Vrh
 Profil  
 
 Tema posta:
PostPoslato: 08 Dec 2004, 23:31 
OffLine
Početnik
Početnik
Korisnikov avatar

Pridružio se: 16 Apr 2002, 01:00
Postovi: 70
zasto? pa najlakse ti je tako... znas odma' na cemu si...


Vrh
 Profil  
 
 Tema posta:
PostPoslato: 09 Dec 2004, 01:17 
OffLine
Stara kuka
Stara kuka

Pridružio se: 06 Jan 2003, 01:19
Postovi: 4072
aj ti probaj pa izbaci ovamo sta dobijes...


Vrh
 Profil  
 
 Tema posta:
PostPoslato: 11 Dec 2004, 00:48 
OffLine
Majstorski kandidat
Majstorski kandidat
Korisnikov avatar

Pridružio se: 12 Jul 2001, 01:00
Postovi: 457
Lokacija: Banjaluka
Hmhmhm imao sam ovakav programcic za cs...
Source code je u C-u.

_________________
Ivan M.


Vrh
 Profil  
 
 Tema posta: . . .
PostPoslato: 11 Dec 2004, 01:07 
OffLine
Majstorski kandidat
Majstorski kandidat
Korisnikov avatar

Pridružio se: 12 Jul 2001, 01:00
Postovi: 457
Lokacija: Banjaluka
Luigi Auriemma
To je ta legenda, nasao je skoro u svakoj poznatoj igrici propust u sustini exploit nastaje tako sto se snifa recimo konekcija prema serveru i od servera, zatim taj odredjeni dio (od konektovanja, inicijalizacije do konektovanja na server) analizira i traze se moguci propusti zatim se pravi shellcode koji se zatim moze uputiti serveru i izazvati zeljeni efekat (DoS, root etc ...).
o svemu detaljnije na:
http://aluigi.altervista.org

_________________
Ivan M.


Vrh
 Profil  
 
 Tema posta:
PostPoslato: 11 Dec 2004, 14:02 
OffLine
Početnik
Početnik
Korisnikov avatar

Pridružio se: 03 Jul 2004, 15:14
Postovi: 59
Lokacija: /dev/null
Kao sto rece kolage IgAc....

_________________
"Ni j@#%nje nije bolje kad se radi "iz ljubavi", a kamoli softver" -- Dragi Tata


Vrh
 Profil  
 
 Tema posta:
PostPoslato: 12 Dec 2004, 22:09 
OffLine
Početnik
Početnik
Korisnikov avatar

Pridružio se: 16 Apr 2002, 01:00
Postovi: 70
Citiraj:
aj ti probaj pa izbaci ovamo sta dobijes...


nemam cs :)


Vrh
 Profil  
 
 Tema posta:
PostPoslato: 13 Dec 2004, 23:55 
OffLine
Urednik
Urednik

Pridružio se: 26 Jun 2003, 21:50
Postovi: 2669
Aj kad hocete :D evo vam koda, ali u pythonu :

Kod:
## DEMONSTRACIONA VERZIJA - TOTALNO FALICNA :X
## potpuno radi samo opcija "info" mada ona nije implementirana do kraja :(
## AUTOR : SrEcKo ToRoMaNNNNNNNNNNNNNNNNNNNNNNN aka che.guevara@forum.blic.net

from twisted.internet.protocol import ConnectedDatagramProtocol
from twisted.internet import reactor

class CSModule(ConnectedDatagramProtocol):
    login = "\xFF\xFF\xFF\xFF"
    commands = {
        '1':"ping",
        '2':"info",
        '3':"players",
        '4':"rules"
        }
    def parseInfo(self,s):
        ret={}

        #'server addres
        fi=s.find('\x00')
        ret['addr']=s[:fi]
        s=s[fi+1:]

        #'server name
        fi=s.find('\x00')
        ret['name']=s[:fi]
        s=s[(fi+1):]

        #'map name
        fi=s.find('\x00')
        ret['map']=s[:fi]
        s=s[fi+1:]
       
        #'game dir
        fi=s.find('\x00')
        ret['gamedir']=s[:fi]
        s=s[fi+1:]

        #'game name - description
        ret['description']=s[:-1]

        return ret
   
    def parseRules(self,s):return s
   
    def startProtocol(self):
        self.sendDatagram()
   
    def sendDatagram(self):
        for i in self.commands:
            print i+".) " + self.commands[i]
        what=self.commands.get(raw_input("Sta hoces"))
        if what is not None:
            self.transport.write(self.login+what)
        else:
            reactor.stop()

    def datagramReceived(self, datagram):
        recv=repr(datagram)
        print 'Datagram paket ', recv
        #op=recv[4]
        #print "Tip: " + op
        #if op=='C':
        #    print self.parseInfo(recv[5:])
        self.sendDatagram()


def main():
    addr,port = raw_input("Server adresa: "),raw_input("Server port: ")
    protocol = CSModule()
    reactor.connectUDP(addr, int(port), protocol)
    reactor.run()

if __name__ == '__main__':
    main()



ove linije koje pocinju sa # su komentari ...
izvinite zbog necistog koda, bice sve ok uskoro.


Vrh
 Profil  
 
 Tema posta:
PostPoslato: 14 Dec 2004, 21:36 
OffLine
Majstorski kandidat
Majstorski kandidat
Korisnikov avatar

Pridružio se: 12 Jul 2001, 01:00
Postovi: 457
Lokacija: Banjaluka
gdje si nabavio shellcode? I zasto stalno taj pajton daj nesto u ceju ili sl.

_________________
Ivan M.


Vrh
 Profil  
 
 Tema posta:
PostPoslato: 15 Dec 2004, 10:57 
OffLine
Urednik
Urednik

Pridružio se: 26 Jun 2003, 21:50
Postovi: 2669
Vertygo je napisao:
gdje si nabavio shellcode? I zasto stalno taj pajton daj nesto u ceju ili sl.


DA LI SI SVJESTAN - da bi onaj gore program u 'Ceju' ili 'Ceju Pljus Pljus' :D uzeo jedno 10 stranica koda i deset godina mog zivota???

"izvinte"

Dobro, dobro, evo onda prostudiraj slijedece:


Kod:
Game servers will answer the following messages:
Messages are sent to the server by sending 4 consecutive bytes of 255 (32-bit integer -1) and then the string command followed by a zero byte to terminate it

"ping"
   Server responds with a single byte code ASCII 'j'

"info"
   Server responds with the following packet:
   (int32)      -1
   (byte)      ASCII 'C' (info response, S2A_INFO)
   (string)      net address of server
   (string)      name of the host / server
   (string)      name of the map
   (string)      game directory (i.e. valve/)
   (string)      Game description (e.g. "half-life multiplay")
   (byte)      active client count
   (byte)      maximum clients allowed
   (byte)      protocol version (currently 7)

"players"
   Server responds with the following packet:
   (int32)      -1
   (byte)      ASCII 'D' (players response, S2A_PLAYER)
   (byte)      active client count

   for each active client
      (byte)      client number / index
      (string)      player name
      (int32)      client's frag total
      (float32)      client's total time in-game

"rules"
   Server responds with the following packet:
   (int32)      -1
   (byte)      ASCII 'E' (rules response, S2A_RULES)
   (int16)      number of rules

   for each rule
      (string)      rule name
      (string)      rule value


-------------------

Master server query protocol:

Sent to master:

(byte)    ASCII 'c' ( A2M_GET_SERVERS )

Response from master:

(int32)  -1
(byte)   ASCII 'd' ( M2A_SERVERS )
(byte)   unused

// This is followed by as many 6 byte ip addresses as will fit in the message.  The master currently feeds about 2K worth of IP address ( 300+ or so ), but we may up that # significantly in the near future.

(4 x byte) ip address
(int16)  port #



The old protocol is still valid, but there is a new, extended protocol:

Here are both the old and new protocols ( the new one is the "details" message ):

"info"
   Server responds with the following packet:
   (int32)      -1
   (byte)      ASCII 'C' (info response, S2A_INFO)
   (string)      net address of server
   (string)      name of the host / server
   (string)      name of the map
   (string)      game directory (i.e. valve/)
   (string)      Game description (e.g. "half-life multiplay")
   (byte)      active client count
   (byte)      maximum clients allowed
   (byte)      protocol version (currently 37)

"details"
   (int32)          -1
   (byte)      ASCII 'm' ( S2A_INFO_DETAILED )
   (string)      net address of server
   (string)      name of the host / server
   (string)      name of the map
   (string)      game directory (i.e. valve/)
   (string)      Game description (e.g. "half-life multiplay")
   (byte)      active client count
   (byte)      maximum clients allowed
   (byte)      protocol version (currently 37)
   (byte)      type of server == 'l' for listen or 'd' for dedicated
   (byte)      os of server == 'w' for win32 or 'l' for linux
   (byte)      password on server == 1 or yes, 0, for no
   (byte)      is server running a mod? == 1 for yes, 0 for no

   IFF the server is running mod byte was 1:

   (string)      URL for mod's "info" website
   (string)      URL for mod's download ftp server
   (int32)      mod version #
   (int32)      mod download size ( in bytes, approx. )
   (byte)      is the mod a server side only mod?  1 == yes, 0 == no
   (byte)      does this server require you to have a custom client side .dll ( client.dll )?  1 == yes, 0 == no.



Here is some code that uses the new protocol.  The first function starts the protocol and the second services the message and requests more ip addresses:

/*
==================
Host_GetBatchServerList_f

  Request full server list from HL master server.
==================
*/
void Host_GetBatchServerList_f( void )
{
   unsigned char c[10];
   adrlist_t *p;
   int i = 0;

   // Request a server list from the master servers.
   NET_Config( true ); // Initialize networking

   if ( gfNoMasterServer )
      return;

   if ( !valvemaster_adr )
      return;

   c[0] = A2M_GET_SERVERS_BATCH;  // ascii 'e'
   i++;

   *(int *)&c[1] = 0; // Request first batch.
   i += sizeof( int );

   p = valvemaster_adr;

   while ( p )
   {
      // send to valve master
      Con_Printf ("Requesting batch server list from %s\n", NET_AdrToString ( p->adr) );
      NET_SendPacket (NS_CLIENT, i, c, p->adr );
      p = p->next;
   }
}

// Upon receiving ( 5 bytes, 4 for the -1 and 1 byte for the 'f' character ):
int32  -1
M2A_SERVER_BATCH               // Ascii 'f', the response to the above

void CL_ParseBatchServerList( void )
{
   char szAddress[128] = "";
   unsigned char cIP[4];
   int i;
   unsigned short iIPPort;
   int nNumAddresses;
   int count = 1;
   int unique = 0;

   MSG_ReadByte(); // Skip \r

   unique = MSG_ReadLong();

   // So far we have read 6 chars.  Remainder of message length is iBytesRead - 6
   nNumAddresses = net_message.cursize - sizeof(int) - sizeof(unsigned char) - sizeof(byte);
   
   // Each address is 6 bytes long
   //
   nNumAddresses /= 6;

   while (nNumAddresses-- > 0)
   {
      memset(szAddress, 0, 128);

      for (i = 0; i < 4; i++)
         cIP[i] = MSG_ReadByte();

      sprintf( szAddress, "%i.%i.%i.%i"
         , (int)cIP[0]
         , (int)cIP[1]
         , (int)cIP[2]
         , (int)cIP[3]
      );

      iIPPort = BigShort((unsigned short)MSG_ReadShort());
      
      //if ( count <= 100 )
      //   Con_Printf( "%4i:  %s:%i\n", count, szAddress, iIPPort );
      
      count++;
   }

   Con_Printf( "%i servers\n", count );

   if ( unique != 0 ) // More servers left, send another request to master
   {
      unsigned char c[10];
      int i = 0;

      // Request a server list from the master servers.
      NET_Config( true ); // Initialize networking

      c[0] = A2M_GET_SERVERS_BATCH;
      i++;

      *(int *)&c[1] = unique; // Request servers starting after this unique id.
      i += sizeof( int );

      // send to valve master
      Con_DPrintf ("Requesting next batch ( %i ) server list from %s\n", unique, NET_AdrToString ( net_from ) );
      NET_SendPacket (NS_CLIENT, i, c, net_from );
   }
   else
      Con_Printf( "Done.\n" );
}



Vrh
 Profil  
 
 Tema posta:
PostPoslato: 22 Dec 2004, 23:38 
OffLine
Majstorski kandidat
Majstorski kandidat
Korisnikov avatar

Pridružio se: 12 Jul 2001, 01:00
Postovi: 457
Lokacija: Banjaluka
http://www.int64.org/gamestat.html

_________________
Ivan M.


Vrh
 Profil  
 
 Tema posta:
PostPoslato: 23 Dec 2004, 22:27 
OffLine
Urednik
Urednik

Pridružio se: 26 Jun 2003, 21:50
Postovi: 2669
Auu. Fino.


Vrh
 Profil  
 
Prikaži postove u poslednjih:  Poređaj po  
Započni novu temu Odgovori na temu  [ 14 Posta ] 

Sva vremena su u UTC [ DST ]


Ko je OnLine

Korisnici koji su trenutno na forumu: Nema registrovanih korisnika i 0 gostiju


Ne možete postavljati nove teme u ovom forumu
Ne možete odgovarati na teme u ovom forumu
Ne možete monjati vaše postove u ovom forumu
Ne možete brisati vaše postove u ovom forumu
Ne možete slati prikačene fajlove u ovom forumu

Pronađi:
Idi na:  
Powered by phpBB® Forum Software © phpBB Group
Hosting BitLab
Prevod - www.CyberCom.rs