Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void hldec(unsigned char *buff, unsigned int pcksz) {
- #define HL_NTOHL(x) \
- ((((x) & 0xff000000) >> 24) | \
- (((x) & 0x00ff0000) >> 8) | \
- (((x) & 0x0000ff00) << 8) | \
- (((x) & 0x000000ff) << 24))
- const static unsigned char hlhash[] =
- "\x05\x61\x7A\xED\x1B\xCA\x0D\x9B\x4A\xF1\x64\xC7\xB5\x8E\xDF\xA0";
- unsigned char *ptrebpc;
- unsigned int *lbuff = (unsigned int *)buff,
- pcknum,
- invnum,
- ebpc;
- int cont,
- i;
- if(pcksz < 9) return;
- pcknum = *buff;
- invnum = ~pcknum;
- pcksz = (pcksz - 8) >> 2;
- lbuff += 2;
- cont = 0;
- while(pcksz--) {
- ebpc = *lbuff ^ pcknum;
- ptrebpc = (unsigned char *)&ebpc;
- for(i = 0; i < 4; i++) {
- *ptrebpc ^= (((hlhash[(cont + i) & 0xf] | (i << i)) | i) | 0xA5);
- ptrebpc++;
- }
- *lbuff = HL_NTOHL(ebpc) ^ invnum;
- lbuff++;
- cont++;
- }
- }
- int main()
- {
- unsigned char msg[] = "\x02\x00\x00\xc0\x01\x00\x00\x80Y\x18\x01\x03\x99\x00\x10Bg\x19@\x020/x!\x0fQ\x0b`2\r\x18Zp\x14CG+tePfkup(8=bq|%\x10n+5ph7n+7 ?6kv<q6-tl*6ie/2*- %q2~/sy6s5,~#%\"4.y,+wnw(gb,9(\'p\x11\x18Jwt\'3 <3e,>s5`f69,1?~wbwr,)0\'p5\n\x00";
- printf("ds", strlen(msg)
- hldec(msg, 148);
- unsigned char* mmm = msg;
- printf("hello");
- printf("%s here",mmm);
- return 0;
- }
- <?php
- function HL_NTOHL($x)
- {
- return ((($x) & 0xff000000) >> 24) | ((($x) & 0x00ff0000) >> 8) | ((($x) & 0x0000ff00) << 8) | ((($x) & 0x000000ff) << 24);
- }
- function pre_hldec($str)
- {
- hldec(str_split($str), strlen($str), $str);
- }
- function int_to_byte_array($int)
- {
- return unpack("c*", pack("l", $int));
- }
- function hldec($buff, $pcksz, $bin_str)
- {
- $hlhash =
- "\x05\x61\x7A\xED\x1B\xCA\x0D\x9B\x4A\xF1\x64\xC7\xB5\x8E\xDF\xA0";
- $lbuff = unpack("l*", $bin_str);
- if($pcksz < 9) return;
- $pcknum = $buff[1];
- $invnum = ~$pcknum;
- $pcksz = ($pcksz - 8) >> 2;
- $ilbuff = 3;
- $cont = 0;
- while($pcksz--) {
- $ebpc = $lbuff[$ilbuff] ^ $pcknum;
- $ptrebpc = int_to_byte_array($ebpc);
- for($i = 1; $i <= 4; $i++) {
- $ptrebpc[$i] ^= ((($hlhash[($cont + $i) & 0xf] | ($i << $i)) | $i) | 0xA5);
- }
- $lbuff[$ilbuff] = HL_NTOHL($ebpc) ^ $invnum;
- $ilbuff++;
- $cont++;
- }
- return pack("l*", $lbuff);
- }
- echo hldec("DeadBeafDeadBeaf");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement