• HyperFilter | DoS Protection | DDoS Protection | DoS Mitigation | DDoS Mitigation | AntiDoS | AntiDDoS | Proxy Shielding

Linux dosyaları için billing server source [python dilinde yazılmıştır]

Katılım
10 Mayıs 2012
Mesajlar
8,437
[HIDE-REPLY]
Kod:
import socket

import struct

#import pymssql

#import threading



# something you need to change

HOST = '192.168.1.26'                       # host to listen

PORT = 15200                    # port to listen

DBHOST = '192.168.1.26'            # db server ip

DBUSER = 'KnAccount'                   # db server user

DBPASSWORD = 'KnAccount'           # db server password

DBDATABASE = 'knight_account'             # db server database name

DBUSER2 = 'KnOnline'                   # db server user

DBPASSWORD2 = 'KnOnline'           # db server password

DBDATABASE2 = 'knight'             # db server database name

DBALLOWIP = '192.168.1.31'         # which ip can access this verifier

ret_data = ''

#con = pymssql.connect(host=DBHOST,user=DBUSER,password=DBPASSWORD,database=DBDATABASE)

#con2 = pymssql.connect(host=DBHOST,user=DBUSER2,password=DBPASSWORD2,database=DBDATABASE2)

#con.autocommit(True)

#con2.autocommit(True)

#cur = con.cursor()

#cur2 = con2.cursor()

#lock = threading.Lock()

#lock2 = threading.Lock()

ret_data = '\xa4'





s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

s.bind((HOST, PORT))

s.listen(5)

while 1:

    conn, addr = s.accept()

    print addr

    if addr[0] != DBALLOWIP:

        conn.close()

        continue

    while 1:

        #print 'before recv'

        data = conn.recv(4)

        if len(data) == 0:

                break

        #print 'after recv'

        #print 'data:',data

        #print 'strdata:',ord(data[0]), ord(data[1])

        if ord(data[0]) != 0xaa or ord(data[1]) != 0x55:

            #print ord(data[0]), ord(data[1])

            #print 'format error'

            break

        length = struct.unpack('H', data[2:4])[0]

        #print 'before recv'

        data = conn.recv(length+2)

        #print 'after recv'

        if ord(data[-1]) != 0xaa or ord(data[-2]) != 0x55:

            #print ord(data[-2]), ord(data[-1])

            #print 'format error1'

            break

        type = ord(data[0])

        if type == 0xa0:

            print 'SetGameServer'

            #print 'before recv'

            #conn.recv(length+2)

            #print 'after recv'

            continue

        elif type == 0xa3:

            print 'BillStart'

            length = struct.unpack('H', data[1:3])[0]

            #print length

            name = data[3:3+length]

            print 'name = [%s]' % name

            #query="select * from TB_USER where strAccountID='%s'" % name

            #cur.execute(query)

            #if len(cur.fetchall()) == 0 or not name.isalnum():

                #ret_data = '\xa3' + struct.pack('H', length) + name + '\x00\x00\x00\x00\x00\x00\x00\x00'

            #else:

            ret_data = '\xa3' + struct.pack('H', length) + name + '\x01\x00\x01\x00\xa0\x05\x00\x00'

            

        elif type == 0xa4:

            print 'BillEnd'

            length = struct.unpack('H', data[1:3])[0]

            name = data[3:3+length]

            print 'name = [%s]' % name

            disc_time = data[3+length+1]

            ret_data = '\xa4' + struct.pack('H', length) + name + disc_time

            try:

                print 'Other:'

                

                print ord(data[0])

                

                ret_data = '\xa4'

                

            except:

                    pass

            

        ret_data = '\xaa\x55' + struct.pack('H', len(ret_data)) + ret_data + '\x55\xaa'

        

        #print 'send:',ret_data

        conn.send(ret_data)

    conn.close()

#con.commit()

#con2.commit()

#con.close()

#con2.close()
[/HIDE-REPLY]







linux dosyalarla uğraşan arkadaşlar varsa buyursun tepe tepe kullansın 😀
 
Cevap: Linux dosyaları için billing server source [python dilinde yazılmıştır]



Aaaaaaaaaaaaaaaaaa
 
Geri
Üst