Page 1 of 1
adding a rpackets
Posted: 12 Mar 2017, 14:26
by GitzJoey
hi,
sorry if i noob in perl, but i need info on how to add/push $rpackets in MessageTokenizer.pm (line 125)
im guessing that $rpackets are in some kind of (key, value) array form, which generated frm recvpacket.txt
i just need to push a new token,
thanks
Re: adding a rpackets
Posted: 12 Mar 2017, 16:15
by Mortimal
Yep u right in
function.pl we got:
Code: Select all
Settings::addTableFile(Settings::getRecvPacketsFilename(),
loader => [\&parseRecvpackets, \%rpackets]);
This means
%rpackets contains all packets from
recvpacket file. So we need to look in
FileParser.pm and find it structure:
Code: Select all
my ($packetID, $length, $minLength, $repeat, $function) = split /\s+/, $line, 5;
$packetID =~ s/^(0x[0-9a-f]+)$/hex $1/e;
$r_hash->{$packetID}{length} = $length;
$r_hash->{$packetID}{minLength} = $minLength;
$r_hash->{$packetID}{repeat} = $repeat;
$r_hash->{$packetID}{function} = $function;
Boom here it is.
And u no need to push in hash.... it is hash
If u need only packet and size do this:
Code: Select all
$rpackets->{your_packet_here}{length} = your_length_here;
example:
Re: adding a rpackets
Posted: 12 Mar 2017, 16:47
by GitzJoey
it works thanks
Re: adding a rpackets
Posted: 12 Mar 2017, 17:26
by GitzJoey
thanks again
Re: adding a rpackets
Posted: 12 Mar 2017, 17:35
by Mortimal
Duno what u wrote?
Receive or Send? U want to edit packet content lengths on the go, while Kore working? Because if not this can be put in your serverType file.
Re: adding a rpackets
Posted: 12 Mar 2017, 17:52
by GitzJoey
yes, what im facing in my country is randomize token (specially for login)
i'm guessing i need to rebuilding on the fly specially for revpacket and receive
Re: adding a rpackets
Posted: 12 Mar 2017, 18:10
by Mortimal
if all packets working correct except this why u no set exception for all packets not set in recvpackets.txt?
it is in
parse function in src\Network\PacketParser.pm just consider all unset packets is your packet....
Code: Select all
unless ($handler) {
warning "Packet Parser: Unknown switch: $lastSwitch\n";#
return undef;#delete this
$handler = ['bla_bla', 'bla bla bla', [qw(bla bla)]];
}
of course this is extreme but u can try
Re: adding a rpackets
Posted: 12 Mar 2017, 18:19
by GitzJoey
yes tq for the tip
i just $self->{packet_list}{$lastSwitch} = ['secure_login_key', 'x2 a*', [qw(secure_key)] ];
before my $handler
anyway its already fixed, but having a different error now lol
tq anyway
Re: adding a rpackets
Posted: 12 Mar 2017, 18:21
by Mortimal
no prob good luck)