0

I have a header file like this:

@class NSMutableDictionary, NSString;

@interface randomclassname : NSObject
{
    unsigned long long _HTTPMethod;
    NSString *_path;
    unsigned long long _apiVersion;
    NSMutableDictionary *_parameters;
    NSMutableDictionary *_defaultParameters;

    NSMutableDictionary *_headers;
    _Bool _isSigned;
}
/// methods are down here
+ (id)builderWithHTTPMethod:(unsigned long long)arg1 path:(id)arg2;

I want to access and print NSMutableDictionary *_defaultParameters;

and

unsigned long long _apiVersion;

The follow properties inside my method object.

+ (id)builderWithHTTPMethod:(unsigned long long)arg1 format:(id)arg2 
{
    **access those properties here and print them on NSlog.**
    return %orig; 
}

Please feel free to correct me if I'm wrong. I'm not entirely sure if stuff inside @interface are called properties; I'm guessing. But that's what I'm trying to access.

Biplov
  • 1,136
  • 1
  • 20
  • 44

1 Answers1

0

First you need to add your _defaultParametersand your apiVersion as property in your .h file

@property NSMutableDictionary *defaultParameters;
@property (assign) unsigned long long _apiVersion;

after that you can cast in your method the param id as your randomclassname

+ (id)builderWithHTTPMethod:(unsigned long long)arg1 format:(id)arg2 
{
    //**access those properties here and print them on NSlog.**
    randomclassname *obj = (randomclassname*)arg2;
    NSLog(@"%@",obj.defaultParameters);
    return %orig; 
}
Reinier Melian
  • 20,519
  • 3
  • 38
  • 55
  • There are no others ways than setting the @property into my .h file? This is class-dumped h file, not sure if I can alter it. – Biplov Feb 17 '18 at 06:20
  • can you show an example or even a psuedo code for it. – Biplov Feb 17 '18 at 06:23
  • your builderWithHTTPMethod is inside of your class? @Dilli – Reinier Melian Feb 17 '18 at 06:34
  • I can share the header file with you. I renamed it to builderWithHTTPMethod https://pastebin.com/Ck1L8MSU builderWithHTTPmethod is called IGAPIRequestBuilder pastebin has the header file. @reinier-melian – Biplov Feb 17 '18 at 06:35
  • @Dilli sorry but I can understand why you can't add those private variables as properties? can you explain a little more about of what are you need to do? – Reinier Melian Feb 17 '18 at 06:40
  • I'm trying to learn reverse engineering. Those headers files are class-dumped, not sure how I would go on about using the updated headers with instagram again. If you can show me an example of class extension with the pastebin I provided; that would help. – Biplov Feb 17 '18 at 06:41
  • You are saying that you are decompiling and changing and after that compiling again? @Dilli – Reinier Melian Feb 17 '18 at 06:45
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/165318/discussion-between-dilli-and-reinier-melian). – Biplov Feb 17 '18 at 06:45