add SendUsrChk and test it
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"extensions": ["ts", "js"],
|
||||||
|
"node-option": [
|
||||||
|
"experimental-specifier-resolution=node",
|
||||||
|
"loader=ts-node/esm"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
.PHONY: run install-wireshark-dissector
|
.PHONY: run install-wireshark-dissector test
|
||||||
|
|
||||||
bundle.js: asd.js func_replacements.js
|
bundle.js: asd.js func_replacements.js
|
||||||
~/node_modules/.bin/frida-compile -o $@ asd.js
|
~/node_modules/.bin/frida-compile -o $@ asd.js
|
||||||
@@ -11,6 +11,12 @@ venv: requirements.txt
|
|||||||
run: bundle.js venv
|
run: bundle.js venv
|
||||||
./venv/bin/python3 -u loader3.py
|
./venv/bin/python3 -u loader3.py
|
||||||
|
|
||||||
|
node_modules:
|
||||||
|
npm install
|
||||||
|
|
||||||
|
test: node_modules
|
||||||
|
./node_modules/.bin/mocha --require ts-node/register tests/fn.test.js
|
||||||
|
|
||||||
install-wireshark-dissector:
|
install-wireshark-dissector:
|
||||||
mkdir -p ~/.local/lib/wireshark/plugins
|
mkdir -p ~/.local/lib/wireshark/plugins
|
||||||
ln -s $(PWD)/dissector.lua ~/.local/lib/wireshark/plugins/dissector.lua
|
ln -s $(PWD)/dissector.lua ~/.local/lib/wireshark/plugins/dissector.lua
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ const str2byte = (s: string): number[] => {
|
|||||||
return Array.from(s).map((_, i) => s.charCodeAt(i));
|
return Array.from(s).map((_, i) => s.charCodeAt(i));
|
||||||
};
|
};
|
||||||
|
|
||||||
const SendUsrChk = (username: string, password: string): DataView => {
|
export const SendUsrChk = (username: string, password: string): DataView => {
|
||||||
// type is char account[0x20]; char password[0x80];
|
// type is char account[0x20]; char password[0x80];
|
||||||
let buf = new Uint8Array(0x20 + 0x80);
|
let buf = new Uint8Array(0x20 + 0x80);
|
||||||
buf.fill(0);
|
buf.fill(0);
|
||||||
@@ -40,4 +40,4 @@ const SendUsrChk = (username: string, password: string): DataView => {
|
|||||||
return retret;
|
return retret;
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(hexdump(SendUsrChk("admin", "admin").buffer, { ansi: true }));
|
//console.log(hexdump(SendUsrChk("admin", "admin").buffer, { ansi: true }));
|
||||||
|
|||||||
+12
-1
@@ -1,9 +1,10 @@
|
|||||||
import "../shim.js";
|
import "../shim.ts";
|
||||||
|
|
||||||
import assert from "assert";
|
import assert from "assert";
|
||||||
|
|
||||||
import { placeholderTypes, sprintf } from "../utils.js";
|
import { placeholderTypes, sprintf } from "../utils.js";
|
||||||
import { XqBytesDec, XqBytesEnc } from "../func_replacements.js";
|
import { XqBytesDec, XqBytesEnc } from "../func_replacements.js";
|
||||||
|
import { SendUsrChk } from "../impl.ts";
|
||||||
|
|
||||||
describe("debug_tools", () => {
|
describe("debug_tools", () => {
|
||||||
it("parses printed data", () => {
|
it("parses printed data", () => {
|
||||||
@@ -89,3 +90,13 @@ describe("module", () => {
|
|||||||
assert.deepEqual(new Uint8Array(in_buf.buffer), long_dec_bytes); //DEC
|
assert.deepEqual(new Uint8Array(in_buf.buffer), long_dec_bytes); //DEC
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const hstrToBA = (hs) => new Uint8Array(hs.match(/../g).map((h) => parseInt(h, 16))).buffer;
|
||||||
|
describe("make packet", () => {
|
||||||
|
it("builds a good SendUsrChk", () => {
|
||||||
|
const expected_str =
|
||||||
|
"f1d000b0d1000000110a2010a400ff00000000006f01010101010101010101010101010101010101010101010101010160656c686f01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010160656c68";
|
||||||
|
const expected = hstrToBA(expected_str);
|
||||||
|
assert.deepEqual(SendUsrChk("admin", "admin").buffer, expected);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user