webgl
and fuse
again. I should work, right?
webgl
and fuse
again. I should work, right?
Oh my, oh my. It has been literally ages since I have written anything in here. And it has been quite long since I have stopped playing with (emphasis on the with) the Silkroad.
Perhaps it is time to come back, with some nice
project. The only issue is that I am quite sunken in my university stuff - did I ever tell you how cool algebraic structures are? Nope. And I will not. Ever.
Obviously, I am somewhere in the middle of my university exams, which are not as easy as I would like them to be, although I am in no position to complain since I have chosen this path to enlightenment.
Brace yourselves, the winter updates are coming. For now, you can play with my little (but cool, prolly webkit only) html5
thingy; it is great if you like to fold paper into cyclic shapes.
python
again) which works as a 'smart' packet buffer reader, allowing us to read 16-bit integers (words
) and string of length indicated by a word
. It is only excerpt, original code does much more.class reader:
def sword(self):
return struct.unpack('H', self.bytes(2))[0]
def ascii(self):
count = self.sword()
return self.bytes(count)
def bytes(self, count):
return self.buffer[self.offset:self.move(count)]
def move(self, by):
self.offset += by
return self.offset
arg: by
) to current offset without checking validity of position.def move(self, by):
self.offset += by
if self.offset >= self.length
raise IndexError
return self.offset
csremu/vbsremu/dsremu/iamsogaysremu
? Are you sure that your favourite piece of emulation software is working properly? Is it parsing data properly, checking for possible reading over buffer bounds? Most emulators fail at this. And they fail pretty hard, resulting in crashes and/or possible exploitation and injected code execution.vb6
or c#.net
the latter possibility is quite unlikely to happen, however be ready to face out-of-bounds exceptions. Look at this extremely short script, written in python
, which is able to crash certain badly written server with a single packet.import socket
import struct
sockie = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sockie.connect(('server.ip', 15779))
sockie.send(struct.pack('HHHBHHH', 9, 0x6102, 0, 0, 0xffff, 0xffff, 1337));
sockie.close()
short length
short opcode
short security
byte method
short length
byte+ username
short length
byte+ password
short serverid
length
, opcode
, security
- that makes for a cute packet header. Nothing really exploitable in there (well not directly).login method
, username
, password
and server id
. Look carefully at the username and password fields. In packets, they are stored as a short
(16 bit
) integer
. Their value specifies how long the username is.0x2001
) and patch information (0x6100
) where SR_Client
string is sent in exactly same manner.php
:<?php
fwrite(fsockopen("server.ip", 15779, null, null, 1.0), "\x07\x00\x02\x61\x00\x00\x00\xff\xff\xff\xff\xff\xff");
?>
It has been quite long since I have posted here. It has also taken a lot of courage and a lot of beer to actually encourage me to write something. Blessed be the brewery. Whatever.
For those who care, the esro project is still up and running. In short - we have switched to different board software, removed that fugly front page - update: it is up again, god damn it! - and had npcdoom working round a clock to provide you bastards with your drug of choice (silkroad). He has worked really hard, so you can expect another stage of in-house beta test soon. By now, he has nearly everything from to-do (and to-fix) working. Previous few sentences are maybe a little exaggerated. A little. Lets not give up our hopes, he is the god of abyss.
Yeah, all my previous projects are in the nearly same state as they were in by the start of year 2010. I have learnt some new and rather interesting stuff but nothing much. I have also switched from windows to linux platform - this leading to termination of my 'silkroad' requiring projects (good bye dungeons...) - at least until I find myself in mood to work on them.
Also, some week ago, my vacation started. Not that it actually matters. Only that I have to find some work for myself. Paid one, preferably. Although I have most probably found one, the project involved leads to some web-service stuff...meaning some php or java. I am not very fond of java and the too-much-mvc approach people like nowdays. I quit working with php few years ago, only to write in C/C++ (which I have done for past years quite successfully)...
We would like to have crest server before public beta test. After few nights of thinking, I have abandoned the original idea of 'super optimized' server written in C. I have done that because I would have to implement the 'http' or 'ftp' (even worse) layer. I have also abandoned the idea of lighttpd or apache2.x module simply because of the security and development trouble. All of this brought me to an idea 'why not simply use the lighttpd or apache, memory mapping and simple tar archive' with kinda same and rather
Whatever...
Once we know points, beginning and end of ray, we only have to search for points laying on it. To do this, we have to know little of analytic geometry - ray equation. Ray equation has many forms, but we are interested in vector-expressed form, which basicly looks like this:// Z-coordinate specifies plane in this case // 0 is near plane, 1 is far plane Vector3 pointA = new Vector3(mouse.X, mouse.Y, 0.0f); Vector3 pointB = new Vector3(mouse.X, mouse.Y, 1.0f); // Method Vector3.Unproject gives us points space, on near and far plane, as we wanted pointA.Unproject(device.Viewport, device.Transform.Projection, device.Transform.View, device.Transform.World); pointB.Unproject(device.Viewport, device.Transform.Projection, device.Transform.View, device.Transform.World);
cx
, cy
and cz
are equal - point is part of the ray, thus point we are searching for. This is nice, however there is little problem - in real situation, these number will never be equal. They will always differ a little - it is up to you, how big difference you wish to tolerate.esro-related
projects, I have also had little affair with Dragon Age: Origins
(which caused some school-related hardships, you see).esro project
, I started to learn Managed DirectX basics, means DirectX implementation in .NET
, respectively in C#.NET
which I prefer to other .NET
languages, although Visual Basic
is barely a language (at least I do not consider it being language at all).DirectX API
, it is not like OpenGL
, it is OOP
and it works well. Lets fry platform compatibility.C#.NET
? Was not I C/C++
maniac? I still am, however I am going to use DirectX in my school project - and unfortunately C
is not something we are taught, so I can hardly use it (and no one will understand C
; it is gonna be like: "where are classes? I cant see any classes - you have failed"). Also, this C# thing is fast, I mean developement is fast and easy. One point for Microsoft.fread(structure_ptr, 1, sizeof(*structure_ptr), file_ptr);
will not simply work. Creepy.BinaryReader
and BinaryWriter
classes, create some own Silkroad.Map
class. Should be easy.DirectX Testing
project.mapan
output.<HEADs data> 00 00 00 00 00 00 <CELLs list> < 95.254616> [ 9] 0|0|0|0|0|0 151 < 95.150909> [ 9] 0|0|0|0|0|0 0 < 94.895622> [ 9] 0|0|0|0|0|0 48 < 39.814507> [ 9] 0|0|0|0|0|0 173 < 34.398918> [ 9] 0|0|0|0|0|0 255 < 31.741215> [ 9] 0|0|0|0|0|0 253 < 30.212603> [ 9] 0|0|0|0|0|0 147 < 29.142269> [ 9] 0|0|0|0|0|0 147 < 27.314711> [ 9] 0|0|0|0|0|0 0 < 28.980433> [ 10] 0|0|0|0|1|0 102 F4 < 57.589970> [ 10] 0|0|0|0|1|0 119 F4 < 99.747597> [ 10] 0|0|0|0|1|0 135 F4 <111.529999> [ 10] 0|0|0|0|1|0 126 F4 <112.705101> [ 10] 0|0|0|0|1|0 148 F4 <110.057098> [ 10] 0|0|0|0|1|0 149 F4 <107.895660> [ 10] 0|0|0|0|1|0 151 F4 <102.116287> [177] 0|0|0|1|0|0 153 F3 ... too long → omitted data ... < 84.616913> [ 7] 0|0|0|0|0|0 71 < 86.001633> [ 7] 0|0|0|0|0|0 72 < 87.746216> [ 7] 0|0|0|0|0|0 0 < 87.350670> [ 10] 0|0|0|0|1|0 0 F4 < 87.209175> [ 10] 0|0|0|0|1|0 174 F4 < 15.944324> [ 10] 0|0|0|0|1|0 173 F4 < 12.501476> [ 10] 0|0|0|0|1|0 146 F4 < 10.208254> [ 10] 0|0|0|0|1|0 149 F4 < 8.148597> [ 10] 0|0|0|0|1|0 146 F4 < 7.875810> [ 9] 0|0|0|0|0|0 145 < 10.152893> [ 9] 0|0|0|0|0|0 145 < 11.087356> [ 9] 0|0|0|0|0|0 145 < 12.417652> [ 9] 0|0|0|0|0|0 145 < 10.967405> [ 9] 0|0|0|0|0|0 149 < 8.922949> [ 9] 0|0|0|0|0|0 41 < 9.426557> [ 9] 0|0|0|0|0|0 124 < 24.530247> [ 2] 0|0|0|0|0|0 36 <DATAs head> 00 03 00 00 48 42 <DATAs body> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00 04 01 04 01 04 00 04 00 04 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00 04 01 04 01 04 01 04 01 04 01 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00 04 01 04 01 04 00 04 00 04 00 04 00 00 00 00 00 00 00 00 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 00 00 00 00 00 00 00 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 00 00 00 00 00 00 00 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 00 00 00 00 00 00 00 00 04 00 04 00 04 00 04 00 04 01 04 00 04 00 04 00 04 00 04 00 04 00 04 00 00 00 00 00 00 00 00 00 04 00 04 00 04 00 04 00 04 00 04 01 04 01 04 01 04 00 04 00 04 00 04 00 00 00 00 00 00 00 00 00 04 00 04 00 04 00 04 00 04 00 04 01 04 01 04 01 04 01 04 01 04 01 04 00 00 00 00 00 00 00 00 00 04 00 04 00 04 00 04 00 04 00 04 01 04 01 04 00 04 01 04 00 04 00 04 00 00 00 00 00 00 00 00 00 04 00 04 00 04 00 04 00 04 00 04 00 04 01 04 00 04 01 04 00 04 00 04 00 00 00 00 00 00 00 00 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 01 04 00 04 01 04 00 04 00 00 00 00 00 00 00 00 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 00 04 <DATAs more> a3 4c 10 43 c1 79 ad c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
SV.T
in Media.pk2
pack.SV.T
file contains encrypted string with version number. This number is converted into integer, divided by 1000 and then added to 1.Size Type Name Description
---------------------------------------------------
1 char loginMethod Specifies login method (probably)
varies sstr identification Identifies client
4 long version Version of client
Size Type Name Description
---------------------------------------------------
varies lstr versionString Encrypted string with version
C#.NET
for SV.T
file modification and reading, the svtmod
. As always, it is console based application, with unix-like command line arguments.svtmod [-f "path/to/SV.T"] [-v "version"]
SV.T
is not specified, svtmod
uses ./SV.T
.svtmod
tries to read value from SV.T
path.SV.T
filesvtmod -f "media/SV.T"
SV.T
file (Silkroad displays this value as 6.666
)svtmod -f "update/SV.T" -v "5666"
Size Type Name Description
---------------------------------------------------
4 char fileType Specifies file identification, value NEKO is used.
4 long fileVersion Specifies file format version, value 0x01 is used.
1024 char colorPalette Specifies colour pallete used by Joymax. It is static member.
4 long crestCount Specifies crest count
varies cstr crestName Specifies crest name, ASCII-string ends with 0x00.
256 char crestData Specifies crest data, its mapping to colour palette.
In English (translated by great Google Translator) it says:디렉터리 나열이 거부되었습니다.
이 가상 디렉터리에서는 콘텐트를 나열할 수 없습니다.
Directory listing denied.
This virtual directory can list the content.
Example with some actual data (packet was caught on Uranus server).Size Type Name Description
---------------------------------------------------
1 char flag ?
4 long guildId ID of guild
varies scstr guildName Name of guild
4 long crestIndex Index of crest
Getting crestName Value
---------------------------------------------------
flag 01
guildId 71 0B 00 00
guildName 0B 00 44 69 76 69 6E 65 45 6C 69 74 65
crestIndex 03 00 00 00
Knowing this, we will rebuild name of this actual guild's crest (using data from packet example and knowledge of Uranus server I).Name Description
---------------------------------------------------
type Type of crest (Aliance, Guild)
serverId ID of server
guildId ID of guild
crestIndex Index of crest
Name Value
---------------------------------------------------
type G
serverId 187
guildId 2929
crestIndex 3
Extrahttp://gdmark.joymax.com:15080/SRO_CREST/G187_2929_3.crb
Cheers!ServerId ServerName
---------------------------------------------------
65 Xian
74 Aege
76 Troy
94 Athens
96 Oasis
102 Venice
107 Greece
113 Alps
114 Olympus
132 Tibet
134 Babel
150 RedSea
151 Rome
152 Sparta
156 Eldorado
159 Pacific
162 Alexander
165 Persia
166 Zeus
174 Poseidon
178 Hercules
179 Odin
180 Mercury
181 Mars
182 Saturn
183 Venus
187 Uranus
188 Pluto
190 Neptune
191 Hera (New)
194 Gaia (New)
204 Eos (New)
205 Phoenix (New)
206 Ares (New)
207 Iris (New)
208 Titan (New)
209 Apollo (New)
ContentSize Type Name Description
---------------------------------------------------
8 char type File format type
4 char version Version of file format type
Map cellSize Type Name Description
---------------------------------------------------
6 char header Header, unknown meaning
2023 - - Cells
546 char unknown Unknown data block
VC++ notationSize Type Name Description
---------------------------------------------------
4 float height Height of map cell
10b surfaceId Surface texture ID
1b flag_6
1b flag_5
1b flag_4
1b flag_3
1b flag_2
1b flag_1
1 char light Lightness of texture
struct MBlock
{
unsigned char header[6];
MCell grid[17][17];
unsigned char unknown[546];
};
struct MCell
{
float height;
unsigned short surfaceId : 10;
unsigned short flag_6 : 1;
unsigned short flag_5 : 1;
unsigned short flag_4 : 1;
unsigned short flag_3 : 1;
unsigned short flag_2 : 1;
unsigned short flag_1 : 1;
unsigned char light;
};
BlockSize Type Name Description
---------------------------------------------------
2 short objectCount Amount of objects in group
VC++ notationSize Type Name Description
---------------------------------------------------
4 long objectId Object model ID
4 float positionX X coord (from left bottom corner of region)
4 float positionY Y coord
4 float positionZ Z coord
2 short unknown 0xffff or 0x0000
4 float theta Angle on Axis Y
4 long unique Unique id of object, if same, object is not shown
2 short unknown 0x0000 or 0x0001
1 char regionX X of region to be used as offset
1 char regionY Y of region to be used as offset
struct OGroup
{
unsigned short objectCount;
};
struct OBlock
{
unsigned int objectId;
float positionX;
float positionY;
float positionZ;
unsigned short unknown_1;
float theta;
unsigned int unique;
unsigned short unknown_2;
unsigned char regionX;
unsigned char regionY;
};
Note: Columns AG-AW contain requirements (such as certain skill level, etc.). These columns are paired. Example and description shall be supplemented.A # ?
B # identificator
C # resource identificator
D # chinese name
E # resource identificator (pair)
F # resource identificator (name)
G # resource identificator (desc)
H # ? mall flag (sellable)
I #
J #
K # ? {1 = equip; 2 = pets; 3 = etc}
L # item type
M # item subtype
N # ?
O # race {0 = china; 1 = euro; 3 = universal}
P # item bonus {0 = none; 2 = sox}
Q #
R #
S #
T # flags { 0 = not storable; 1 = not storable; 128; 196; 255 }
U # 0 = trade items; 1 = mall, 3 = rest
V #
W #
X #
Y # 0, 1, 129
Z #
AA # price buy
AB # ? price repair
AC # ? price repair broken
AD # ?
AE # ?
AF # price sell
AG # requirements (1 = level requirement, 513 etc. are skill mastery reqs)
AH # requirements (pair; value)
AI #
AJ #
AK #
AL #
AM #
AN #
AO #
AP #
AQ #
AR #
AS #
AT #
AU #
AV #
AW #
AX #
AY #
AZ #
BA # urn of BSR - equipped
BB # urn of BSR - world
BC # urn of DDJ - icon
BD #
BE #
BF # stacking amount
BG # gender {0 = woman; 1 = man; 2 = unisex}
BH #
BI #
BJ # grade - ceil(grade/3)
BK #
BL # min. durability
BM # max. durability
BN # min. phy def
BO # max. phy def
BP # +val phy def
BQ # min. parry
BR # max. parry
BS # ?
BT # min. phy absorption
BU # max. phy absorption
BV # ? +val phy absorption
BW # min. block
BX # max. block
BY # min. mag def
BZ # max. mag def
CA # +val mag def
CB # min. mag absorption
CC # max. mag absorption
CD # ? +val mag absorption
CE # min. phy reinforce
CF # max. phy reinforce
CG # min. mag reinforce
CH # max. mag reinforce
CI # ?
CJ # ?
CK # ?
CL # ?
CM # ?
CN # ?
CO # ?
CP # ?
CQ # range x10
CR # min. phy attack (min. range)
CS # min. phy attack (max. range)
CT # max. phy attack (min. range)
CU # max. phy attack (max. range)
CV # +val phy attack
CW # min. mag attack (min. range)
CX # min. mag attack (max. range)
CY # max. mag attack (min. range)
CZ # max. mag attack (max. range)
DA # +val mag attack
DB # min. phy reinforce (min. range)
DC # min. phy reinforce (max. range)
DD # max. phy reinforce (min. range)
DE # max. phy reinforce (max. range)
DF # min. mag reinforce (min. range)
DG # min. mag reinforce (max. range)
DH # max. mag reinforce (min. range)
DI # max. mag reinforce (max. range)
DJ # min. attack rating
DK # max. attack rating
DL # ?
DM # min. critical
DN # max. critical
DO # hp recover amount
DP # - chinese
DQ # hp recover percent
DR # - chinese
DS # mp recover amount
DT # - chinese
DU # mp recover percent
DV # - chinese
DW #
DX #
DY #
DZ #
EA #
EB #
EC #
ED #
EE #
EF #
EG #
EH #
EI #
EJ #
EK #
EL #
EM #
EN #
EO #
EP #
EQ #
ER #
ES #
ET #
EU #
EV #
EW #
EX #
EY #
EZ #
FA #
FB #
FC # magical options unit count
FD #
File namingA10_1363_2.crb
A10_1363_3.crb
G90_350_5.crb
G90_350_6.crb
File name written above can be split into these parts:A10_1363_2.crb
File dataName Description
---------------------------------------------------
type Type of crest (Aliance, Guild)
serverId ID of server
guildId ID of guild
crestIndex Index of crest
Crest file contains bitmap part of BMP. Since header, meta and palette are static, it is easy to rebuild bitmap:header
meta
palette
bitmap (crest file content)
Issuesstatic part (header, meta, palette)
dynamic part (bitmap)