This commit is contained in:
Tau
2019-03-30 18:30:45 -04:00
parent 679accd74d
commit c2f7e9fe19
7 changed files with 48 additions and 5 deletions

View File

@@ -28,7 +28,11 @@ export default async function aimedb(socket) {
case "lookup":
case "lookup2":
console.log("Aimedb: Mifare lookup", req.luid);
output.write({ type: req.type, status: 1 }); // Add aimeId if desired
output.write({
type: req.type,
status: 1,
aimeId: 0x55667788,
});
break;

View File

@@ -22,6 +22,14 @@ readers.set(MSG.ACCOUNT_LOCK_REQ, buf => {
};
});
readers.set(MSG.ACCOUNT_UNLOCK_REQ, buf => {
return {
type: "account_unlock_req",
aimeId: buf.readUInt32LE(0x0004),
pcbId: buf.slice(0x0008, buf.indexOf("\0", 0x0008)).toString("ascii"),
};
});
readers.set(MSG.CREATE_RECORD_REQ, buf => {
return {
type: "create_record_req",

View File

@@ -8,6 +8,8 @@ export const MSG = {
UPDATE_RECORD_REQ: 0x0068,
ACCOUNT_LOCK_REQ: 0x0069,
ACCOUNT_LOCK_RES: 0x006a,
ACCOUNT_UNLOCK_REQ: 0x006f,
ACCOUNT_UNLOCK_RES: 0x0070,
CREATE_TEAM_REQ: 0x007b,
CREATE_TEAM_RES: 0x007c,
UPDATE_STORY_CLEAR_REQ: 0x007f,
@@ -20,6 +22,7 @@ export const MSG = {
export const REQ_LEN = new Map<number, number>();
REQ_LEN.set(MSG.ACCOUNT_LOCK_REQ, 0x0020);
REQ_LEN.set(MSG.ACCOUNT_UNLOCK_REQ, 0x0020);
REQ_LEN.set(MSG.CREATE_RECORD_REQ, 0x00c0);
REQ_LEN.set(MSG.CREATE_TEAM_REQ, 0x0010);
REQ_LEN.set(MSG.GET_CONFIG_REQ, 0x0050);

View File

@@ -29,6 +29,13 @@ export class Encoder extends Transform {
break;
case "account_unlock_res":
buf = Buffer.alloc(0x0010);
buf.writeUInt16LE(MSG.ACCOUNT_UNLOCK_RES, 0x0000);
buf.writeUInt8(obj.status, 0x0004);
break;
case "create_team_res":
buf = Buffer.alloc(0x0ca0);
buf.writeUInt16LE(MSG.CREATE_TEAM_RES, 0x0000);
@@ -39,7 +46,7 @@ export class Encoder extends Transform {
case "generic_res":
buf = Buffer.alloc(0x0020);
buf.writeUInt16LE(MSG.GENERIC_RES, 0x0000);
buf.writeUInt32LE(obj.field_0004, 0x0004);
buf.writeUInt32LE(obj.status, 0x0004);
break;

View File

@@ -22,10 +22,18 @@ export default async function idz(socket: Socket) {
break;
case "account_unlock_req":
output.write({
type: "account_unlock_res",
status: 1,
});
break;
case "create_record_req":
output.write({
type: "generic_res",
field_0004: 1,
status: 1,
});
break;
@@ -115,7 +123,7 @@ export default async function idz(socket: Socket) {
case "update_record_req":
output.write({
type: "generic_res",
field_0004: 1,
status: 1,
});
break;

View File

@@ -5,6 +5,12 @@ export interface AccountLockRequest {
field_0018: number;
}
export interface AccountUnlockRequest {
type: "account_unlock_req";
aimeId: number;
pcbId: string;
}
export interface CreateRecordRequest {
type: "create_record_req";
aimeId: number;
@@ -62,6 +68,7 @@ export interface UpdateRecordRequest {
export type Request =
| AccountLockRequest
| AccountUnlockRequest
| CreateRecordRequest
| CreateTeamRequest
| GetConfigRequest

View File

@@ -5,9 +5,14 @@ export interface AccountLockResponse {
field_001C: Date;
}
export interface AccountUnlockResponse {
type: "account_unlock_res";
status: number;
}
export interface GenericResponse {
type: "generic_res";
field_0004: number;
status: number;
}
export interface CreateTeamResponse {
@@ -79,6 +84,7 @@ export interface UpdateProvisionalStoreRankResponse {
export type Response =
| AccountLockResponse
| AccountUnlockResponse
| CreateTeamResponse
| GenericResponse
| GetConfigResponse