Viernes 15 de Noviembre de 2024, 10:30
SoloCodigo
Bienvenido(a),
Visitante
. Por favor,
ingresa
o
regístrate
.
¿Perdiste tu
email de activación?
Inicio
Foros
Chat
Ayuda
Buscar
Ingresar
Registrarse
SoloCodigo
»
Foros
»
Programación Web y Scripting
»
Python
(Moderador:
arielb
) »
problema en Python
« anterior
próximo »
Imprimir
Páginas: [
1
]
Autor
Tema: problema en Python (Leído 1465 veces)
koxesaurio
Nuevo Miembro
Mensajes: 1
problema en Python
«
en:
Domingo 31 de Octubre de 2010, 00:18 »
0
Buenas, soy nuevo y esperaba si alguien con capacidad pudiera darme una idea mi problema, actualmente manejo un servidor de juegos privado el cliente usa en si programacion python al 100% y los archivos se puede leer y modificar a gusto por cualquier persona y ay esta el punto llueven los hacks la idea mia es modificar un archivo python especificamente el que contiene las ips de conexion al servidor + puertos para que no puedan mirarlo y haci no usar otros cliente donde cargan los hacks escondiendo la ip en el cliente solo me tocaria instalar un firewaal en el ordenador que actualmente es FreeBSD Unix para bloquear el ping desde afuera para que no puedan saber de ninguna forma a que ip y que puerto se conectan espero hacerme entender ahora mostrare el archivo en el cual van las ip y es el que quiero encryptar para que sea un codigo no visto a simple vista.
Código: Python
import
os
import
app
import
locale
import
debugInfo
def
BuildServerList
(
orderList
)
:
retMarkAddrDict
=
{
}
retAuthAddrDict
=
{
}
retRegion0
=
{
}
ridx
=
1
for
region
,
auth
,
mark
,
channels
in
orderList:
cidx
=
1
channelDict
=
{
}
for
channel
in
channels:
key
=
ridx *
10
+ cidx
channel
[
'key'
]
=
key
channelDict
[
cidx
]
=
channel
cidx +
=
1
region
[
'channel'
]
=
channelDict
retRegion0
[
ridx
]
=
region
retAuthAddrDict
[
ridx
]
=
auth
retMarkAddrDict
[
ridx*
10
]
=
mark
ridx +
=
1
return
retRegion0
,
retAuthAddrDict
,
retMarkAddrDict
if
(
locale
.
IsEUROPE
(
)
and
app.
GetLocalePath
(
)
==
"locale/es"
)
:
STATE_NONE
=
"OFF"
STATE_DICT
=
{
0
:
"...."
,
1
:
"NORM"
,
2
:
"BUSY"
,
3
:
"FULL"
}
SERVER01_CHANNEL_DICT
=
{
1
:
{
"key"
:
11
,
"name"
:
"CH1 "
,
"ip"
:
"aqui va la IP"
,
"tcp_port"
:
13000
,
"udp_port"
:
11002
,
"state"
:STATE_NONE
,
}
,
2
:
{
"key"
:
12
,
"name"
:
"CH2 "
,
"ip"
:
"aqui va la IP"
,
"tcp_port"
:
16000
,
"udp_port"
:
11002
,
"state"
:STATE_NONE
,
}
,
# 3:{"key":13,"name":"CH3 ","ip":"aqui va la IP","tcp_port":18000,"udp_port":11002,"state":STATE_NONE,},
# 4:{"key":14,"name":"CH4 ","ip":"aqui va la IP","tcp_port":42000,"udp_port":11002,"state":STATE_NONE,},
# 5:{"key":15,"name":"CH5 ","ip":"aqui va la IP","tcp_port":22000,"udp_port":22000,"state":STATE_NONE,},
}
SERVER02_CHANNEL_DICT
=
{
1
:
{
"key"
:
21
,
"name"
:
"CH1 "
,
"ip"
:
"aqui va la IP"
,
"tcp_port"
:
18000
,
"udp_port"
:
31002
,
"state"
:STATE_NONE
,
}
,
# 2:{"key":22,"name":"CH2 ","ip":"aqui va la IP","tcp_port":20000,"udp_port":22000,"state":STATE_NONE,},
# 3:{"key":23,"name":"CH3 ","ip":"aqui va la IP","tcp_port":22000,"udp_port":22000,"state":STATE_NONE,},
# 4:{"key":24,"name":"CH4 ","ip":"aqui va la IP","tcp_port":42000,"udp_port":42000,"state":STATE_NONE,},
# 5:{"key":25,"name":"CH5 ","ip":"aqui va la IP","tcp_port":22000,"udp_port":22000,"state":STATE_NONE,},
}
SERVER03_CHANNEL_DICT
=
{
# 1:{"key":31,"name":"CH1 ","ip":"aqui va la IP","tcp_port":13000,"udp_port":13000,"state":STATE_NONE,},
# 2:{"key":32,"name":"CH2 ","ip":"aqui va la IP","tcp_port":32000,"udp_port":32000,"state":STATE_NONE,},
# 3:{"key":33,"name":"CH3 ","ip":"aqui va la IP","tcp_port":32000,"udp_port":32000,"state":STATE_NONE,},
}
SERVER04_CHANNEL_DICT
=
{
# 1:{"key":41,"name":"CH1 ","ip":"aqui va la IP","tcp_port":32000,"udp_port":32000,"state":STATE_NONE,},
# 2:{"key":42,"name":"CH2 ","ip":"aqui va la IP","tcp_port":32000,"udp_port":32000,"state":STATE_NONE,},
# 3:{"key":43,"name":"CH3 ","ip":"aqui va la IP","tcp_port":32000,"udp_port":32000,"state":STATE_NONE,},
# 4:{"key":44,"name":"CH4 ","ip":"aqui va la IP","tcp_port":32000,"udp_port":32000,"state":STATE_NONE,},
}
SERVER05_CHANNEL_DICT
=
{
# 1:{"key":51,"name":"CH1 ","ip":"aqui va la IP","tcp_port":12000,"udp_port":12000,"state":STATE_NONE,},
# 2:{"key":52,"name":"CH2 ","ip":"aqui va la IP","tcp_port":12000,"udp_port":12000,"state":STATE_NONE,},
# 3:{"key":53,"name":"CH3 ","ip":"aqui va la IP","tcp_port":12000,"udp_port":12000,"state":STATE_NONE,},
# 4:{"key":54,"name":"CH4 ","ip":"aqui va la IP","tcp_port":12000,"udp_port":12000,"state":STATE_NONE,},
}
REGION_NAME_DICT
=
{
0
:
"SPAIN"
,
}
REGION_AUTH_SERVER_DICT
=
{
0
:
{
1
:
{
"ip"
:
"aqui va la IP"
,
"port"
:
11002
,
}
,
2
:
{
"ip"
:
"aqui va la IP"
,
"port"
:
31002
,
}
,
# 3 : { "ip":"aqui va la IP", "port":91004, },
# 4 : { "ip":"aqui va la IP", "port":31000, },
# 5 : { "ip":"aqui va la IP", "port":11000, },
}
}
REGION_DICT
=
{
0
:
{
1
:
{
"name"
:
"NOMBRE DEL SERVER"
,
"channel"
: SERVER01_CHANNEL_DICT
,
}
,
2
:
{
"name"
:
"NOMBRE DEL SERVER"
,
"channel"
: SERVER02_CHANNEL_DICT
,
}
,
# 3 : { "name" : "Alba", "channel" : SERVER03_CHANNEL_DICT, },
# 4 : { "name" : "Solsticio", "channel" : SERVER04_CHANNEL_DICT, },
# 5 : { "name" : "Plenilunio", "channel" : SERVER05_CHANNEL_DICT, },
}
,
}
MARKADDR_DICT
=
{
10
:
{
"ip"
:
"aqui va la IP"
,
"tcp_port"
:
13000
,
"mark"
:
"10.tga"
,
"symbol_path"
:
"10"
,
}
,
20
:
{
"ip"
:
"aqui va la IP"
,
"tcp_port"
:
13000
,
"mark"
:
"20.tga"
,
"symbol_path"
:
"10"
,
}
,
}
TESTADDR
=
{
"ip"
:
"aqui va la IP"
,
"tcp_port"
:
50000
,
"udp_port"
:
50000
,
}
Bueno el servidor oficial del juego que yo tengo lo resolvio de la siguiente forma leyendo un archivo Cpickle Desde afuera en otro lenguaje para que no puedan manipular ni mirar sus ips ni puertos:
Código: Python
import
os
import
app
import
locale
import
debugInfo
def
BuildServerList
(
orderList
)
:
retMarkAddrDict
=
{
}
retAuthAddrDict
=
{
}
retRegion0
=
{
}
ridx
=
1
for
region
,
auth
,
mark
,
channels
in
orderList:
cidx
=
1
channelDict
=
{
}
for
channel
in
channels:
key
=
ridx *
10
+ cidx
channel
[
'key'
]
=
key
channelDict
[
cidx
]
=
channel
cidx +
=
1
region
[
'channel'
]
=
channelDict
retRegion0
[
ridx
]
=
region
retAuthAddrDict
[
ridx
]
=
auth
retMarkAddrDict
[
ridx*
10
]
=
mark
ridx +
=
1
return
retRegion0
,
retAuthAddrDict
,
retMarkAddrDict
if
(
locale
.
IsEUROPE
(
)
and
app.
GetLocalePath
(
)
==
"locale/es"
)
:
STATE_NONE
=
"OFF"
STATE_DICT
=
{
0
:
"...."
,
1
:
"NORM"
,
2
:
"BUSY"
,
3
:
"FULL"
}
SERVER01_CHANNEL_DICT
=
{
1
:
{
"key"
:
11
,
"name"
:
"CH1 "
,
"ip"
:
"aqui va la IP"
,
"tcp_port"
:
13000
,
"udp_port"
:
11002
,
"state"
:STATE_NONE
,
}
,
2
:
{
"key"
:
12
,
"name"
:
"CH2 "
,
"ip"
:
"aqui va la IP"
,
"tcp_port"
:
16000
,
"udp_port"
:
11002
,
"state"
:STATE_NONE
,
}
,
# 3:{"key":13,"name":"CH3 ","ip":"aqui va la IP","tcp_port":18000,"udp_port":11002,"state":STATE_NONE,},
# 4:{"key":14,"name":"CH4 ","ip":"aqui va la IP","tcp_port":42000,"udp_port":11002,"state":STATE_NONE,},
# 5:{"key":15,"name":"CH5 ","ip":"aqui va la IP","tcp_port":22000,"udp_port":22000,"state":STATE_NONE,},
}
SERVER02_CHANNEL_DICT
=
{
1
:
{
"key"
:
21
,
"name"
:
"CH1 "
,
"ip"
:
"aqui va la IP"
,
"tcp_port"
:
18000
,
"udp_port"
:
31002
,
"state"
:STATE_NONE
,
}
,
# 2:{"key":22,"name":"CH2 ","ip":"aqui va la IP","tcp_port":20000,"udp_port":22000,"state":STATE_NONE,},
# 3:{"key":23,"name":"CH3 ","ip":"aqui va la IP","tcp_port":22000,"udp_port":22000,"state":STATE_NONE,},
# 4:{"key":24,"name":"CH4 ","ip":"aqui va la IP","tcp_port":42000,"udp_port":42000,"state":STATE_NONE,},
# 5:{"key":25,"name":"CH5 ","ip":"aqui va la IP","tcp_port":22000,"udp_port":22000,"state":STATE_NONE,},
}
SERVER03_CHANNEL_DICT
=
{
# 1:{"key":31,"name":"CH1 ","ip":"aqui va la IP","tcp_port":13000,"udp_port":13000,"state":STATE_NONE,},
# 2:{"key":32,"name":"CH2 ","ip":"aqui va la IP","tcp_port":32000,"udp_port":32000,"state":STATE_NONE,},
# 3:{"key":33,"name":"CH3 ","ip":"aqui va la IP","tcp_port":32000,"udp_port":32000,"state":STATE_NONE,},
}
SERVER04_CHANNEL_DICT
=
{
# 1:{"key":41,"name":"CH1 ","ip":"aqui va la IP","tcp_port":32000,"udp_port":32000,"state":STATE_NONE,},
# 2:{"key":42,"name":"CH2 ","ip":"aqui va la IP","tcp_port":32000,"udp_port":32000,"state":STATE_NONE,},
# 3:{"key":43,"name":"CH3 ","ip":"aqui va la IP","tcp_port":32000,"udp_port":32000,"state":STATE_NONE,},
# 4:{"key":44,"name":"CH4 ","ip":"aqui va la IP","tcp_port":32000,"udp_port":32000,"state":STATE_NONE,},
}
SERVER05_CHANNEL_DICT
=
{
# 1:{"key":51,"name":"CH1 ","ip":"aqui va la IP","tcp_port":12000,"udp_port":12000,"state":STATE_NONE,},
# 2:{"key":52,"name":"CH2 ","ip":"aqui va la IP","tcp_port":12000,"udp_port":12000,"state":STATE_NONE,},
# 3:{"key":53,"name":"CH3 ","ip":"aqui va la IP","tcp_port":12000,"udp_port":12000,"state":STATE_NONE,},
# 4:{"key":54,"name":"CH4 ","ip":"aqui va la IP","tcp_port":12000,"udp_port":12000,"state":STATE_NONE,},
}
REGION_NAME_DICT
=
{
0
:
"SPAIN"
,
}
REGION_AUTH_SERVER_DICT
=
{
0
:
{
1
:
{
"ip"
:
"aqui va la IP"
,
"port"
:
11002
,
}
,
2
:
{
"ip"
:
"aqui va la IP"
,
"port"
:
31002
,
}
,
# 3 : { "ip":"aqui va la IP", "port":91004, },
# 4 : { "ip":"aqui va la IP", "port":31000, },
# 5 : { "ip":"aqui va la IP", "port":11000, },
}
}
REGION_DICT
=
{
0
:
{
1
:
{
"name"
:
"NOMBRE DEL SERVER"
,
"channel"
: SERVER01_CHANNEL_DICT
,
}
,
2
:
{
"name"
:
"NOMBRE DEL SERVER"
,
"channel"
: SERVER02_CHANNEL_DICT
,
}
,
# 3 : { "name" : "Alba", "channel" : SERVER03_CHANNEL_DICT, },
# 4 : { "name" : "Solsticio", "channel" : SERVER04_CHANNEL_DICT, },
# 5 : { "name" : "Plenilunio", "channel" : SERVER05_CHANNEL_DICT, },
}
,
}
MARKADDR_DICT
=
{
10
:
{
"ip"
:
"aqui va la IP"
,
"tcp_port"
:
13000
,
"mark"
:
"10.tga"
,
"symbol_path"
:
"10"
,
}
,
20
:
{
"ip"
:
"aqui va la IP"
,
"tcp_port"
:
13000
,
"mark"
:
"20.tga"
,
"symbol_path"
:
"10"
,
}
,
}
TESTADDR
=
{
"ip"
:
"aqui va la IP"
,
"tcp_port"
:
50000
,
"udp_port"
:
50000
,
}
if
locale
.
IsEUROPE
(
)
:
name
=
app.
GetLocalePath
(
)
.
replace
(
"/"
,
"_"
)
+
".addr"
path
=
os
.
sep
.
join
(
(
"pack"
,
name
)
)
if
os
.
access
(
path
,
os
.
R_OK
)
:
print
"load_locale_addr:"
,
path
data
=
app.
LoadLocaleAddr
(
path
)
import
cPickle
import
cStringIO
info
=
cPickle
.
load
(
cStringIO
.
StringIO
(
data
)
)
STATE_NONE
=
"..."
STATE_DICT
=
{
0
:
"...."
,
1
:
"NORM"
,
2
:
"BUSY"
,
3
:
"FULL"
}
REGION_NAME_DICT
=
info
[
"NAME"
]
REGION_AUTH_SERVER_DICT
=
info
[
"AUTHADDR"
]
REGION_DICT
=
info
[
"GAMEADDR"
]
MARKADDR_DICT
=
info
[
"MARKADDR"
]
Obviamente el archivo que lee que es locale_es.addr esta encryptado en otro lenguage casi imposible de desencryptar
espero puedan darme ideas, gracias desde ya
Tweet
Imprimir
Páginas: [
1
]
« anterior
próximo »
SoloCodigo
»
Foros
»
Programación Web y Scripting
»
Python
(Moderador:
arielb
) »
problema en Python