diff --git a/androscalpel/src/annotation.rs b/androscalpel/src/annotation.rs index e48419f..fb5afea 100644 --- a/androscalpel/src/annotation.rs +++ b/androscalpel/src/annotation.rs @@ -32,6 +32,10 @@ pub struct DexAnnotationItem { #[pymethods] impl DexAnnotationItem { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + #[new] pub fn new(annotation: DexAnnotation) -> Self { Self { @@ -124,6 +128,10 @@ pub struct DexAnnotation { #[pymethods] impl DexAnnotation { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + #[new] pub fn new(type_: IdType, elements: HashMap) -> Self { Self { type_, elements } diff --git a/androscalpel/src/apk.rs b/androscalpel/src/apk.rs index 94c298e..07ef1cc 100644 --- a/androscalpel/src/apk.rs +++ b/androscalpel/src/apk.rs @@ -2364,6 +2364,10 @@ impl Apk { Ok(()) } + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + #[pyo3(name = "gen_raw_dex")] //Sad GIL noise pub fn py_gen_raw_dex(&self, py: Python<'_>) -> Result> { Ok(self diff --git a/androscalpel/src/class.rs b/androscalpel/src/class.rs index eff1df7..0b3745d 100644 --- a/androscalpel/src/class.rs +++ b/androscalpel/src/class.rs @@ -368,4 +368,8 @@ impl Class { } flags } + + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } } diff --git a/androscalpel/src/code.rs b/androscalpel/src/code.rs index be25b69..cb31ff2 100644 --- a/androscalpel/src/code.rs +++ b/androscalpel/src/code.rs @@ -38,6 +38,8 @@ pub struct Code { pub insns: Vec, } +// TODO reimplement PartialEq: label should become address independant + #[pymethods] impl Code { pub fn to_json(&self) -> Result { @@ -128,4 +130,8 @@ impl Code { } handles } + + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } } diff --git a/androscalpel/src/dex_id.rs b/androscalpel/src/dex_id.rs index 29ffdc9..c2b80ad 100644 --- a/androscalpel/src/dex_id.rs +++ b/androscalpel/src/dex_id.rs @@ -448,7 +448,6 @@ impl IdType { types.insert(self.clone()); types } - // TODO: TESTS } @@ -679,6 +678,7 @@ impl PartialOrd for IdMethod { #[pyclass] #[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)] pub struct IdEnum(pub IdField); + #[pymethods] impl IdEnum { pub fn to_json(&self) -> Result { @@ -721,4 +721,8 @@ impl IdEnum { pub fn get_all_field_ids(&self) -> HashSet { self.0.get_all_field_ids() } + + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } } diff --git a/androscalpel/src/field.rs b/androscalpel/src/field.rs index df19d3d..edc541e 100644 --- a/androscalpel/src/field.rs +++ b/androscalpel/src/field.rs @@ -248,4 +248,8 @@ impl Field { pub fn has_annotations(&self) -> bool { !self.annotations.is_empty() } + + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } } diff --git a/androscalpel/src/instructions.rs b/androscalpel/src/instructions.rs index 1addbc5..ad28a6d 100644 --- a/androscalpel/src/instructions.rs +++ b/androscalpel/src/instructions.rs @@ -3478,6 +3478,10 @@ pub struct CallSite { #[pymethods] impl CallSite { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -3613,6 +3617,10 @@ impl Default for Nop { #[pymethods] impl Nop { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -3725,6 +3733,10 @@ pub struct Move { #[pymethods] impl Move { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -3853,6 +3865,10 @@ pub struct MoveWide { #[pymethods] impl MoveWide { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -3980,6 +3996,10 @@ pub struct MoveObject { #[pymethods] impl MoveObject { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -4098,6 +4118,10 @@ pub struct MoveResult { #[pymethods] impl MoveResult { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -4203,6 +4227,10 @@ pub struct MoveResultWide { #[pymethods] impl MoveResultWide { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -4308,6 +4336,10 @@ pub struct MoveResultObject { #[pymethods] impl MoveResultObject { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -4413,6 +4445,10 @@ pub struct MoveException { #[pymethods] impl MoveException { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -4521,6 +4557,10 @@ impl Default for ReturnVoid { #[pymethods] impl ReturnVoid { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -4623,6 +4663,10 @@ pub struct Return { #[pymethods] impl Return { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -4728,6 +4772,10 @@ pub struct ReturnWide { #[pymethods] impl ReturnWide { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -4833,6 +4881,10 @@ pub struct ReturnObject { #[pymethods] impl ReturnObject { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -4948,6 +5000,10 @@ pub struct Const { #[pymethods] impl Const { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -5081,6 +5137,10 @@ pub struct ConstWide { #[pymethods] impl ConstWide { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -5212,6 +5272,10 @@ pub struct ConstString { #[pymethods] impl ConstString { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -5322,6 +5386,10 @@ pub struct ConstClass { #[pymethods] impl ConstClass { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -5434,6 +5502,10 @@ pub struct MonitorEnter { #[pymethods] impl MonitorEnter { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -5539,6 +5611,10 @@ pub struct MonitorExit { #[pymethods] impl MonitorExit { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -5647,6 +5723,10 @@ pub struct CheckCast { #[pymethods] impl CheckCast { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -5764,6 +5844,10 @@ pub struct InstanceOf { #[pymethods] impl InstanceOf { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -5904,6 +5988,10 @@ pub struct ArrayLength { #[pymethods] impl ArrayLength { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -6030,6 +6118,10 @@ pub struct NewInstance { #[pymethods] impl NewInstance { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -6146,6 +6238,10 @@ pub struct NewArray { #[pymethods] impl NewArray { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -6294,6 +6390,10 @@ pub struct FilledNewArray { #[pymethods] impl FilledNewArray { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -6517,6 +6617,10 @@ pub struct FillArrayData { #[pymethods] impl FillArrayData { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -6680,6 +6784,10 @@ pub struct Throw { #[pymethods] impl Throw { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -6785,6 +6893,10 @@ pub struct Goto { #[pymethods] impl Goto { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -6937,6 +7049,10 @@ pub struct Switch { #[pymethods] impl Switch { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -7075,6 +7191,10 @@ pub struct CmpLFloat { #[pymethods] impl CmpLFloat { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -7194,6 +7314,10 @@ pub struct CmpGFloat { #[pymethods] impl CmpGFloat { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -7313,6 +7437,10 @@ pub struct CmpLDouble { #[pymethods] impl CmpLDouble { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -7432,6 +7560,10 @@ pub struct CmpGDouble { #[pymethods] impl CmpGDouble { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -7550,6 +7682,10 @@ pub struct CmpLong { #[pymethods] impl CmpLong { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -7664,6 +7800,10 @@ pub struct IfEq { #[pymethods] impl IfEq { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -7795,6 +7935,10 @@ pub struct IfNe { #[pymethods] impl IfNe { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -7927,6 +8071,10 @@ pub struct IfLt { #[pymethods] impl IfLt { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -8059,6 +8207,10 @@ pub struct IfGe { #[pymethods] impl IfGe { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -8191,6 +8343,10 @@ pub struct IfGt { #[pymethods] impl IfGt { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -8323,6 +8479,10 @@ pub struct IfLe { #[pymethods] impl IfLe { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -8453,6 +8613,10 @@ pub struct IfEqZ { #[pymethods] impl IfEqZ { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -8565,6 +8729,10 @@ pub struct IfNeZ { #[pymethods] impl IfNeZ { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -8677,6 +8845,10 @@ pub struct IfLtZ { #[pymethods] impl IfLtZ { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -8789,6 +8961,10 @@ pub struct IfGeZ { #[pymethods] impl IfGeZ { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -8901,6 +9077,10 @@ pub struct IfGtZ { #[pymethods] impl IfGtZ { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -9013,6 +9193,10 @@ pub struct IfLeZ { #[pymethods] impl IfLeZ { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -9127,6 +9311,10 @@ pub struct AGet { #[pymethods] impl AGet { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -9241,6 +9429,10 @@ pub struct AGetWide { #[pymethods] impl AGetWide { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -9355,6 +9547,10 @@ pub struct AGetObject { #[pymethods] impl AGetObject { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -9469,6 +9665,10 @@ pub struct AGetBoolean { #[pymethods] impl AGetBoolean { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -9583,6 +9783,10 @@ pub struct AGetByte { #[pymethods] impl AGetByte { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -9697,6 +9901,10 @@ pub struct AGetChar { #[pymethods] impl AGetChar { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -9811,6 +10019,10 @@ pub struct AGetShort { #[pymethods] impl AGetShort { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -9925,6 +10137,10 @@ pub struct APut { #[pymethods] impl APut { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -10039,6 +10255,10 @@ pub struct APutWide { #[pymethods] impl APutWide { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -10153,6 +10373,10 @@ pub struct APutObject { #[pymethods] impl APutObject { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -10267,6 +10491,10 @@ pub struct APutBoolean { #[pymethods] impl APutBoolean { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -10381,6 +10609,10 @@ pub struct APutByte { #[pymethods] impl APutByte { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -10495,6 +10727,10 @@ pub struct APutChar { #[pymethods] impl APutChar { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -10609,6 +10845,10 @@ pub struct APutShort { #[pymethods] impl APutShort { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -10725,6 +10965,10 @@ pub struct IGet { #[pymethods] impl IGet { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -10866,6 +11110,10 @@ pub struct IGetWide { #[pymethods] impl IGetWide { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -11011,6 +11259,10 @@ pub struct IGetObject { #[pymethods] impl IGetObject { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -11156,6 +11408,10 @@ pub struct IGetBoolean { #[pymethods] impl IGetBoolean { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -11302,6 +11558,10 @@ pub struct IGetByte { #[pymethods] impl IGetByte { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -11447,6 +11707,10 @@ pub struct IGetChar { #[pymethods] impl IGetChar { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -11592,6 +11856,10 @@ pub struct IGetShort { #[pymethods] impl IGetShort { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -11737,6 +12005,10 @@ pub struct IPut { #[pymethods] impl IPut { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -11878,6 +12150,10 @@ pub struct IPutWide { #[pymethods] impl IPutWide { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -12023,6 +12299,10 @@ pub struct IPutObject { #[pymethods] impl IPutObject { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -12168,6 +12448,10 @@ pub struct IPutBoolean { #[pymethods] impl IPutBoolean { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -12313,6 +12597,10 @@ pub struct IPutByte { #[pymethods] impl IPutByte { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -12458,6 +12746,10 @@ pub struct IPutChar { #[pymethods] impl IPutChar { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -12603,6 +12895,10 @@ pub struct IPutShort { #[pymethods] impl IPutShort { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -12744,6 +13040,10 @@ pub struct SGet { #[pymethods] impl SGet { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -12856,6 +13156,10 @@ pub struct SGetWide { #[pymethods] impl SGetWide { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -12972,6 +13276,10 @@ pub struct SGetObject { #[pymethods] impl SGetObject { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -13088,6 +13396,10 @@ pub struct SGetBoolean { #[pymethods] impl SGetBoolean { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -13204,6 +13516,10 @@ pub struct SGetByte { #[pymethods] impl SGetByte { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -13320,6 +13636,10 @@ pub struct SGetChar { #[pymethods] impl SGetChar { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -13436,6 +13756,10 @@ pub struct SGetShort { #[pymethods] impl SGetShort { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -13552,6 +13876,10 @@ pub struct SPut { #[pymethods] impl SPut { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -13669,6 +13997,10 @@ pub struct SPutWide { #[pymethods] impl SPutWide { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -13785,6 +14117,10 @@ pub struct SPutObject { #[pymethods] impl SPutObject { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -13901,6 +14237,10 @@ pub struct SPutBoolean { #[pymethods] impl SPutBoolean { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -14017,6 +14357,10 @@ pub struct SPutByte { #[pymethods] impl SPutByte { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -14133,6 +14477,10 @@ pub struct SPutChar { #[pymethods] impl SPutChar { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -14249,6 +14597,10 @@ pub struct SPutShort { #[pymethods] impl SPutShort { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -14365,6 +14717,10 @@ pub struct InvokeVirtual { #[pymethods] impl InvokeVirtual { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -14581,6 +14937,10 @@ pub struct InvokeSuper { #[pymethods] impl InvokeSuper { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -14797,6 +15157,10 @@ pub struct InvokeDirect { #[pymethods] impl InvokeDirect { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -15013,6 +15377,10 @@ pub struct InvokeStatic { #[pymethods] impl InvokeStatic { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -15229,6 +15597,10 @@ pub struct InvokeInterface { #[pymethods] impl InvokeInterface { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -15445,6 +15817,10 @@ pub struct NegInt { #[pymethods] impl NegInt { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -15571,6 +15947,10 @@ pub struct NotInt { #[pymethods] impl NotInt { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -15697,6 +16077,10 @@ pub struct NegLong { #[pymethods] impl NegLong { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -15823,6 +16207,10 @@ pub struct NotLong { #[pymethods] impl NotLong { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -15949,6 +16337,10 @@ pub struct NegFloat { #[pymethods] impl NegFloat { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -16075,6 +16467,10 @@ pub struct NegDouble { #[pymethods] impl NegDouble { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -16203,6 +16599,10 @@ pub struct IntToLong { #[pymethods] impl IntToLong { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -16329,6 +16729,10 @@ pub struct IntToFloat { #[pymethods] impl IntToFloat { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -16457,6 +16861,10 @@ pub struct IntToDouble { #[pymethods] impl IntToDouble { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -16585,6 +16993,10 @@ pub struct LongToInt { #[pymethods] impl LongToInt { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -16713,6 +17125,10 @@ pub struct LongToFloat { #[pymethods] impl LongToFloat { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -16841,6 +17257,10 @@ pub struct LongToDouble { #[pymethods] impl LongToDouble { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -16967,6 +17387,10 @@ pub struct FloatToInt { #[pymethods] impl FloatToInt { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -17095,6 +17519,10 @@ pub struct FloatToLong { #[pymethods] impl FloatToLong { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -17223,6 +17651,10 @@ pub struct FloatToDouble { #[pymethods] impl FloatToDouble { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -17351,6 +17783,10 @@ pub struct DoubleToInt { #[pymethods] impl DoubleToInt { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -17479,6 +17915,10 @@ pub struct DoubleToLong { #[pymethods] impl DoubleToLong { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -17607,6 +18047,10 @@ pub struct DoubleToFloat { #[pymethods] impl DoubleToFloat { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -17733,6 +18177,10 @@ pub struct IntToByte { #[pymethods] impl IntToByte { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -17859,6 +18307,10 @@ pub struct IntToChar { #[pymethods] impl IntToChar { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -17985,6 +18437,10 @@ pub struct IntToShort { #[pymethods] impl IntToShort { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -18110,6 +18566,10 @@ pub struct AddInt { #[pymethods] impl AddInt { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -18218,6 +18678,10 @@ pub struct SubInt { #[pymethods] impl SubInt { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -18326,6 +18790,10 @@ pub struct MulInt { #[pymethods] impl MulInt { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -18434,6 +18902,10 @@ pub struct DivInt { #[pymethods] impl DivInt { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -18542,6 +19014,10 @@ pub struct RemInt { #[pymethods] impl RemInt { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -18650,6 +19126,10 @@ pub struct AndInt { #[pymethods] impl AndInt { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -18758,6 +19238,10 @@ pub struct OrInt { #[pymethods] impl OrInt { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -18866,6 +19350,10 @@ pub struct XorInt { #[pymethods] impl XorInt { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -18974,6 +19462,10 @@ pub struct ShlInt { #[pymethods] impl ShlInt { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -19082,6 +19574,10 @@ pub struct ShrInt { #[pymethods] impl ShrInt { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -19190,6 +19686,10 @@ pub struct UshrInt { #[pymethods] impl UshrInt { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -19303,6 +19803,10 @@ pub struct AddLong { #[pymethods] impl AddLong { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -19416,6 +19920,10 @@ pub struct SubLong { #[pymethods] impl SubLong { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -19529,6 +20037,10 @@ pub struct MulLong { #[pymethods] impl MulLong { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -19642,6 +20154,10 @@ pub struct DivLong { #[pymethods] impl DivLong { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -19755,6 +20271,10 @@ pub struct RemLong { #[pymethods] impl RemLong { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -19868,6 +20388,10 @@ pub struct AndLong { #[pymethods] impl AndLong { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -19981,6 +20505,10 @@ pub struct OrLong { #[pymethods] impl OrLong { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -20091,6 +20619,10 @@ pub struct XorLong { #[pymethods] impl XorLong { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -20204,6 +20736,10 @@ pub struct ShlLong { #[pymethods] impl ShlLong { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -20317,6 +20853,10 @@ pub struct ShrLong { #[pymethods] impl ShrLong { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -20430,6 +20970,10 @@ pub struct UshrLong { #[pymethods] impl UshrLong { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -20541,6 +21085,10 @@ pub struct AddFloat { #[pymethods] impl AddFloat { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -20652,6 +21200,10 @@ pub struct SubFloat { #[pymethods] impl SubFloat { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -20763,6 +21315,10 @@ pub struct MulFloat { #[pymethods] impl MulFloat { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -20874,6 +21430,10 @@ pub struct DivFloat { #[pymethods] impl DivFloat { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -20985,6 +21545,10 @@ pub struct RemFloat { #[pymethods] impl RemFloat { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -21098,6 +21662,10 @@ pub struct AddDouble { #[pymethods] impl AddDouble { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -21211,6 +21779,10 @@ pub struct SubDouble { #[pymethods] impl SubDouble { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -21324,6 +21896,10 @@ pub struct MulDouble { #[pymethods] impl MulDouble { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -21437,6 +22013,10 @@ pub struct DivDouble { #[pymethods] impl DivDouble { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -21550,6 +22130,10 @@ pub struct RemDouble { #[pymethods] impl RemDouble { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -21662,6 +22246,10 @@ pub struct AddInt2Addr { #[pymethods] impl AddInt2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -21788,6 +22376,10 @@ pub struct SubInt2Addr { #[pymethods] impl SubInt2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -21914,6 +22506,10 @@ pub struct MulInt2Addr { #[pymethods] impl MulInt2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -22040,6 +22636,10 @@ pub struct DivInt2Addr { #[pymethods] impl DivInt2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -22166,6 +22766,10 @@ pub struct RemInt2Addr { #[pymethods] impl RemInt2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -22292,6 +22896,10 @@ pub struct AndInt2Addr { #[pymethods] impl AndInt2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -22418,6 +23026,10 @@ pub struct OrInt2Addr { #[pymethods] impl OrInt2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -22544,6 +23156,10 @@ pub struct XorInt2Addr { #[pymethods] impl XorInt2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -22670,6 +23286,10 @@ pub struct ShlInt2Addr { #[pymethods] impl ShlInt2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -22796,6 +23416,10 @@ pub struct ShrInt2Addr { #[pymethods] impl ShrInt2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -22922,6 +23546,10 @@ pub struct UshrInt2Addr { #[pymethods] impl UshrInt2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -23050,6 +23678,10 @@ pub struct AddLong2Addr { #[pymethods] impl AddLong2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -23178,6 +23810,10 @@ pub struct SubLong2Addr { #[pymethods] impl SubLong2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -23306,6 +23942,10 @@ pub struct MulLong2Addr { #[pymethods] impl MulLong2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -23434,6 +24074,10 @@ pub struct DivLong2Addr { #[pymethods] impl DivLong2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -23562,6 +24206,10 @@ pub struct RemLong2Addr { #[pymethods] impl RemLong2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -23690,6 +24338,10 @@ pub struct AndLong2Addr { #[pymethods] impl AndLong2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -23818,6 +24470,10 @@ pub struct OrLong2Addr { #[pymethods] impl OrLong2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -23946,6 +24602,10 @@ pub struct XorLong2Addr { #[pymethods] impl XorLong2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -24074,6 +24734,10 @@ pub struct ShlLong2Addr { #[pymethods] impl ShlLong2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -24202,6 +24866,10 @@ pub struct ShrLong2Addr { #[pymethods] impl ShrLong2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -24330,6 +24998,10 @@ pub struct UshrLong2Addr { #[pymethods] impl UshrLong2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -24456,6 +25128,10 @@ pub struct AddFloat2Addr { #[pymethods] impl AddFloat2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -24582,6 +25258,10 @@ pub struct SubFloat2Addr { #[pymethods] impl SubFloat2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -24708,6 +25388,10 @@ pub struct MulFloat2Addr { #[pymethods] impl MulFloat2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -24834,6 +25518,10 @@ pub struct DivFloat2Addr { #[pymethods] impl DivFloat2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -24960,6 +25648,10 @@ pub struct RemFloat2Addr { #[pymethods] impl RemFloat2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -25088,6 +25780,10 @@ pub struct AddDouble2Addr { #[pymethods] impl AddDouble2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -25216,6 +25912,10 @@ pub struct SubDouble2Addr { #[pymethods] impl SubDouble2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -25344,6 +26044,10 @@ pub struct MulDouble2Addr { #[pymethods] impl MulDouble2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -25472,6 +26176,10 @@ pub struct DivDouble2Addr { #[pymethods] impl DivDouble2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -25600,6 +26308,10 @@ pub struct RemDouble2Addr { #[pymethods] impl RemDouble2Addr { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -25728,6 +26440,10 @@ pub struct AddIntLit { #[pymethods] impl AddIntLit { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -25900,6 +26616,10 @@ pub struct RsubIntLit { #[pymethods] impl RsubIntLit { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -26072,6 +26792,10 @@ pub struct MulIntLit { #[pymethods] impl MulIntLit { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -26244,6 +26968,10 @@ pub struct DivIntLit { #[pymethods] impl DivIntLit { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -26416,6 +27144,10 @@ pub struct RemIntLit { #[pymethods] impl RemIntLit { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -26558,7 +27290,7 @@ impl RemIntLit { ) } else if reg_on_4_bit { InsFormat::Format22S { - op: 0xd5, + op: 0xd4, va: self.dest, vb: self.b, c: self.lit, @@ -26588,6 +27320,10 @@ pub struct AndIntLit { #[pymethods] impl AndIntLit { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -26760,6 +27496,10 @@ pub struct OrIntLit { #[pymethods] impl OrIntLit { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -26932,6 +27672,10 @@ pub struct XorIntLit { #[pymethods] impl XorIntLit { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -27101,6 +27845,10 @@ pub struct ShlIntLit { #[pymethods] impl ShlIntLit { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -27212,6 +27960,10 @@ pub struct ShrIntLit { #[pymethods] impl ShrIntLit { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -27323,6 +28075,10 @@ pub struct UshrIntLit { #[pymethods] impl UshrIntLit { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -27437,6 +28193,10 @@ pub struct InvokePolymorphic { #[pymethods] impl InvokePolymorphic { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -27672,6 +28432,10 @@ pub struct InvokeCustom { #[pymethods] impl InvokeCustom { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -27886,6 +28650,10 @@ pub struct ConstMethodHandle { #[pymethods] impl ConstMethodHandle { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -28000,6 +28768,10 @@ pub struct ConstMethodType { #[pymethods] impl ConstMethodType { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -28124,6 +28896,10 @@ pub struct Try { #[pymethods] impl Try { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } @@ -28260,6 +29036,10 @@ pub struct Label { #[pymethods] impl Label { + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } + pub fn to_json(&self) -> Result { Ok(serde_json::to_string(self)?) } diff --git a/androscalpel/src/method.rs b/androscalpel/src/method.rs index 5e6578d..0bf0ba2 100644 --- a/androscalpel/src/method.rs +++ b/androscalpel/src/method.rs @@ -289,4 +289,8 @@ impl Method { .iter() .any(|list| !list.is_empty()) } + + pub fn __eq__(&self, other: &Self) -> bool { + self == other + } } diff --git a/test.py b/test.py index cd56bd7..e42c35a 100644 --- a/test.py +++ b/test.py @@ -5,20 +5,21 @@ logging.basicConfig(format=FORMAT) logging.getLogger().setLevel(logging.DEBUG) import json -import androscalpel as asc import zipfile as z -from androscalpel import * from pathlib import Path +from androscalpel import Apk, IdType, IdMethodType, ins, DexString, IdMethod, Code, utils # type: ignore + # APK_NAME = Path(__file__).parent / "test.apk" -APK_NAME = Path(__file__).parent / "app-release.apk" +APK_NAME = Path(__file__).parent / "app.apk" DEX_NAME = "classes.dex" +print(f"[+] Load bytecode ") with z.ZipFile(APK_NAME) as zipf: - with zipf.open(DEX_NAME, "r") as dex: - dex = dex.read() + with zipf.open(DEX_NAME, "r") as dex_f: + dex = dex_f.read() -apk = asc.Apk() +apk = Apk() apk.add_dex_file(dex) clazz_id = IdType("Lcom/example/testapplication/ui/home/HomeViewModel;") @@ -35,17 +36,18 @@ print(f"[+] Code of {method_id} ") for i in code.insns: print(f" {i}") print("[+] Modify code") + new_insns = [] for i in code.insns: - if isinstance(i, asc.ins.ConstString): + if isinstance(i, ins.ConstString): if i.lit == "Hello": - i = asc.ins.ConstString(i.reg, DexString("Degemer Mat")) + i = ins.ConstString(i.reg, DexString("Degemer Mat")) elif i.lit == "Bye": - i = asc.ins.ConstString(i.reg, DexString("Kenavo")) + i = ins.ConstString(i.reg, DexString("Kenavo")) new_insns.append(i) # This need improving! -code = asc.Code(code.registers_size, code.ins_size, code.outs_size, new_insns) +code = Code(code.registers_size, code.ins_size, code.outs_size, new_insns) apk.set_method_code(method_id, code) # apk.set_method_code(method.descriptor, code) @@ -58,49 +60,44 @@ for i in code.insns: print(f" {i}") # Strip class for debugging -# classes = list( -# filter( -# lambda x: x -# not in [ -# IdType("Lcom/example/testapplication/ui/home/HomeViewModel;"), -# IdType("Landroidx/navigation/NavDeepLink$Builder;"), -# IdType("Landroidx/constraintlayout/core/widgets/ConstraintWidget$1;"), -# ], -# apk.classes.keys(), -# ) -# ) -# for cls in classes: -# apk.remove_class(cls) +classes = list( + filter( + lambda x: x + not in [ + IdType("Lcom/example/testapplication/ui/home/HomeViewModel;"), + IdType("Landroidx/navigation/NavDeepLink$Builder;"), + IdType("Landroidx/constraintlayout/core/widgets/ConstraintWidget$1;"), + ], + apk.classes.keys(), + ) +) +for cls in classes: + apk.remove_class(cls) print("[+] Recompile") dex_raw = apk.gen_raw_dex() -utils.replace_dex( - APK_NAME, - APK_NAME.parent / "app-instrumented.apk", - dex_raw, - Path().parent / "my-release-key.jks", - zipalign=Path.home() / "Android" / "Sdk" / "build-tools" / "34.0.0" / "zipalign", - apksigner=Path.home() / "Android" / "Sdk" / "build-tools" / "34.0.0" / "apksigner", -) - -# assert len(dex_raw) == 1 -# with open(DEX_NAME, "wb") as file: -# file.write(dex_raw[0]) -# -# with open(DEX_NAME, "rb") as file: -# dex = file.read() - -print("[+] Load new dex") -new_apk = asc.Apk() +new_apk = Apk() for dex in dex_raw: new_apk.add_dex_file(dex) -clazz = new_apk.classes[clazz_id] -method = clazz.virtual_methods[method_id] -code = method.code +print(f"{new_apk == apk=}") -print(f"[+] Code of {method_id} in new apk") -for i in code.insns: - print(f" {i}") + +# print("[+] Repackage") +# +# utils.replace_dex( +# APK_NAME, +# APK_NAME.parent / (APK_NAME.name.removesuffix(".apk") + "-instrumented.apk"), +# dex_raw, +# Path().parent / "my-release-key.jks", +# zipalign=Path.home() / "Android" / "Sdk" / "build-tools" / "34.0.0" / "zipalign", +# apksigner=Path.home() / "Android" / "Sdk" / "build-tools" / "34.0.0" / "apksigner", +# ) + + +def cmp(a, b): + for f in dir(a): + if getattr(getattr(a, f), "__call__", None) is None: + print(f"{f}: {getattr(a, f) == getattr(b, f)}")