mirror of
https://github.com/carlospolop/hacktricks
synced 2024-11-22 04:33:28 +00:00
GITBOOK-3897: change request with no subject merged in GitBook
This commit is contained in:
parent
f2762b0fb2
commit
6c596ed48a
3 changed files with 119 additions and 10 deletions
15
SUMMARY.md
15
SUMMARY.md
|
@ -137,16 +137,17 @@
|
|||
|
||||
## 🍏 MacOS Hardening
|
||||
|
||||
* [MacOS Security & Privilege Escalation](macos-hardening/macos-security-and-privilege-escalation/README.md)
|
||||
* [Mac OS Architecture](macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/README.md)
|
||||
* [macOS Security & Privilege Escalation](macos-hardening/macos-security-and-privilege-escalation/README.md)
|
||||
* [macOS Architecture](macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/README.md)
|
||||
* [macOS Bundles](macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/macos-bundles.md)
|
||||
* [Universal binaries & Mach-O Format](macos-hardening/macos-security-and-privilege-escalation/mac-os-architecture/universal-binaries-and-mach-o-format.md)
|
||||
* [MacOS MDM](macos-hardening/macos-security-and-privilege-escalation/macos-mdm/README.md)
|
||||
* [macOS MDM](macos-hardening/macos-security-and-privilege-escalation/macos-mdm/README.md)
|
||||
* [Enrolling Devices in Other Organisations](macos-hardening/macos-security-and-privilege-escalation/macos-mdm/enrolling-devices-in-other-organisations.md)
|
||||
* [MacOS Protocols](macos-hardening/macos-security-and-privilege-escalation/macos-protocols.md)
|
||||
* [MacOS Red Teaming](macos-hardening/macos-security-and-privilege-escalation/macos-red-teaming.md)
|
||||
* [MacOS Serial Number](macos-hardening/macos-security-and-privilege-escalation/macos-serial-number.md)
|
||||
* [MacOS Apps - Inspecting, debugging and Fuzzing](macos-hardening/macos-security-and-privilege-escalation/macos-apps-inspecting-debugging-and-fuzzing.md)
|
||||
* [macOS Basic Objective-C](macos-hardening/macos-security-and-privilege-escalation/macos-basic-objective-c.md)
|
||||
* [macOS Protocols](macos-hardening/macos-security-and-privilege-escalation/macos-protocols.md)
|
||||
* [macOS Red Teaming](macos-hardening/macos-security-and-privilege-escalation/macos-red-teaming.md)
|
||||
* [macOS Serial Number](macos-hardening/macos-security-and-privilege-escalation/macos-serial-number.md)
|
||||
* [macOS Apps - Inspecting, debugging and Fuzzing](macos-hardening/macos-security-and-privilege-escalation/macos-apps-inspecting-debugging-and-fuzzing.md)
|
||||
|
||||
## 🪟 Windows Hardening
|
||||
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
# macOS Basic Objective-C
|
||||
|
||||
<details>
|
||||
|
||||
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks Cloud ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 Twitter 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>
|
||||
|
||||
* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)!
|
||||
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
|
||||
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
|
||||
* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
|
||||
* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud).
|
||||
|
||||
</details>
|
||||
|
||||
## Classes, Methods & Objects
|
||||
|
||||
* Declare an **interface** with the **properties** & **methods**
|
||||
|
||||
```objectivec
|
||||
// Declare the interface of the class
|
||||
@interface MyVehicle : NSObject
|
||||
|
||||
// Declare the properties
|
||||
@property NSString *vehicleType;
|
||||
@property int numberOfWheels;
|
||||
|
||||
// Declare the methods
|
||||
- (void)startEngine;
|
||||
- (void)addWheels:(int)value;
|
||||
|
||||
@end
|
||||
```
|
||||
|
||||
* **Implement** the **class** from the interface
|
||||
|
||||
```objectivec
|
||||
@implementation MyVehicle : NSObject
|
||||
|
||||
// No need to indicate the properties, only define methods
|
||||
|
||||
- (void)startEngine {
|
||||
NSLog(@"Engine started");
|
||||
}
|
||||
|
||||
- (void)addWheels:(int)value {
|
||||
self.numberOfWheels += value;
|
||||
}
|
||||
|
||||
@end
|
||||
```
|
||||
|
||||
* **Create an object** of the class & **call** a **method**
|
||||
|
||||
To create an instance of a class the **`alloc`** method is called which **allocate memory** for each **property** and **zero** those allocations. Then **`init`** is called, which **initilize the properties** to the **required values**.
|
||||
|
||||
```objectivec
|
||||
// Something like this:
|
||||
MyVehicle *newVehicle = [[MyVehicle alloc] init];
|
||||
|
||||
// Which is usually expressed as:
|
||||
MyVehicle *newVehicle = [MyVehicle new];
|
||||
|
||||
// To call a method
|
||||
// [myClassInstance nameOfTheMethodFirstParam:param1 secondParam:param2]
|
||||
[newVehicle addWheels:4];
|
||||
```
|
||||
|
||||
* **Class methods**
|
||||
|
||||
Class methods are defined with the **plus sign** (+) not the hyphen (-) that is used with instance methods. Like the **NSString** class method **`stringWithString`**:
|
||||
|
||||
```objectivec
|
||||
+ (id)stringWithString:(NSString *)aString;
|
||||
```
|
||||
|
||||
* **Setter** & **Getter** Methods
|
||||
|
||||
To **set** & **get** properties, you could do it with a **dot notation** or like if you were **calling a method**:
|
||||
|
||||
```objectivec
|
||||
// Set
|
||||
newVehicle.numberOfWheels = 2;
|
||||
[newVehicle setNumberOfWheels:3];
|
||||
|
||||
// Get
|
||||
NSLog(@"Number of wheels: %i", newVehicle.numberOfWheels);
|
||||
NSLog(@"Number of wheels: %i", [newVehicle numberOfWheels]);
|
||||
```
|
||||
|
||||
* **Instance Variables**
|
||||
|
||||
Alternatively to setter & getter methods you can use instance variables. These variables have the same name as the properties but starting with a "\_":
|
||||
|
||||
```objectivec
|
||||
- (void)makeLongTruck {
|
||||
_numberOfWheels = 10000;
|
||||
}
|
||||
```
|
||||
|
||||
<details>
|
||||
|
||||
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks Cloud ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 Twitter 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>
|
||||
|
||||
* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)!
|
||||
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
|
||||
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
|
||||
* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
|
||||
* **Share your hacking tricks by submitting PRs to the** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **and** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud).
|
||||
|
||||
</details>
|
|
@ -1,6 +1,4 @@
|
|||
# MacOS MDM
|
||||
|
||||
## MacOS MDM
|
||||
# macOS MDM
|
||||
|
||||
<details>
|
||||
|
||||
|
|
Loading…
Reference in a new issue