Сообщений: 67
Тем: 8
Зарегистрирован: Jun 2011
Репутация:
9
Привет всем, хочу написать простенький сниффер для Arma 2.
Нашел алгоритм декрипта пакетов и появилась идея собрать dll с export DecodePacket EncodePacket, и использовать в c# проекте, но увы знания С равны 0 даже никогда проекты не собирал, если кому не сложно помогите собрать dll вот код:
Код
static unsigned char byte_table[2080] = {0};
int __cdecl sub_B713BD(int a1) // 1.62
{
return ((unsigned __int16)(-5331 * (9 * (a1 ^ ((a1 ^ 0x3D0000u) >> 16)) ^ (9 * (a1 ^ ((a1 ^ 0x3D0000) >> 16)) >> 4))) ^ (unsigned __int16)(668265261 * (9 * (a1 ^ ((a1 ^ 0x3D0000) >> 16)) ^ (9 * (a1 ^ ((a1 ^ 0x3D0000) >> 16)) >> 4)) >> 15)) & 0x7FFF;
}
int DecodePacket(BYTE* packet, int size)
{
int Result = 0;
if (packet && size >= 24){
int unknownVal = 0;
int i = 24;
int unknown_field0 = *(DWORD *)(packet + 0x08);
unknownVal = sub_B713BD(unknown_field0);
do
{
*((BYTE *)packet + i) ^= byte_table[(i + unknownVal) & 0x7FF];
++i;
}
while (i <= packet[0]);
Result = 1;
}
return Result;
}
int EncodePacket(BYTE* packet, int size)
{
int Result = 0;
if (packet && size >= 24){
int unknownVal = 0;
int i = 24;
int unknown_field0 = *(DWORD *)(packet + 0x08);
unknownVal = sub_B713BD(unknown_field0);
do
{
packet[i] ^= byte_table[((WORD)i + unknownVal) & 0x7FF];
++i;
}
while (i <= *(WORD *)packet);
Result = 1;
}
return Result;
}
Заранее спасибо.
Сообщений: 176
Тем: 4
Зарегистрирован: Jan 2013
Репутация:
1,011
Ксорка на 0x7FF
Что мешает просто эти функции переписать на шарп?
Сообщений: 1,610
Тем: 44
Зарегистрирован: Jan 2016
Репутация:
1,353
Necroz-Team;406793 Написал:Что мешает просто эти функции переписать на шарп? vigorian;406791 Написал:но увы знания С равны 0 А фиг знает.
Сообщений: 5,863
Тем: 105
Зарегистрирован: Sep 2010
Репутация:
13,014
Да тут можно копипастом прямо.
Сообщений: 67
Тем: 8
Зарегистрирован: Jun 2011
Репутация:
9
Necroz-Team Написал:Ксорка на 0x7FF
Что мешает просто эти функции переписать на шарп?
а как насчет этой функции sub_B713BD, это и есть xor?
Пытался погуглить, нашел такой сампл
public static byte[] CryptPacket(byte[] packet)
{
// create a new instance
byte[] output = new byte[packet.Length];
// process ALL array items
for (int i = 0; i < packet.Length; i++)
{
output[i] = (byte)(0x61 ^ packet[i]);
}
return output;
}
то есть в место 0x61 юзать 0x7FF
не подскажите как переписать, увы с xor никогда не работал.
Сообщений: 6,450
Тем: 262
Зарегистрирован: Nov 2007
Репутация:
44,165
Код: int unknown_field0 = *(DWORD *)(packet + 0x08);
Что там на 8 индексе в пакете?
Сообщений: 92
Тем: 7
Зарегистрирован: May 2012
Репутация:
1,204
Да простят меня шарп кодеры:redlol:
C# Code
PHP код: <?php
public static byte[] byte_table = {
0x70, 0x38, 0x9C, 0x4E, 0x27, 0x13, 0x89, 0xC4, 0x62, 0xB1, 0x58, 0x2C,
0x16, 0x8B, 0xC5, 0x62, 0xB1, 0xD8, 0x6C, 0xB6, 0xDB, 0xED, 0x76, 0x3B,
0x9D, 0x4E, 0xA7, 0xD3, 0x69, 0x34, 0x1A, 0x0D, 0x86, 0xC3, 0x61, 0xB0,
0xD8, 0xEC, 0x76, 0xBB, 0xDD, 0xEE, 0xF7, 0x7B, 0xBD, 0xDE, 0xEF, 0x77,
0xBB, 0xDD, 0xEE, 0xF7, 0xFB, 0x7D, 0x3E, 0x1F, 0x8F, 0xC7, 0xE3, 0xF1,
0xF8, 0xFC, 0x7E, 0xBF, 0xDF, 0xEF, 0x77, 0x3B, 0x1D, 0x0E, 0x87, 0xC3,
0x61, 0xB0, 0x58, 0xAC, 0xD6, 0xEB, 0x75, 0x3A, 0x9D, 0x4E, 0xA7, 0xD3,
0xE9, 0xF4, 0xFA, 0xFD, 0x7E, 0xBF, 0x5F, 0xAF, 0xD7, 0xEB, 0x75, 0x3A,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, 0x94, 0x4A,
0xA5, 0x52, 0x29, 0x94, 0xCA, 0x65, 0x32, 0x99, 0xCC, 0xE6, 0x73, 0xB9,
0xDC, 0xEE, 0xF7, 0xFB, 0x7D, 0x3E, 0x1F, 0x0F, 0x87, 0x43, 0xA1, 0xD0,
0xE8, 0x74, 0xBA, 0xDD, 0xEE, 0x77, 0xBB, 0x5D, 0x2E, 0x17, 0x0B, 0x05,
0x82, 0xC1, 0xE0, 0xF0, 0xF8, 0xFC, 0x7E, 0x3F, 0x1F, 0x0F, 0x87, 0xC3,
0xE1, 0x70, 0xB8, 0xDC, 0x6E, 0xB7, 0xDB, 0x6D, 0xB6, 0x5B, 0xAD, 0x56,
0x2B, 0x95, 0xCA, 0x65, 0x32, 0x19, 0x0C, 0x06, 0x83, 0xC1, 0x60, 0xB0,
0xD8, 0xEC, 0x76, 0x3B, 0x9D, 0xCE, 0xE7, 0xF3, 0xF9, 0xFC, 0xFE, 0x7F,
0xBF, 0xDF, 0x6F, 0xB7, 0x5B, 0xAD, 0xD6, 0xEB, 0x75, 0x3A, 0x9D, 0x4E,
0xA7, 0x53, 0x29, 0x94, 0xCA, 0xE5, 0x72, 0xB9, 0x5C, 0xAE, 0xD7, 0xEB,
0xF5, 0xFA, 0xFD, 0xFE, 0xFF, 0x7F, 0xBF, 0x5F, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3F,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00 };
public static int sub_B713BD(int a1) // 1.62
{
return ((ushort)(-5331 * (9 * (a1 ^ ((a1 ^ 0x3D0000u) >> 16)) ^ (9 * (a1 ^ ((a1 ^ 0x3D0000) >> 16)) >> 4))) ^ (ushort)(668265261 * (9 * (a1 ^ ((a1 ^ 0x3D0000) >> 16)) ^ (9 * (a1 ^ ((a1 ^ 0x3D0000) >> 16)) >> 4)) >> 15)) & 0x7FFF;
}
public static int DecodePacket(byte[] packet, int size)
{
int Result = 0;
if (packet.Length != 0 && size >= 24)
{
int unknownVal = 0;
int i = 24;
int unknown_field0 = BitConverter.ToInt32(packet, 8);
unknownVal = sub_B713BD(unknown_field0);
do
{
packet[i] ^= byte_table[(i + unknownVal) & 0x7FF];
++i;
}
while (i <= packet[0]);
Result = 1;
}
return Result;
}
public static int EncodePacket(byte[] packet, int size)
{
int Result = 0;
if (packet.Length != 0 && size >= 24)
{
int unknownVal = 0;
int i = 24;
int unknown_field0 = BitConverter.ToInt32(packet, 8);
unknownVal = sub_B713BD(unknown_field0);
do
{
packet[i] ^= byte_table[((ushort)i + unknownVal) & 0x7FF];
++i;
}
while (i <= BitConverter.ToInt16(packet, 0));
Result = 1;
}
return Result;
}
Ну а если нужна прям сяшная либа то тогда вот
C++ DLL Code
PHP код: <?php
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
unsigned char byte_table[2080] = {
0x70, 0x38, 0x9C, 0x4E, 0x27, 0x13, 0x89, 0xC4, 0x62, 0xB1, 0x58, 0x2C,
0x16, 0x8B, 0xC5, 0x62, 0xB1, 0xD8, 0x6C, 0xB6, 0xDB, 0xED, 0x76, 0x3B,
0x9D, 0x4E, 0xA7, 0xD3, 0x69, 0x34, 0x1A, 0x0D, 0x86, 0xC3, 0x61, 0xB0,
0xD8, 0xEC, 0x76, 0xBB, 0xDD, 0xEE, 0xF7, 0x7B, 0xBD, 0xDE, 0xEF, 0x77,
0xBB, 0xDD, 0xEE, 0xF7, 0xFB, 0x7D, 0x3E, 0x1F, 0x8F, 0xC7, 0xE3, 0xF1,
0xF8, 0xFC, 0x7E, 0xBF, 0xDF, 0xEF, 0x77, 0x3B, 0x1D, 0x0E, 0x87, 0xC3,
0x61, 0xB0, 0x58, 0xAC, 0xD6, 0xEB, 0x75, 0x3A, 0x9D, 0x4E, 0xA7, 0xD3,
0xE9, 0xF4, 0x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xAF,
0x57, 0x2B, 0x15, 0x0A, 0x05, 0x82, 0x41, 0xA0, 0x50, 0x28, 0x94, 0x4A,
0xA5, 0x52, 0x29, 0x94, 0xCA, 0x65, 0x32, 0x99, 0xCC, 0xE6, 0x73, 0xB9,
0xDC, 0xEE, 0xF7, 0xFB, 0x7D, 0x3E, 0x1F, 0x0F, 0x87, 0x43, 0xA1, 0xD0,
0xE8, 0x74, 0xBA, 0xDD, 0xEE, 0x77, 0xBB, 0x5D, 0x2E, 0x17, 0x0B, 0x05,
0x82, 0xC1, 0xE0, 0xF0, 0xF8, 0xFC, 0x7E, 0x3F, 0x1F, 0x0F, 0x87, 0xC3,
0xE1, 0x70, 0xB8, 0xDC, 0x6E, 0xB7, 0xDB, 0x6D, 0xB6, 0x5B, 0xAD, 0x56,
0x2B, 0x95, 0xCA, 0x65, 0x32, 0x19, 0x0C, 0x06, 0x83, 0xC1, 0x60, 0xB0,
0xD8, 0xEC, 0x76, 0x3B, 0x9D, 0xCE, 0xE7, 0xF3, 0xF9, 0xFC, 0xFE, 0x7F,
0xBF, 0xDF, 0x6F, 0xB7, 0x5B, 0xAD, 0xD6, 0xEB, 0x75, 0x3A, 0x9D, 0x4E,
0xA7, 0x53, 0x29, 0x94, 0xCA, 0xE5, 0x72, 0xB9, 0x5C, 0xAE, 0xD7, 0xEB,
0xF5, 0xFA, 0xFD, 0xFE, 0xFF, 0x7F, 0xBF, 0x5F, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3F,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00};
int __cdecl sub_B713BD(int a1)
{
return ((unsigned __int16)(-5331 * (9 * (a1 ^ ((a1 ^ 0x3D0000u) >> 16)) ^ (9 * (a1 ^ ((a1 ^ 0x3D0000) >> 16)) >> 4))) ^ (unsigned __int16)(668265261 * (9 * (a1 ^ ((a1 ^ 0x3D0000) >> 16)) ^ (9 * (a1 ^ ((a1 ^ 0x3D0000) >> 16)) >> 4)) >> 15)) & 0x7FFF;
}
extern "C"
{
__declspec(dllexport) int DecodePacket(BYTE* packet, int size)
{
int Result = 0;
if (packet && size >= 24){
int unknownVal = 0;
int i = 24;
int unknown_field0 = *(DWORD *)(packet + 0x08);
unknownVal = sub_B713BD(unknown_field0);
do
{
*((BYTE *)packet + i) ^= byte_table[(i + unknownVal) & 0x7FF];
++i;
}
while (i <= packet[0]);
Result = 1;
}
return Result;
}
}
extern "C"
{
__declspec(dllexport) int EncodePacket(BYTE* packet, int size)
{
int Result = 0;
if (packet && size >= 24){
int unknownVal = 0;
int i = 24;
int unknown_field0 = *(DWORD *)(packet + 0x08);
unknownVal = sub_B713BD(unknown_field0);
do
{
packet[i] ^= byte_table[((WORD)i + unknownVal) & 0x7FF];
++i;
}
while (i <= *(WORD *)packet);
Result = 1;
}
return Result;
}
}
C# DLL Usage
PHP код: <?php
[DllImport("APCLib.dll", EntryPoint = "DecodePacket", CallingConvention = CallingConvention.StdCall)]
public static extern int DecodePacket(byte[] packet, int size);
[DllImport("APCLib.dll", EntryPoint = "EncodePacket", CallingConvention = CallingConvention.StdCall)]
public static extern int EncodePacket(byte[] packet, int size);
Собранный вариант либы вместе с исходником тут
|