@futpib/parser 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/allSettledStream.js +32 -14
- package/build/allSettledStream.test.js +32 -0
- package/build/androidPackage.d.ts +39 -0
- package/build/androidPackageParser.d.ts +17 -0
- package/build/androidPackageParser.js +183 -0
- package/build/{apkParser.test.js → androidPackageParser.test.js} +6 -6
- package/build/androidPackageUnparser.d.ts +4 -0
- package/build/{apkUnparser.js → androidPackageUnparser.js} +23 -23
- package/build/androidPackageUnparser.test.js +26 -0
- package/build/arbitrarilySlicedAsyncInterable.d.ts +3 -1
- package/build/arbitrarilySlicedAsyncInterable.js +3 -3
- package/build/arrayParser.test.js +3 -3
- package/build/backsmali.d.ts +1 -0
- package/build/backsmali.js +22 -0
- package/build/bsonParser.js +6 -2
- package/build/customInvariant.d.ts +1 -1
- package/build/dalvikBytecodeParser/formatParsers.d.ts +97 -0
- package/build/dalvikBytecodeParser/formatParsers.js +169 -0
- package/build/dalvikBytecodeParser.d.ts +107 -0
- package/build/dalvikBytecodeParser.js +836 -0
- package/build/dalvikExecutable.d.ts +158 -0
- package/build/dalvikExecutable.js +20 -0
- package/build/dalvikExecutableParser/stringSyntaxParser.d.ts +4 -0
- package/build/dalvikExecutableParser/stringSyntaxParser.js +76 -0
- package/build/dalvikExecutableParser/typeParsers.d.ts +10 -0
- package/build/dalvikExecutableParser/typeParsers.js +34 -0
- package/build/dalvikExecutableParser/typedNumbers.d.ts +90 -0
- package/build/dalvikExecutableParser/typedNumbers.js +19 -0
- package/build/dalvikExecutableParser.d.ts +5 -0
- package/build/dalvikExecutableParser.js +1439 -0
- package/build/dalvikExecutableParser.test.js +70 -0
- package/build/dalvikExecutableParserAgainstSmaliParser.test.js +298 -0
- package/build/debugLogInputParser.d.ts +4 -0
- package/build/debugLogInputParser.js +16 -0
- package/build/debugLogParser.js +14 -3
- package/build/disjunctionParser.d.ts +2 -1
- package/build/disjunctionParser.js +4 -2
- package/build/elementTerminatedArrayParser.d.ts +3 -0
- package/build/elementTerminatedArrayParser.js +18 -0
- package/build/elementTerminatedArrayParser.test.js +52 -0
- package/build/elementTerminatedSequenceArrayParser.d.ts +3 -0
- package/build/elementTerminatedSequenceArrayParser.js +32 -0
- package/build/elementTerminatedSequenceArrayParser.test.js +34 -0
- package/build/elementTerminatedSequenceParser.d.ts +3 -0
- package/build/elementTerminatedSequenceParser.js +27 -0
- package/build/elementTerminatedSequenceParser.test.js +34 -0
- package/build/exactElementParser.js +10 -5
- package/build/exactSequenceParser.d.ts +2 -1
- package/build/exactSequenceParser.js +12 -2
- package/build/fetchCid.d.ts +1 -0
- package/build/fetchCid.js +107 -0
- package/build/fixedLengthSequenceParser.d.ts +1 -0
- package/build/fixedLengthSequenceParser.js +18 -1
- package/build/fixedLengthSequenceParser.test.js +41 -0
- package/build/hasExecutable.d.ts +1 -0
- package/build/hasExecutable.js +8 -0
- package/build/highResolutionTimer.d.ts +16 -0
- package/build/highResolutionTimer.js +42 -0
- package/build/inputReader.d.ts +11 -0
- package/build/inputReader.js +37 -0
- package/build/inputReader.test.js +165 -0
- package/build/inputReaderState.d.ts +10 -0
- package/build/inputReaderState.js +16 -0
- package/build/inspect.d.ts +1 -0
- package/build/inspect.js +7 -0
- package/build/javaKeyStoreParser.test.js +2 -2
- package/build/jsonParser.d.ts +2 -0
- package/build/jsonParser.js +11 -14
- package/build/leb128Parser.d.ts +7 -0
- package/build/leb128Parser.js +82 -0
- package/build/leb128Parser.test.js +107 -0
- package/build/lookaheadParser.d.ts +2 -0
- package/build/lookaheadParser.js +14 -0
- package/build/negativeLookaheadParser.js +21 -15
- package/build/negativeLookaheadParser.test.js +30 -0
- package/build/nonEmptyArrayParser.d.ts +2 -0
- package/build/nonEmptyArrayParser.js +32 -0
- package/build/nonEmptyArrayParser.test.js +16 -0
- package/build/parser.d.ts +10 -1
- package/build/parser.js +66 -31
- package/build/parser.test.js +79 -12
- package/build/parserAccessorParser.js +9 -1
- package/build/parserConsumedSequenceParser.js +20 -15
- package/build/parserContext.d.ts +14 -0
- package/build/parserContext.js +56 -27
- package/build/parserContext.test.js +27 -0
- package/build/parserCreatorCompose.d.ts +1 -0
- package/build/parserCreatorCompose.js +8 -2
- package/build/parserError.d.ts +6 -0
- package/build/parserError.js +6 -6
- package/build/parserInputCompanion.d.ts +15 -0
- package/build/parserInputCompanion.js +38 -0
- package/build/promiseCompose.d.ts +1 -1
- package/build/promiseCompose.js +12 -1
- package/build/promiseSettled.d.ts +1 -0
- package/build/promiseSettled.js +4 -0
- package/build/separatedArrayParser.d.ts +2 -0
- package/build/separatedArrayParser.js +39 -0
- package/build/separatedArrayParser.test.d.ts +1 -0
- package/build/separatedArrayParser.test.js +21 -0
- package/build/sequenceBuffer.d.ts +10 -0
- package/build/sequenceBuffer.js +54 -2
- package/build/sequenceBuffer.test.js +57 -0
- package/build/sequenceTerminatedSequenceParser.d.ts +5 -0
- package/build/sequenceTerminatedSequenceParser.js +32 -0
- package/build/sequenceTerminatedSequenceParser.test.d.ts +1 -0
- package/build/sequenceTerminatedSequenceParser.test.js +37 -0
- package/build/skipParser.d.ts +1 -1
- package/build/skipParser.js +4 -2
- package/build/skipToParser.d.ts +2 -0
- package/build/skipToParser.js +11 -0
- package/build/sliceBoundedParser.d.ts +1 -1
- package/build/sliceBoundedParser.js +7 -2
- package/build/sliceBoundedParser.test.js +35 -1
- package/build/smali.d.ts +1 -0
- package/build/smali.js +17 -0
- package/build/smaliParser.d.ts +12 -0
- package/build/smaliParser.js +656 -0
- package/build/smaliParser.test.d.ts +1 -0
- package/build/smaliParser.test.js +115 -0
- package/build/terminatedArrayParser.d.ts +3 -1
- package/build/terminatedArrayParser.js +79 -2
- package/build/terminatedArrayParser.test.d.ts +1 -0
- package/build/terminatedArrayParser.test.js +131 -0
- package/build/toAsyncIterable.d.ts +1 -0
- package/build/toAsyncIterable.js +7 -0
- package/build/toAsyncIterator.d.ts +1 -0
- package/build/toAsyncIterator.js +33 -0
- package/build/tupleParser.d.ts +4 -0
- package/build/tupleParser.js +1 -5
- package/build/unionParser.d.ts +2 -1
- package/build/unionParser.js +27 -12
- package/build/unionParser.test.d.ts +1 -0
- package/build/unionParser.test.js +60 -0
- package/build/zipParser.d.ts +7 -2
- package/build/zipParser.js +36 -12
- package/build/zipUnparser.d.ts +4 -1
- package/build/zipUnparser.js +55 -26
- package/build/zipUnparser.test.js +14 -14
- package/package.json +23 -7
- package/src/allSettledStream.test.ts +40 -0
- package/src/allSettledStream.ts +47 -15
- package/src/androidPackage.ts +48 -0
- package/src/{apkParser.test.ts → androidPackageParser.test.ts} +6 -7
- package/src/{apkParser.test.ts.md → androidPackageParser.test.ts.md} +4 -4
- package/src/androidPackageParser.test.ts.snap +0 -0
- package/src/androidPackageParser.ts +440 -0
- package/src/androidPackageUnparser.test.ts +36 -0
- package/src/androidPackageUnparser.ts +120 -0
- package/src/arbitrarilySlicedAsyncInterable.ts +7 -2
- package/src/arrayParser.test.ts +3 -3
- package/src/backsmali.ts +30 -0
- package/src/bsonParser.ts +13 -2
- package/src/customInvariant.ts +1 -1
- package/src/dalvikBytecodeParser/formatParsers.ts +421 -0
- package/src/dalvikBytecodeParser.ts +2074 -0
- package/src/dalvikExecutable.ts +220 -0
- package/src/dalvikExecutableParser/stringSyntaxParser.ts +145 -0
- package/src/dalvikExecutableParser/typeParsers.ts +65 -0
- package/src/dalvikExecutableParser/typedNumbers.ts +57 -0
- package/src/dalvikExecutableParser.test.ts +89 -0
- package/src/dalvikExecutableParser.test.ts.md +634 -0
- package/src/dalvikExecutableParser.test.ts.snap +0 -0
- package/src/dalvikExecutableParser.ts +2768 -0
- package/src/dalvikExecutableParserAgainstSmaliParser.test.ts +346 -0
- package/src/debugLogInputParser.ts +28 -0
- package/src/debugLogParser.ts +19 -3
- package/src/disjunctionParser.ts +10 -5
- package/src/elementTerminatedArrayParser.test.ts +99 -0
- package/src/elementTerminatedArrayParser.ts +31 -0
- package/src/elementTerminatedSequenceArrayParser.test.ts +54 -0
- package/src/elementTerminatedSequenceArrayParser.ts +52 -0
- package/src/elementTerminatedSequenceParser.test.ts +54 -0
- package/src/elementTerminatedSequenceParser.ts +43 -0
- package/src/exactElementParser.ts +17 -11
- package/src/exactSequenceParser.ts +23 -2
- package/src/fetchCid.ts +125 -0
- package/src/fixedLengthSequenceParser.test.ts +77 -0
- package/src/fixedLengthSequenceParser.ts +28 -1
- package/src/hasExecutable.ts +11 -0
- package/src/highResolutionTimer.ts +49 -0
- package/src/inputReader.test.ts +209 -0
- package/src/inputReader.ts +75 -0
- package/src/inputReaderState.ts +33 -0
- package/src/inspect.ts +9 -0
- package/src/javaKeyStoreParser.test.ts +2 -3
- package/src/jsonParser.ts +13 -25
- package/src/leb128Parser.test.ts +171 -0
- package/src/leb128Parser.ts +125 -0
- package/src/lookaheadParser.ts +19 -0
- package/src/negativeLookaheadParser.test.ts +53 -0
- package/src/negativeLookaheadParser.ts +26 -14
- package/src/nonEmptyArrayParser.test.ts +20 -0
- package/src/nonEmptyArrayParser.ts +44 -0
- package/src/optionalParser.ts +1 -0
- package/src/parser.test.ts +131 -12
- package/src/parser.test.ts.md +21 -21
- package/src/parser.test.ts.snap +0 -0
- package/src/parser.ts +149 -45
- package/src/parserAccessorParser.ts +12 -2
- package/src/parserConsumedSequenceParser.ts +25 -16
- package/src/parserContext.test.ts +31 -0
- package/src/parserContext.ts +109 -37
- package/src/parserCreatorCompose.ts +20 -2
- package/src/parserError.ts +9 -6
- package/src/parserInputCompanion.ts +55 -0
- package/src/promiseCompose.ts +17 -3
- package/src/promiseSettled.ts +6 -0
- package/src/separatedArrayParser.test.ts +34 -0
- package/src/separatedArrayParser.ts +55 -0
- package/src/sequenceBuffer.test.ts +70 -0
- package/src/sequenceBuffer.ts +88 -2
- package/src/sequenceTerminatedSequenceParser.test.ts +60 -0
- package/src/sequenceTerminatedSequenceParser.ts +62 -0
- package/src/skipParser.ts +7 -5
- package/src/skipToParser.ts +16 -0
- package/src/sliceBoundedParser.test.ts +43 -1
- package/src/sliceBoundedParser.ts +19 -1
- package/src/smali.ts +24 -0
- package/src/smaliParser.test.ts +132 -0
- package/src/smaliParser.test.ts.md +2320 -0
- package/src/smaliParser.test.ts.snap +0 -0
- package/src/smaliParser.ts +1166 -0
- package/src/terminatedArrayParser.test.ts +258 -0
- package/src/terminatedArrayParser.ts +108 -3
- package/src/toAsyncIterable.ts +7 -0
- package/src/toAsyncIterator.ts +48 -0
- package/src/tupleParser.ts +8 -5
- package/src/unionParser.test.ts +79 -0
- package/src/unionParser.ts +44 -16
- package/src/zipParser.ts +77 -18
- package/src/zipUnparser.test.ts +18 -18
- package/src/zipUnparser.ts +88 -27
- package/build/apk.d.ts +0 -39
- package/build/apkParser.d.ts +0 -16
- package/build/apkParser.js +0 -164
- package/build/apkUnparser.d.ts +0 -4
- package/build/apkUnparser.test.js +0 -26
- package/build/arbitraryDosDate.d.ts +0 -2
- package/build/arbitraryDosDate.js +0 -8
- package/build/arbitraryZipEntry.d.ts +0 -3
- package/build/arbitraryZipEntry.js +0 -26
- package/build/createDisjunctionParser.d.ts +0 -2
- package/build/createDisjunctionParser.js +0 -47
- package/build/createExactParser.d.ts +0 -2
- package/build/createExactParser.js +0 -12
- package/build/createSequentialUnionParser.d.ts +0 -2
- package/build/createSequentialUnionParser.js +0 -69
- package/build/fixedLengthChunkParser.d.ts +0 -2
- package/build/fixedLengthChunkParser.js +0 -12
- package/build/fixedLengthParser.d.ts +0 -2
- package/build/fixedLengthParser.js +0 -12
- package/build/inputChunkBuffer.d.ts +0 -15
- package/build/inputChunkBuffer.js +0 -40
- package/build/inputChunkBuffer.test.js +0 -34
- package/build/inputCompanion.d.ts +0 -18
- package/build/inputCompanion.js +0 -28
- package/build/invariantDefined.d.ts +0 -1
- package/build/invariantDefined.js +0 -5
- package/build/invariantIdentity.d.ts +0 -3
- package/build/invariantIdentity.js +0 -5
- package/build/javaKeystoreParser.d.ts +0 -2
- package/build/javaKeystoreParser.js +0 -7
- package/build/jsonParser2.d.ts +0 -3
- package/build/jsonParser2.js +0 -52
- package/build/jsonParser2.test.js +0 -22
- package/build/negativeLookahead.d.ts +0 -2
- package/build/negativeLookahead.js +0 -18
- package/build/parserCompose.d.ts +0 -3
- package/build/parserCompose.js +0 -7
- package/build/parserImplementationInvariantInvariant.d.ts +0 -3
- package/build/parserImplementationInvariantInvariant.js +0 -15
- package/build/parserInvariant.d.ts +0 -4
- package/build/parserInvariant.js +0 -11
- package/build/promiseFish.d.ts +0 -1
- package/build/promiseFish.js +0 -3
- package/build/sequenceParser.d.ts +0 -3
- package/build/sequenceParser.js +0 -10
- package/build/terminatedSequenceParser.d.ts +0 -2
- package/build/terminatedSequenceParser.js +0 -24
- package/build/unparserInputCompanion.d.ts +0 -15
- package/build/unparserInputCompanion.js +0 -13
- package/build/zipEntry.d.ts +0 -28
- package/build/zipFile.d.ts +0 -32
- package/build/zipFileEntry.d.ts +0 -6
- package/src/apk.ts +0 -48
- package/src/apkParser.test.ts.snap +0 -0
- package/src/apkParser.ts +0 -392
- package/src/apkUnparser.test.ts +0 -37
- package/src/apkUnparser.ts +0 -120
- package/src/invariantDefined.ts +0 -6
- package/src/invariantIdentity.ts +0 -8
- /package/build/{apk.js → androidPackage.js} +0 -0
- /package/build/{apkParser.test.d.ts → androidPackageParser.test.d.ts} +0 -0
- /package/build/{apkUnparser.test.d.ts → androidPackageUnparser.test.d.ts} +0 -0
- /package/build/{arbitraryDosPermissions.d.ts → dalvikExecutableParser.test.d.ts} +0 -0
- /package/build/{arbitraryDosPermissions.js → dalvikExecutableParserAgainstSmaliParser.test.d.ts} +0 -0
- /package/build/{inputChunkBuffer.test.d.ts → elementTerminatedArrayParser.test.d.ts} +0 -0
- /package/build/{jsonParser2.test.d.ts → elementTerminatedSequenceArrayParser.test.d.ts} +0 -0
- /package/build/{parserParsingInvariant.d.ts → elementTerminatedSequenceParser.test.d.ts} +0 -0
- /package/build/{parserParsingInvariant.js → fixedLengthSequenceParser.test.d.ts} +0 -0
- /package/build/{zipEntry.js → leb128Parser.test.d.ts} +0 -0
- /package/build/{zipFile.js → negativeLookaheadParser.test.d.ts} +0 -0
- /package/build/{zipFileEntry.js → nonEmptyArrayParser.test.d.ts} +0 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
export type DalvikExecutableAccessFlags = {
|
|
2
|
+
public: boolean;
|
|
3
|
+
private: boolean;
|
|
4
|
+
protected: boolean;
|
|
5
|
+
static: boolean;
|
|
6
|
+
final: boolean;
|
|
7
|
+
synchronized: boolean;
|
|
8
|
+
volatile: boolean;
|
|
9
|
+
bridge: boolean;
|
|
10
|
+
transient: boolean;
|
|
11
|
+
varargs: boolean;
|
|
12
|
+
native: boolean;
|
|
13
|
+
interface: boolean;
|
|
14
|
+
abstract: boolean;
|
|
15
|
+
strict: boolean;
|
|
16
|
+
synthetic: boolean;
|
|
17
|
+
annotation: boolean;
|
|
18
|
+
enum: boolean;
|
|
19
|
+
constructor: boolean;
|
|
20
|
+
declaredSynchronized: boolean;
|
|
21
|
+
};
|
|
22
|
+
export type DalvikExecutableEncodedValue = number | DalvikExecutableEncodedValue[] | undefined;
|
|
23
|
+
type DalvikExecutableTry = {
|
|
24
|
+
startAddress: number;
|
|
25
|
+
instructionCount: number;
|
|
26
|
+
handler: DalvikExecutableEncodedCatchHandler;
|
|
27
|
+
};
|
|
28
|
+
type DalvikExecutableEncodedTypeAddressPair = {
|
|
29
|
+
type: string;
|
|
30
|
+
address: number;
|
|
31
|
+
};
|
|
32
|
+
type DalvikExecutableEncodedCatchHandler = {
|
|
33
|
+
handlers: DalvikExecutableEncodedTypeAddressPair[];
|
|
34
|
+
catchAllAddress: undefined | number;
|
|
35
|
+
};
|
|
36
|
+
export type DalvikExecutableCode<Instructions> = {
|
|
37
|
+
registersSize: number;
|
|
38
|
+
insSize: number;
|
|
39
|
+
outsSize: number;
|
|
40
|
+
debugInfo: undefined | DalvikExecutableDebugInfo;
|
|
41
|
+
instructions: Instructions;
|
|
42
|
+
tries: DalvikExecutableTry[];
|
|
43
|
+
};
|
|
44
|
+
type DalvikExecutableDebugByteCodeValue = {
|
|
45
|
+
type: 'advancePc';
|
|
46
|
+
addressDiff: number;
|
|
47
|
+
} | {
|
|
48
|
+
type: 'advanceLine';
|
|
49
|
+
lineDiff: number;
|
|
50
|
+
} | {
|
|
51
|
+
type: 'startLocal';
|
|
52
|
+
registerNum: number;
|
|
53
|
+
name: undefined | string;
|
|
54
|
+
type_: undefined | string;
|
|
55
|
+
} | {
|
|
56
|
+
type: 'startLocalExtended';
|
|
57
|
+
registerNum: number;
|
|
58
|
+
name: undefined | string;
|
|
59
|
+
type_: undefined | string;
|
|
60
|
+
signature: undefined | string;
|
|
61
|
+
} | {
|
|
62
|
+
type: 'endLocal';
|
|
63
|
+
registerNum: number;
|
|
64
|
+
} | {
|
|
65
|
+
type: 'restartLocal';
|
|
66
|
+
registerNum: number;
|
|
67
|
+
} | {
|
|
68
|
+
type: 'setPrologueEnd';
|
|
69
|
+
} | {
|
|
70
|
+
type: 'setEpilogueBegin';
|
|
71
|
+
} | {
|
|
72
|
+
type: 'setFile';
|
|
73
|
+
name: undefined | string;
|
|
74
|
+
} | {
|
|
75
|
+
type: 'special';
|
|
76
|
+
value: number;
|
|
77
|
+
};
|
|
78
|
+
type DalvikExecutableDebugByteCode = DalvikExecutableDebugByteCodeValue[];
|
|
79
|
+
export type DalvikExecutableDebugInfo = {
|
|
80
|
+
lineStart: number;
|
|
81
|
+
parameterNames: (undefined | string)[];
|
|
82
|
+
bytecode: DalvikExecutableDebugByteCode;
|
|
83
|
+
};
|
|
84
|
+
type DalvikExecutableAnnotationItemVisibility = 'build' | 'runtime' | 'system';
|
|
85
|
+
type DalvikExecutableAnnotationElement = {
|
|
86
|
+
name: string;
|
|
87
|
+
value: DalvikExecutableEncodedValue;
|
|
88
|
+
};
|
|
89
|
+
export type DalvikExecutableAnnotation = {
|
|
90
|
+
visibility: DalvikExecutableAnnotationItemVisibility;
|
|
91
|
+
type: string;
|
|
92
|
+
elements: DalvikExecutableAnnotationElement[];
|
|
93
|
+
};
|
|
94
|
+
export type DalvikExecutablePrototype = {
|
|
95
|
+
shorty: string;
|
|
96
|
+
returnType: string;
|
|
97
|
+
parameters: string[];
|
|
98
|
+
};
|
|
99
|
+
export type DalvikExecutableField = {
|
|
100
|
+
class: string;
|
|
101
|
+
type: string;
|
|
102
|
+
name: string;
|
|
103
|
+
};
|
|
104
|
+
export declare function isDalvikExecutableField(x: unknown): x is DalvikExecutableField;
|
|
105
|
+
export type DalvikExecutableFieldWithAccess = {
|
|
106
|
+
field: DalvikExecutableField;
|
|
107
|
+
accessFlags: DalvikExecutableAccessFlags;
|
|
108
|
+
};
|
|
109
|
+
export type DalvikExecutableMethod = {
|
|
110
|
+
class: string;
|
|
111
|
+
prototype: DalvikExecutablePrototype;
|
|
112
|
+
name: string;
|
|
113
|
+
};
|
|
114
|
+
export declare function isDalvikExecutableMethod(x: unknown): x is DalvikExecutableMethod;
|
|
115
|
+
export type DalvikExecutableMethodWithAccess<Instructions> = {
|
|
116
|
+
method: DalvikExecutableMethod;
|
|
117
|
+
accessFlags: DalvikExecutableAccessFlags;
|
|
118
|
+
code: undefined | DalvikExecutableCode<Instructions>;
|
|
119
|
+
};
|
|
120
|
+
export type DalvikExecutableClassFieldAnnotation = {
|
|
121
|
+
field: DalvikExecutableField;
|
|
122
|
+
annotations: undefined | DalvikExecutableAnnotation[];
|
|
123
|
+
};
|
|
124
|
+
export type DalvikExecutableClassMethodAnnotation = {
|
|
125
|
+
method: DalvikExecutableMethod;
|
|
126
|
+
annotations: undefined | DalvikExecutableAnnotation[];
|
|
127
|
+
};
|
|
128
|
+
export type DalvikExecutableClassParameterAnnotation = {
|
|
129
|
+
method: DalvikExecutableMethod;
|
|
130
|
+
annotations: undefined | (undefined | DalvikExecutableAnnotation[])[];
|
|
131
|
+
};
|
|
132
|
+
export type DalvikExecutableClassAnnotations = {
|
|
133
|
+
classAnnotations: undefined | DalvikExecutableAnnotation[];
|
|
134
|
+
fieldAnnotations: DalvikExecutableClassFieldAnnotation[];
|
|
135
|
+
methodAnnotations: DalvikExecutableClassMethodAnnotation[];
|
|
136
|
+
parameterAnnotations: DalvikExecutableClassParameterAnnotation[];
|
|
137
|
+
};
|
|
138
|
+
export type DalvikExecutableClassData<Instructions> = {
|
|
139
|
+
staticFields: DalvikExecutableFieldWithAccess[];
|
|
140
|
+
instanceFields: DalvikExecutableFieldWithAccess[];
|
|
141
|
+
directMethods: DalvikExecutableMethodWithAccess<Instructions>[];
|
|
142
|
+
virtualMethods: DalvikExecutableMethodWithAccess<Instructions>[];
|
|
143
|
+
};
|
|
144
|
+
export type DalvikExecutableClassDefinition<Instructions> = {
|
|
145
|
+
class: string;
|
|
146
|
+
accessFlags: DalvikExecutableAccessFlags;
|
|
147
|
+
superclass: string;
|
|
148
|
+
interfaces: string[];
|
|
149
|
+
sourceFile: undefined | string;
|
|
150
|
+
annotations: undefined | DalvikExecutableClassAnnotations;
|
|
151
|
+
staticValues: DalvikExecutableEncodedValue[];
|
|
152
|
+
classData: undefined | DalvikExecutableClassData<Instructions>;
|
|
153
|
+
};
|
|
154
|
+
export type DalvikExecutable<Instructions> = {
|
|
155
|
+
classDefinitions: DalvikExecutableClassDefinition<Instructions>[];
|
|
156
|
+
link: undefined | Uint8Array;
|
|
157
|
+
};
|
|
158
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export function isDalvikExecutableField(x) {
|
|
2
|
+
return (x !== null
|
|
3
|
+
&& typeof x === 'object'
|
|
4
|
+
&& 'class' in x
|
|
5
|
+
&& 'type' in x
|
|
6
|
+
&& 'name' in x
|
|
7
|
+
&& typeof x.class === 'string'
|
|
8
|
+
&& typeof x.type === 'string'
|
|
9
|
+
&& typeof x.name === 'string');
|
|
10
|
+
}
|
|
11
|
+
export function isDalvikExecutableMethod(x) {
|
|
12
|
+
return (x !== null
|
|
13
|
+
&& typeof x === 'object'
|
|
14
|
+
&& 'class' in x
|
|
15
|
+
&& 'prototype' in x
|
|
16
|
+
&& 'name' in x
|
|
17
|
+
&& typeof x.class === 'string'
|
|
18
|
+
&& typeof x.prototype === 'object'
|
|
19
|
+
&& typeof x.name === 'string');
|
|
20
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import invariant from "invariant";
|
|
2
|
+
import { setParserName } from "../parser.js";
|
|
3
|
+
import { promiseCompose } from "../promiseCompose.js";
|
|
4
|
+
import { createSeparatedArrayParser } from "../separatedArrayParser.js";
|
|
5
|
+
import { createExactSequenceParser } from "../exactSequenceParser.js";
|
|
6
|
+
import { createUnionParser } from "../unionParser.js";
|
|
7
|
+
import { createTupleParser } from "../tupleParser.js";
|
|
8
|
+
import { createArrayParser } from "../arrayParser.js";
|
|
9
|
+
export const smaliSimpleNameParser = async (parserContext) => {
|
|
10
|
+
const characters = [];
|
|
11
|
+
while (true) {
|
|
12
|
+
const character = await parserContext.peek(0);
|
|
13
|
+
parserContext.invariant(character !== undefined, 'Unexpected end of input');
|
|
14
|
+
invariant(character !== undefined, 'Unexpected end of input');
|
|
15
|
+
if ((character >= 'a' && character <= 'z')
|
|
16
|
+
|| (character >= 'A' && character <= 'Z')
|
|
17
|
+
|| (character >= '0' && character <= '9')
|
|
18
|
+
|| (character === ' ')
|
|
19
|
+
|| (character === '$')
|
|
20
|
+
|| (character === '-')
|
|
21
|
+
|| (character === '_')
|
|
22
|
+
|| (character === '\u00a0')
|
|
23
|
+
|| (character >= '\u00a1' && character <= '\u1fff')
|
|
24
|
+
|| (character >= '\u2000' && character <= '\u200a')
|
|
25
|
+
|| (character >= '\u2010' && character <= '\u2027')
|
|
26
|
+
|| (character === '\u202f')
|
|
27
|
+
|| (character >= '\u2030' && character <= '\ud7ff')
|
|
28
|
+
|| (character >= '\ue000' && character <= '\uffef')
|
|
29
|
+
|| (character >= '\ud800' && character <= '\udbff')) {
|
|
30
|
+
parserContext.skip(1);
|
|
31
|
+
characters.push(character);
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
parserContext.invariant(characters.length > 0, 'Expected at least one character');
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
return characters.join('');
|
|
38
|
+
};
|
|
39
|
+
setParserName(smaliSimpleNameParser, 'smaliSimpleNameParser');
|
|
40
|
+
export const smaliMemberNameParser = createUnionParser([
|
|
41
|
+
smaliSimpleNameParser,
|
|
42
|
+
promiseCompose(createTupleParser([
|
|
43
|
+
createExactSequenceParser('<'),
|
|
44
|
+
smaliSimpleNameParser,
|
|
45
|
+
createExactSequenceParser('>'),
|
|
46
|
+
]), (strings) => strings.join('')),
|
|
47
|
+
]);
|
|
48
|
+
setParserName(smaliMemberNameParser, 'smaliMemberNameParser');
|
|
49
|
+
const smaliFullClassNameParser = promiseCompose(createSeparatedArrayParser(smaliMemberNameParser, createExactSequenceParser('/')), (pathSegments) => pathSegments.join('/'));
|
|
50
|
+
setParserName(smaliFullClassNameParser, 'smaliFullClassNameParser');
|
|
51
|
+
const smaliNonArrayFieldTypeDescriptorParser = createUnionParser([
|
|
52
|
+
createExactSequenceParser('Z'),
|
|
53
|
+
createExactSequenceParser('B'),
|
|
54
|
+
createExactSequenceParser('S'),
|
|
55
|
+
createExactSequenceParser('C'),
|
|
56
|
+
createExactSequenceParser('I'),
|
|
57
|
+
createExactSequenceParser('J'),
|
|
58
|
+
createExactSequenceParser('F'),
|
|
59
|
+
createExactSequenceParser('D'),
|
|
60
|
+
promiseCompose(createTupleParser([
|
|
61
|
+
createExactSequenceParser('L'),
|
|
62
|
+
smaliFullClassNameParser,
|
|
63
|
+
createExactSequenceParser(';'),
|
|
64
|
+
]), strings => strings.join('')),
|
|
65
|
+
]);
|
|
66
|
+
setParserName(smaliNonArrayFieldTypeDescriptorParser, 'smaliNonArrayFieldTypeDescriptorParser');
|
|
67
|
+
const smaliFieldTypeDescriptorParser = promiseCompose(createTupleParser([
|
|
68
|
+
createArrayParser(createExactSequenceParser('[')),
|
|
69
|
+
smaliNonArrayFieldTypeDescriptorParser,
|
|
70
|
+
]), ([strings, string]) => strings.join('') + string);
|
|
71
|
+
setParserName(smaliFieldTypeDescriptorParser, 'smaliFieldTypeDescriptorParser');
|
|
72
|
+
export const smaliTypeDescriptorParser = createUnionParser([
|
|
73
|
+
createExactSequenceParser('V'),
|
|
74
|
+
smaliFieldTypeDescriptorParser,
|
|
75
|
+
]);
|
|
76
|
+
setParserName(smaliTypeDescriptorParser, 'smaliTypeDescriptorParser');
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Parser } from "../parser.js";
|
|
2
|
+
export declare const uleb128p1NumberParser: Parser<number, Uint8Array>;
|
|
3
|
+
export declare const ubyteParser: Parser<number, Uint8Array>;
|
|
4
|
+
export declare const byteParser: Parser<number, Uint8Array>;
|
|
5
|
+
export declare const shortParser: Parser<number, Uint8Array>;
|
|
6
|
+
export declare const ushortParser: Parser<number, Uint8Array>;
|
|
7
|
+
export declare const intParser: Parser<number, Uint8Array>;
|
|
8
|
+
export declare const uintParser: Parser<number, Uint8Array>;
|
|
9
|
+
export declare const longParser: Parser<bigint, Uint8Array>;
|
|
10
|
+
export declare const ulongParser: Parser<bigint, Uint8Array>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createElementParser } from "../elementParser.js";
|
|
2
|
+
import { createFixedLengthSequenceParser } from "../fixedLengthSequenceParser.js";
|
|
3
|
+
import { uleb128NumberParser } from "../leb128Parser.js";
|
|
4
|
+
import { promiseCompose } from "../promiseCompose.js";
|
|
5
|
+
export const uleb128p1NumberParser = async (parserContext) => {
|
|
6
|
+
const value = await uleb128NumberParser(parserContext);
|
|
7
|
+
return value - 1;
|
|
8
|
+
};
|
|
9
|
+
export const ubyteParser = createElementParser();
|
|
10
|
+
export const byteParser = promiseCompose(ubyteParser, (ubyte) => ubyte > 127 ? ubyte - 256 : ubyte);
|
|
11
|
+
export const shortParser = promiseCompose(createFixedLengthSequenceParser(2), (uint8Array) => {
|
|
12
|
+
const buffer = Buffer.from(uint8Array);
|
|
13
|
+
return buffer.readInt16LE(0);
|
|
14
|
+
});
|
|
15
|
+
export const ushortParser = promiseCompose(createFixedLengthSequenceParser(2), (uint8Array) => {
|
|
16
|
+
const buffer = Buffer.from(uint8Array);
|
|
17
|
+
return buffer.readUInt16LE(0);
|
|
18
|
+
});
|
|
19
|
+
export const intParser = promiseCompose(createFixedLengthSequenceParser(4), (uint8Array) => {
|
|
20
|
+
const buffer = Buffer.from(uint8Array);
|
|
21
|
+
return buffer.readInt32LE(0);
|
|
22
|
+
});
|
|
23
|
+
export const uintParser = promiseCompose(createFixedLengthSequenceParser(4), (uint8Array) => {
|
|
24
|
+
const buffer = Buffer.from(uint8Array);
|
|
25
|
+
return buffer.readUInt32LE(0);
|
|
26
|
+
});
|
|
27
|
+
export const longParser = promiseCompose(createFixedLengthSequenceParser(8), (uint8Array) => {
|
|
28
|
+
const buffer = Buffer.from(uint8Array);
|
|
29
|
+
return buffer.readBigInt64LE(0);
|
|
30
|
+
});
|
|
31
|
+
export const ulongParser = promiseCompose(createFixedLengthSequenceParser(8), (uint8Array) => {
|
|
32
|
+
const buffer = Buffer.from(uint8Array);
|
|
33
|
+
return buffer.readBigUInt64LE(0);
|
|
34
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Newtype } from 'newtype-ts';
|
|
2
|
+
export interface IndexIntoStringIds extends Newtype<{
|
|
3
|
+
readonly IndexIntoStringIds: unique symbol;
|
|
4
|
+
}, number> {
|
|
5
|
+
}
|
|
6
|
+
export declare const isoIndexIntoStringIds: import("monocle-ts").Iso<IndexIntoStringIds, number>;
|
|
7
|
+
export interface IndexIntoTypeIds extends Newtype<{
|
|
8
|
+
readonly IndexIntoTypeIds: unique symbol;
|
|
9
|
+
}, number> {
|
|
10
|
+
}
|
|
11
|
+
export declare const isoIndexIntoTypeIds: import("monocle-ts").Iso<IndexIntoTypeIds, number>;
|
|
12
|
+
export interface IndexIntoPrototypeIds extends Newtype<{
|
|
13
|
+
readonly IndexIntoPrototypeIds: unique symbol;
|
|
14
|
+
}, number> {
|
|
15
|
+
}
|
|
16
|
+
export declare const isoIndexIntoPrototypeIds: import("monocle-ts").Iso<IndexIntoPrototypeIds, number>;
|
|
17
|
+
export interface IndexIntoFieldIds extends Newtype<{
|
|
18
|
+
readonly IndexIntoFieldIds: unique symbol;
|
|
19
|
+
}, number> {
|
|
20
|
+
}
|
|
21
|
+
export declare const isoIndexIntoFieldIds: import("monocle-ts").Iso<IndexIntoFieldIds, number>;
|
|
22
|
+
export interface IndexIntoMethodIds extends Newtype<{
|
|
23
|
+
readonly IndexIntoMethodIds: unique symbol;
|
|
24
|
+
}, number> {
|
|
25
|
+
}
|
|
26
|
+
export declare const isoIndexIntoMethodIds: import("monocle-ts").Iso<IndexIntoMethodIds, number>;
|
|
27
|
+
export interface OffsetToStringDataItem extends Newtype<{
|
|
28
|
+
readonly OffsetToStringDataItem: unique symbol;
|
|
29
|
+
}, number> {
|
|
30
|
+
}
|
|
31
|
+
export declare const isoOffsetToStringDataItem: import("monocle-ts").Iso<OffsetToStringDataItem, number>;
|
|
32
|
+
export interface OffsetToTypeList extends Newtype<{
|
|
33
|
+
readonly OffsetToTypeList: unique symbol;
|
|
34
|
+
}, number> {
|
|
35
|
+
}
|
|
36
|
+
export declare const isoOffsetToTypeList: import("monocle-ts").Iso<OffsetToTypeList, number>;
|
|
37
|
+
export interface OffsetToAnnotationsDirectoryItem extends Newtype<{
|
|
38
|
+
readonly OffsetToAnnotationsDirectoryItem: unique symbol;
|
|
39
|
+
}, number> {
|
|
40
|
+
}
|
|
41
|
+
export declare const isoOffsetToAnnotationsDirectoryItem: import("monocle-ts").Iso<OffsetToAnnotationsDirectoryItem, number>;
|
|
42
|
+
export interface OffsetToAnnotationSetItem extends Newtype<{
|
|
43
|
+
readonly OffsetToAnnotationSetItem: unique symbol;
|
|
44
|
+
}, number> {
|
|
45
|
+
}
|
|
46
|
+
export declare const isoOffsetToAnnotationSetItem: import("monocle-ts").Iso<OffsetToAnnotationSetItem, number>;
|
|
47
|
+
export interface OffsetToAnnotationSetRefListItem extends Newtype<{
|
|
48
|
+
readonly OffsetToAnnotationSetRefListItem: unique symbol;
|
|
49
|
+
}, number> {
|
|
50
|
+
}
|
|
51
|
+
export declare const isoOffsetToAnnotationSetRefListItem: import("monocle-ts").Iso<OffsetToAnnotationSetRefListItem, number>;
|
|
52
|
+
export interface OffsetToClassDataItem extends Newtype<{
|
|
53
|
+
readonly OffsetToClassDataItem: unique symbol;
|
|
54
|
+
}, number> {
|
|
55
|
+
}
|
|
56
|
+
export declare const isoOffsetToClassDataItem: import("monocle-ts").Iso<OffsetToClassDataItem, number>;
|
|
57
|
+
export interface OffsetToEncodedArrayItem extends Newtype<{
|
|
58
|
+
readonly OffsetToEncodedArrayItem: unique symbol;
|
|
59
|
+
}, number> {
|
|
60
|
+
}
|
|
61
|
+
export declare const isoOffsetToEncodedArrayItem: import("monocle-ts").Iso<OffsetToEncodedArrayItem, number>;
|
|
62
|
+
export interface OffsetToCodeItem extends Newtype<{
|
|
63
|
+
readonly OffsetToCodeItem: unique symbol;
|
|
64
|
+
}, number> {
|
|
65
|
+
}
|
|
66
|
+
export declare const isoOffsetToCodeItem: import("monocle-ts").Iso<OffsetToCodeItem, number>;
|
|
67
|
+
export interface OffsetToDebugInfoItem extends Newtype<{
|
|
68
|
+
readonly OffsetToDebugInfoItem: unique symbol;
|
|
69
|
+
}, number> {
|
|
70
|
+
}
|
|
71
|
+
export declare const isoOffsetToDebugInfoItem: import("monocle-ts").Iso<OffsetToDebugInfoItem, number>;
|
|
72
|
+
export interface OffsetToAnnotationItem extends Newtype<{
|
|
73
|
+
readonly OffsetToAnnotationItem: unique symbol;
|
|
74
|
+
}, number> {
|
|
75
|
+
}
|
|
76
|
+
export declare const isoOffsetToAnnotationItem: import("monocle-ts").Iso<OffsetToAnnotationItem, number>;
|
|
77
|
+
export interface OffsetFromEncodedCatchHandlerListToEncodedCatchHandler extends Newtype<{
|
|
78
|
+
readonly OffsetFromEncodedCatchHandlerListToEncodedCatchHandler: unique symbol;
|
|
79
|
+
}, number> {
|
|
80
|
+
}
|
|
81
|
+
export declare const isoOffsetFromEncodedCatchHandlerListToEncodedCatchHandler: import("monocle-ts").Iso<OffsetFromEncodedCatchHandlerListToEncodedCatchHandler, number>;
|
|
82
|
+
export interface TypedNumberArray<IndexType, ValueType> extends Newtype<{
|
|
83
|
+
readonly TypedNumberArray: unique symbol;
|
|
84
|
+
}, Array<ValueType>> {
|
|
85
|
+
get length(): number;
|
|
86
|
+
at(index: IndexType): undefined | ValueType;
|
|
87
|
+
map<NewValueType>(fn: (value: ValueType, index: IndexType) => NewValueType): TypedNumberArray<IndexType, NewValueType>;
|
|
88
|
+
[Symbol.iterator](): IterableIterator<ValueType>;
|
|
89
|
+
}
|
|
90
|
+
export declare const getIsoTypedNumberArray: <IndexType, ValueType>() => import("monocle-ts").Iso<TypedNumberArray<IndexType, ValueType>, ValueType[]>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { iso } from 'newtype-ts';
|
|
2
|
+
export const isoIndexIntoStringIds = iso();
|
|
3
|
+
export const isoIndexIntoTypeIds = iso();
|
|
4
|
+
export const isoIndexIntoPrototypeIds = iso();
|
|
5
|
+
export const isoIndexIntoFieldIds = iso();
|
|
6
|
+
export const isoIndexIntoMethodIds = iso();
|
|
7
|
+
export const isoOffsetToStringDataItem = iso();
|
|
8
|
+
export const isoOffsetToTypeList = iso();
|
|
9
|
+
export const isoOffsetToAnnotationsDirectoryItem = iso();
|
|
10
|
+
export const isoOffsetToAnnotationSetItem = iso();
|
|
11
|
+
export const isoOffsetToAnnotationSetRefListItem = iso();
|
|
12
|
+
export const isoOffsetToClassDataItem = iso();
|
|
13
|
+
export const isoOffsetToEncodedArrayItem = iso();
|
|
14
|
+
export const isoOffsetToCodeItem = iso();
|
|
15
|
+
export const isoOffsetToDebugInfoItem = iso();
|
|
16
|
+
export const isoOffsetToAnnotationItem = iso();
|
|
17
|
+
export const isoOffsetFromEncodedCatchHandlerListToEncodedCatchHandler = iso();
|
|
18
|
+
;
|
|
19
|
+
export const getIsoTypedNumberArray = () => iso();
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type Parser } from './parser.js';
|
|
2
|
+
import { DalvikBytecode } from './dalvikBytecodeParser.js';
|
|
3
|
+
import { DalvikExecutable } from './dalvikExecutable.js';
|
|
4
|
+
export declare const dalvikExecutableParser: Parser<DalvikExecutable<DalvikBytecode>, Uint8Array>;
|
|
5
|
+
export declare const dalvikExecutableWithRawInstructionsParser: Parser<DalvikExecutable<Uint8Array>, Uint8Array>;
|