├── LatestBuild ├── shisangeIMGUI.framework ├── Info.plist ├── shisangeIMGUI └── Headers │ ├── imgui_impl_metal.h │ └── imconfig.h ├── Packages ├── WX.NongShiFu123.Ding_0.1-1_iphoneos-arm.deb └── WX.NongShiFu123.Ding_0.1-1_iphoneos-arm.zip ├── PUBG ├── Package │ ├── Library │ │ └── MobileSubstrate │ │ │ └── DynamicLibraries │ │ │ ├── tersafe │ │ │ ├── PUBG.dylib │ │ │ └── PUBG.plist │ └── DEBIAN │ │ ├── control │ │ └── postinst ├── PUBGDataModel.mm ├── GameVV.h ├── ESP.h ├── PUBGTypeHeader.h ├── ShiSanGeGetGame.h ├── PUBGDataModel.h └── ESP.mm ├── hook ├── Ding-Prefix.pch ├── YMUIWindow.h ├── ShiSnGeWindow.h ├── YMUIViewController.h ├── ShiSanGeViewController.h ├── YMUIViewController.m ├── ShiSanGeViewController.m ├── ShiSnGeWindow.m └── YMUIWindow.m ├── PUBG.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── shisange.xcuserdatad │ ├── xcschemes │ └── xcschememanagement.plist │ └── xcdebugger │ └── Breakpoints_v2.xcbkptlist ├── Bsphp ├── bsphp │ ├── NetWorkingApiClient.h │ ├── NSDictionary+StichingStringkeyValue.h │ ├── NSString+MD5.h │ ├── DES3Util.h │ ├── NSString+URLCode.h │ ├── NSString+Tools.h │ ├── NSString+MD5.m │ ├── NSDictionary+StichingStringkeyValue.m │ ├── NetWorkingApiClient.m │ ├── MF_Base64Additions.h │ ├── NSString+URLCode.m │ ├── NSString+Tools.m │ ├── DES3Util.m │ ├── Config.m │ └── MF_Base64Additions.m ├── QQ350722326.h ├── AFNetworking │ ├── AFNetworking.h │ ├── AFSecurityPolicy.h │ ├── AFNetworkReachabilityManager.h │ ├── AFNetworkReachabilityManager.m │ ├── AFURLResponseSerialization.h │ ├── AFSecurityPolicy.m │ ├── AFHTTPSessionManager.m │ └── AFHTTPSessionManager.h ├── Config.h └── QQ350722326.mm ├── UIMem ├── PubgLoad.h ├── ImGuiMem.h ├── NSTask.h ├── PubgLoad.mm └── ImGuiMem.mm ├── README.md └── CydiaSubstrate.framework ├── CydiaSubstrate.tbd └── Info.plist /LatestBuild: -------------------------------------------------------------------------------- 1 | /Users/shisange/Library/Developer/Xcode/DerivedData/PUBG-evqrkgtpdjsfaoeuvpiayevrtqhx/Build/Products/Debug-iphoneos -------------------------------------------------------------------------------- /shisangeIMGUI.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjjsjx/PUBG_China_imGui/HEAD/shisangeIMGUI.framework/Info.plist -------------------------------------------------------------------------------- /shisangeIMGUI.framework/shisangeIMGUI: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjjsjx/PUBG_China_imGui/HEAD/shisangeIMGUI.framework/shisangeIMGUI -------------------------------------------------------------------------------- /Packages/WX.NongShiFu123.Ding_0.1-1_iphoneos-arm.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjjsjx/PUBG_China_imGui/HEAD/Packages/WX.NongShiFu123.Ding_0.1-1_iphoneos-arm.deb -------------------------------------------------------------------------------- /Packages/WX.NongShiFu123.Ding_0.1-1_iphoneos-arm.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjjsjx/PUBG_China_imGui/HEAD/Packages/WX.NongShiFu123.Ding_0.1-1_iphoneos-arm.zip -------------------------------------------------------------------------------- /PUBG/Package/Library/MobileSubstrate/DynamicLibraries/tersafe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjjsjx/PUBG_China_imGui/HEAD/PUBG/Package/Library/MobileSubstrate/DynamicLibraries/tersafe -------------------------------------------------------------------------------- /PUBG/Package/Library/MobileSubstrate/DynamicLibraries/PUBG.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjjsjx/PUBG_China_imGui/HEAD/PUBG/Package/Library/MobileSubstrate/DynamicLibraries/PUBG.dylib -------------------------------------------------------------------------------- /hook/Ding-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Ding' target in the 'Ding' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #import "/opt/theos/Prefix.pch" //path/to/theos/Prefix.pch 8 | #endif 9 | -------------------------------------------------------------------------------- /PUBG.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /PUBG/PUBGDataModel.mm: -------------------------------------------------------------------------------- 1 | // 2 | // WX:NongShiFu123 QQ:350722326 3 | // Created by 十三哥 on 2023/5/31. 4 | // Git:https://github.com/nongshifu/PUBG_China_imGui 5 | // 6 | 7 | #import "PUBGDataModel.h" 8 | @implementation PUBGPlayerWZ 9 | 10 | @end 11 | 12 | @implementation PUBGPlayerModel 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /PUBG.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /hook/YMUIWindow.h: -------------------------------------------------------------------------------- 1 | // 2 | // WX:NongShiFu123 QQ:350722326 3 | // Created by 十三哥 on 2023/5/31. 4 | // Git:https://github.com/nongshifu/PUBG_China_imGui 5 | // 6 | 7 | #import 8 | 9 | NS_ASSUME_NONNULL_BEGIN 10 | 11 | @interface YMUIWindow : UIWindow 12 | + (instancetype)sharedInstance; 13 | 14 | @end 15 | 16 | NS_ASSUME_NONNULL_END 17 | -------------------------------------------------------------------------------- /Bsphp/bsphp/NetWorkingApiClient.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // NetWorkingApiClient.h 4 | // BSPHPOC 5 | // 6 | // Created by MRW on 2016/12/14. 7 | // Copyright © 2016年 xiaozhou. All rights reserved. 8 | // 9 | 10 | #import "AFNetworking.h" 11 | 12 | @interface NetWorkingApiClient : AFHTTPSessionManager 13 | + (NetWorkingApiClient *)sharedNetWorkingApiClient; 14 | @end 15 | -------------------------------------------------------------------------------- /hook/ShiSnGeWindow.h: -------------------------------------------------------------------------------- 1 | // 2 | // WX:NongShiFu123 QQ:350722326 3 | // Created by 十三哥 on 2023/5/31. 4 | // Git:https://github.com/nongshifu/PUBG_China_imGui 5 | // 6 | 7 | #import 8 | 9 | NS_ASSUME_NONNULL_BEGIN 10 | 11 | @interface ShiSnGeWindow : UIWindow 12 | + (instancetype)sharedInstance; 13 | 14 | @end 15 | 16 | NS_ASSUME_NONNULL_END 17 | -------------------------------------------------------------------------------- /PUBG/Package/DEBIAN/control: -------------------------------------------------------------------------------- 1 | Package: WX.NongShiFu123.Ding 2 | Name: 十三哥IMGUI绘制 3 | Version: 0.1-1 4 | Description: 5 | Section: System 6 | Depends: firmware (>= 5.0), mobilesubstrate 7 | Conflicts: 8 | Replaces: 9 | Priority: optional 10 | Architecture: iphoneos-arm 11 | Author: 十三哥 12 | dev: 13 | Homepage: 14 | Depiction: 15 | Maintainer: 16 | Icon: 17 | 18 | -------------------------------------------------------------------------------- /hook/YMUIViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // WX:NongShiFu123 QQ:350722326 3 | // Created by 十三哥 on 2023/5/31. 4 | // Git:https://github.com/nongshifu/PUBG_China_imGui 5 | // 6 | #import 7 | 8 | NS_ASSUME_NONNULL_BEGIN 9 | 10 | @interface YMUIViewController : UIViewController 11 | + (instancetype)sharedInstance; 12 | @end 13 | 14 | NS_ASSUME_NONNULL_END 15 | -------------------------------------------------------------------------------- /hook/ShiSanGeViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // WX:NongShiFu123 QQ:350722326 3 | // Created by 十三哥 on 2023/5/31. 4 | // Git:https://github.com/nongshifu/PUBG_China_imGui 5 | // 6 | 7 | #import 8 | 9 | NS_ASSUME_NONNULL_BEGIN 10 | 11 | @interface ShiSanGeViewController : UIViewController 12 | + (instancetype)sharedInstance; 13 | @end 14 | 15 | NS_ASSUME_NONNULL_END 16 | -------------------------------------------------------------------------------- /UIMem/PubgLoad.h: -------------------------------------------------------------------------------- 1 | // 2 | // WX:NongShiFu123 QQ:350722326 3 | // Created by 十三哥 on 2023/5/31. 4 | // Git:https://github.com/nongshifu/PUBG_China_imGui 5 | // 6 | 7 | #import 8 | 9 | NS_ASSUME_NONNULL_BEGIN 10 | 11 | @interface PubgLoad : UIView 12 | extern bool MenDeal; 13 | 14 | + (instancetype)sharedInstance; 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /UIMem/ImGuiMem.h: -------------------------------------------------------------------------------- 1 | // 2 | // WX:NongShiFu123 QQ:350722326 3 | // Created by 十三哥 on 2023/5/31. 4 | // Git:https://github.com/nongshifu/PUBG_China_imGui 5 | // 6 | 7 | #import 8 | NS_ASSUME_NONNULL_BEGIN 9 | 10 | @interface ImGuiMem : UITextField 11 | extern bool 绘制总开关,过直播开关; 12 | + (instancetype)sharedInstance; 13 | @end 14 | 15 | NS_ASSUME_NONNULL_END 16 | -------------------------------------------------------------------------------- /PUBG/Package/Library/MobileSubstrate/DynamicLibraries/PUBG.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Filter 6 | 7 | Bundles 8 | 9 | com.apple.springboard 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Bsphp/bsphp/NSDictionary+StichingStringkeyValue.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+StichingStringkeyValue.h 3 | // BSPHPOC 4 | // 5 | // Created by MRW on 2016/12/28. 6 | // Copyright © 2016年 xiaozhou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSDictionary (StichingStringkeyValue) 12 | + (NSString *)__attribute__((optnone))stitchingStringFromDictionary:(NSDictionary *)dictionary; 13 | @end 14 | -------------------------------------------------------------------------------- /Bsphp/QQ350722326.h: -------------------------------------------------------------------------------- 1 | // 2 | // WX:NongShiFu123 QQ:350722326 3 | // Created by 十三哥 on 2023/5/31. 4 | // Git:https://github.com/nongshifu/PUBG_China_imGui 5 | // 6 | 7 | #import 8 | #import 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface NSObject (checkStatus) 14 | 15 | extern BOOL 验证状态; 16 | extern NSString*验证信息; 17 | extern NSString*到期时间; 18 | - (void)YzCode:(void (^)(void))completion; 19 | @end 20 | 21 | NS_ASSUME_NONNULL_END 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PUBG_China_imGui 2 | 和平精英绘制 imGui 跨进程 3 | 跨进程注入桌面SpringBoard 游戏中按音量 4 | ![IMG_0505](https://github.com/nongshifu/PUBG_China_imGui/assets/31665489/29f82594-a6ed-490f-82db-55c644960589) 5 | ![IMG_0503](https://github.com/nongshifu/PUBG_China_imGui/assets/31665489/2493daf9-c6e8-4623-90b7-702464bf04dd) 6 | ![IMG_0504](https://github.com/nongshifu/PUBG_China_imGui/assets/31665489/98934a74-fffe-42f8-a283-858caade5323) 7 | ![IMG_0501](https://github.com/nongshifu/PUBG_China_imGui/assets/31665489/8a837830-24e3-4717-bdc8-418ea81954a6) 8 | 9 | -------------------------------------------------------------------------------- /Bsphp/bsphp/NSString+MD5.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+MD5.h 3 | // 4 | // Created by Keith Smiley on 3/25/13. 5 | // Copyright (c) 2013 Keith Smiley. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | 11 | #ifdef NS_ASSUME_NONNULL_BEGIN 12 | NS_ASSUME_NONNULL_BEGIN 13 | #endif 14 | 15 | @interface NSString (MD5) 16 | 17 | - (NSString *)__attribute__((optnone))MD5Digest; 18 | - (NSString *)__attribute__((optnone))stringByReversed; 19 | 20 | @end 21 | 22 | #ifdef NS_ASSUME_NONNULL_END 23 | NS_ASSUME_NONNULL_END 24 | #endif 25 | -------------------------------------------------------------------------------- /PUBG.xcodeproj/xcuserdata/shisange.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Ding.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | PUBG.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 0 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Bsphp/bsphp/DES3Util.h: -------------------------------------------------------------------------------- 1 | // 2 | // DES3Util.h 3 | // TestDes 4 | // 5 | // BSPHP网络验证系统 Bsphp.Com 6 | // Copyright © 2016年 Craftsman. All rights reserved. 7 | // 8 | // 9 | // DES3Util.h 10 | // 11 | #import 12 | @interface DES3Util : NSObject { 13 | } 14 | // 加密方法 15 | + (NSString*)__attribute__((optnone))encrypt:(NSString*)plainText gkey:(NSString *)gkey; 16 | // 解密方法 17 | + (NSString*)__attribute__((optnone))decrypt:(NSString*)encryptText gkey:(NSString *)gkey; 18 | 19 | @end 20 | 21 | #import 22 | 23 | //@interface DES3Util : NSObject 24 | 25 | //@end 26 | -------------------------------------------------------------------------------- /Bsphp/bsphp/NSString+URLCode.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+URLCode.h 3 | // LOL 4 | // 5 | // Created by 刘清 on 16/3/10. 6 | // Copyright (c) 2016年 LQ. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSString (URLCode) 12 | //编码 string code -> url code 13 | - (NSString *)__attribute__((optnone))URLEncodedString; 14 | //解码 url code -> string code 15 | - (NSString *)__attribute__((optnone))URLDecodedString; 16 | 17 | /** 18 | md5加密 19 | 20 | @param input 输入要加密的 21 | @return 输出加密后 22 | */ 23 | - (NSString *)__attribute__((optnone)) md5:(NSString *) input; 24 | @end 25 | -------------------------------------------------------------------------------- /PUBG/Package/DEBIAN/postinst: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## 获取MobileSubstrate目录下的tersafe文件路径 4 | #tersafe_path="/Library/MobileSubstrate/DynamicLibraries/tersafe" 5 | # 6 | ## 查找ShadowTrackerExtra.app目录 7 | #st_app_path="$(find /var/containers/Bundle/Application -name "ShadowTrackerExtra.app" -type d)" 8 | # 9 | ## 检查是否找到ShadowTrackerExtra.app目录 10 | #if [[ -z "$st_app_path" ]]; then 11 | # echo "未找到ShadowTrackerExtra.app目录" 12 | # exit 1 13 | #fi 14 | # 15 | ## 拷贝tersafe文件到ShadowTrackerExtra.app/Framework/tersafe.framework 16 | #cp "$tersafe_path" "$st_app_path/Frameworks/tersafe.framework/tersafe" 17 | 18 | # 打印操作完成消息 19 | echo "安装完成-请注销设备生效-游戏中按音量键激活" 20 | -------------------------------------------------------------------------------- /CydiaSubstrate.framework/CydiaSubstrate.tbd: -------------------------------------------------------------------------------- 1 | --- 2 | archs: [ armv7, armv7s, arm64, arm64e, i386, x86_64 ] 3 | platform: iphoneos 4 | install-name: /Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate 5 | current-version: 0.0.0 6 | compatibility-version: 0.0.0 7 | exports: 8 | - archs: [ armv7, armv7s, arm64, arm64e, i386, x86_64 ] 9 | symbols: [ _MSCloseImage, _MSDebug, _MSFindAddress, _MSFindSymbol, 10 | _MSGetImageByName, _MSHookClassPair, _MSHookFunction, 11 | _MSHookMemory, _MSHookMessageEx, _MSImageAddress, 12 | _MSMapImage ] 13 | ... 14 | -------------------------------------------------------------------------------- /CydiaSubstrate.framework/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | CydiaSubstrate 9 | CFBundleGetInfoString 10 | Cydia Substrate, SaurikIT LLC 11 | CFBundleIdentifier 12 | com.saurik.CydiaSubstate 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | Cydia Substrate 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 0.9 21 | CFBundleSignature 22 | ???? 23 | 24 | 25 | -------------------------------------------------------------------------------- /PUBG/GameVV.h: -------------------------------------------------------------------------------- 1 | // 2 | // WX:NongShiFu123 QQ:350722326 3 | // Created by 十三哥 on 2023/5/31. 4 | // Git:https://github.com/nongshifu/PUBG_China_imGui 5 | // 6 | 7 | #import 8 | #import 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #import "PUBGTypeHeader.h" 19 | 20 | #define kAddrMax 0xFFFFFFFFF 21 | 22 | NS_ASSUME_NONNULL_BEGIN 23 | int getProcesses(NSString *Name); 24 | mach_port_t getTask(int pid); 25 | vm_map_offset_t getBaseAddress(mach_port_t task); 26 | 27 | bool getGame(); 28 | 29 | @interface GameVV : NSObject 30 | - (void)getNSArray; 31 | - (NSMutableArray*)getData; 32 | - (NSMutableArray*)getwzData; 33 | + (instancetype)factory; 34 | 35 | 36 | @end 37 | 38 | NS_ASSUME_NONNULL_END 39 | -------------------------------------------------------------------------------- /PUBG/ESP.h: -------------------------------------------------------------------------------- 1 | // 2 | // WX:NongShiFu123 QQ:350722326 3 | // Created by 十三哥 on 2023/5/31. 4 | // Git:https://github.com/nongshifu/PUBG_China_imGui 5 | // 6 | #import 7 | #import 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | extern ImVec4 血条颜色; 13 | extern ImVec4 方框颜色; 14 | extern ImVec4 射线颜色; 15 | extern ImVec4 骨骼颜色; 16 | extern ImVec4 距离颜色; 17 | extern ImVec4 手持武器颜色; 18 | extern ImVec4 名字颜色; 19 | 20 | extern bool 绘制总开关,过直播开关, 无后座开关,自瞄开关,追踪开关,手雷预警开关,聚点开关,防抖开关; 21 | extern bool 射线开关,骨骼开关,方框开关,距离开关,血条开关,名字开关,背景开关,边缘开关,附近人数开关,手持武器开关; 22 | extern bool 物资总开关,载具开关,药品开关,投掷物开关,枪械开关,配件开关,子弹开关,其他物资开关,高级物资开关,倍镜开关,头盔开关,护甲开关,背包开关,物资调试开关; 23 | extern float 追踪距离; 24 | extern float 追踪圆圈; 25 | extern int 追踪部位; 26 | extern float 自瞄速度; 27 | 28 | @interface ESP : UIView 29 | + (instancetype)sharedInstance; 30 | - (void)绘制玩家:(ImDrawList*)MsDrawList; 31 | @end 32 | 33 | NS_ASSUME_NONNULL_END 34 | -------------------------------------------------------------------------------- /Bsphp/bsphp/NSString+Tools.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Tools.h 3 | // XFSettings 4 | // 5 | // Created by apple on 14-8-21. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | 13 | @interface NSString (Tools) 14 | 15 | /** 16 | * 获取单行文本的size 17 | * 18 | * @param fontSize fontSize 19 | * 20 | * @return textSize 21 | */ 22 | - (CGSize)__attribute__((optnone))sizeOfFontSize:(CGFloat)fontSize; 23 | /** 24 | * 获得多行文本的size 25 | * 26 | * @param fontSize fontSize 27 | * @param maxWidth maxWidth 28 | * 29 | * @return textSize 30 | */ 31 | - (CGSize)__attribute__((optnone))sizeOfFontSize:(CGFloat)fontSize maxWidth:(CGFloat)maxWidth; 32 | /** 33 | * 返回文件或目录的大小byte单位 34 | * 35 | * @return fileSize 如果路径不存在返回0 36 | */ 37 | - (NSInteger)__attribute__((optnone))fileSize; 38 | 39 | + (CGSize)__attribute__((optnone))sizeWithString:(NSString*)str andFont:(UIFont*)font andMaxSize:(CGSize)size; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /hook/YMUIViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // WX:NongShiFu123 QQ:350722326 3 | // Created by 十三哥 on 2023/5/31. 4 | // Git:https://github.com/nongshifu/PUBG_China_imGui 5 | // 6 | 7 | #import "YMUIViewController.h" 8 | static id _sharedInstance; 9 | static dispatch_once_t _onceToken; 10 | @interface YMUIViewController () 11 | @end 12 | 13 | @implementation YMUIViewController 14 | 15 | - (void)viewDidLoad { 16 | [super viewDidLoad]; 17 | 18 | } 19 | 20 | - (BOOL)_ignoresHitTest { 21 | return YES; 22 | } 23 | - (UIInterfaceOrientationMask)supportedInterfaceOrientations { 24 | // 当前 VC 支持的屏幕方向 25 | return UIInterfaceOrientationMaskLandscape; 26 | } 27 | 28 | - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { 29 | // 优先的屏幕方向 30 | return UIInterfaceOrientationLandscapeRight; 31 | } 32 | + (instancetype)sharedInstance 33 | { 34 | dispatch_once(&_onceToken, ^{ 35 | _sharedInstance = [[self alloc] init]; 36 | }); 37 | return _sharedInstance; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /hook/ShiSanGeViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // WX:NongShiFu123 QQ:350722326 3 | // Created by 十三哥 on 2023/5/31. 4 | // Git:https://github.com/nongshifu/PUBG_China_imGui 5 | // 6 | 7 | #import "ShiSanGeViewController.h" 8 | 9 | @interface ShiSanGeViewController () 10 | 11 | @end 12 | 13 | static id _sharedInstance; 14 | static dispatch_once_t _onceToken; 15 | 16 | @implementation ShiSanGeViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | // Do any additional setup after loading the view. 21 | } 22 | 23 | #pragma mark - 事件 24 | 25 | - (UIInterfaceOrientationMask)supportedInterfaceOrientations { 26 | // 当前 VC 支持的屏幕方向 27 | return UIInterfaceOrientationMaskLandscape; 28 | } 29 | 30 | - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { 31 | // 优先的屏幕方向 32 | return UIInterfaceOrientationLandscapeRight; 33 | } 34 | + (instancetype)sharedInstance 35 | { 36 | dispatch_once(&_onceToken, ^{ 37 | _sharedInstance = [[self alloc] init]; 38 | }); 39 | return _sharedInstance; 40 | } 41 | 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Bsphp/bsphp/NSString+MD5.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+MD5.m 3 | // 4 | // Created by Keith Smiley on 3/25/13. 5 | // Copyright (c) 2013 Keith Smiley. All rights reserved. 6 | // 7 | 8 | #import 9 | #import "NSString+MD5.h" 10 | 11 | @implementation NSString (MD5) 12 | 13 | - (NSString *)__attribute__((optnone))MD5Digest 14 | { 15 | const char* input = [self UTF8String]; 16 | unsigned char result[CC_MD5_DIGEST_LENGTH]; 17 | CC_MD5(input, (CC_LONG)strlen(input), result); 18 | 19 | NSMutableString *digest = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2]; 20 | for (NSInteger i = 0; i < CC_MD5_DIGEST_LENGTH; i++) { 21 | [digest appendFormat:@"%02X", result[i]]; 22 | } 23 | 24 | return digest; 25 | } 26 | 27 | - (NSString *)__attribute__((optnone))stringByReversed 28 | { 29 | NSMutableString *s = [NSMutableString string]; 30 | for (NSUInteger i=self.length; i>0; i--) { 31 | [s appendString:[self substringWithRange:NSMakeRange(i-1, 1)]]; 32 | } 33 | return s; 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Bsphp/bsphp/NSDictionary+StichingStringkeyValue.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+StichingStringkeyValue.m 3 | // BSPHPOC 4 | // 5 | // Created by MRW on 2016/12/28. 6 | // Copyright © 2016年 xiaozhou. All rights reserved. 7 | // 8 | 9 | #import "NSDictionary+StichingStringkeyValue.h" 10 | 11 | @implementation NSDictionary (StichingStringkeyValue) 12 | /** 13 | 将字典拼接成URL形式并以字符串返回 14 | 15 | @param dictionary 参数字典 16 | @return 字符串形式返回 17 | */ 18 | + (NSString *)__attribute__((optnone))stitchingStringFromDictionary:(NSDictionary *)dictionary{ 19 | NSMutableString *str = [[NSMutableString alloc]initWithCapacity:10]; 20 | bool first = YES; 21 | for (NSString *key in dictionary) 22 | { 23 | if (first) 24 | { 25 | [str appendString:[NSString stringWithFormat:@"%@=%@",key,[dictionary objectForKey:key]]]; 26 | first = !first; 27 | }else 28 | { 29 | 30 | [str appendString:[NSString stringWithFormat:@"&%@=%@",key,[dictionary objectForKey:key]]]; 31 | } 32 | } 33 | return str; 34 | } 35 | @end 36 | -------------------------------------------------------------------------------- /Bsphp/bsphp/NetWorkingApiClient.m: -------------------------------------------------------------------------------- 1 | // 2 | // NetWorkingApiClient.m 3 | // BSPHPOC 4 | // 5 | // Created by MRW on 2016/12/14. 6 | // Copyright © 2016年 xiaozhou. All rights reserved. 7 | // 8 | 9 | #import "NetWorkingApiClient.h" 10 | static NetWorkingApiClient *netWorkingClient = nil; 11 | @implementation NetWorkingApiClient 12 | + (NetWorkingApiClient *)__attribute__((optnone))sharedNetWorkingApiClient{ 13 | static dispatch_once_t onceToken; 14 | dispatch_once(&onceToken, ^{ 15 | netWorkingClient = [[NetWorkingApiClient alloc] initWithBaseURL:[NSURL URLWithString:@""]]; 16 | netWorkingClient.securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone]; 17 | //设置返回原生状态数据:返回NSData类型 18 | netWorkingClient.responseSerializer = [AFHTTPResponseSerializer serializer]; 19 | //返回的数据是解析完的json数据 20 | //netWorkingClient.responseSerializer = [AFJSONResponseSerializer serializer]; 21 | //返回的数据是解析完的XML数据 22 | //netWorkingClient.responseSerializer = [AFXMLParserResponseSerializer serializer]; 23 | 24 | }); 25 | return netWorkingClient; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /hook/ShiSnGeWindow.m: -------------------------------------------------------------------------------- 1 | // 2 | // WX:NongShiFu123 QQ:350722326 3 | // Created by 十三哥 on 2023/5/31. 4 | // Git:https://github.com/nongshifu/PUBG_China_imGui 5 | // 6 | 7 | #import "ShiSnGeWindow.h" 8 | #import "ShiSanGeViewController.h" 9 | @implementation ShiSnGeWindow 10 | static id _sharedInstance; 11 | static dispatch_once_t _onceToken; 12 | - (instancetype)initWithFrame:(CGRect)frame 13 | { 14 | self = [super initWithFrame:frame]; 15 | if (self) { 16 | self.userInteractionEnabled = YES; 17 | self.windowLevel = UIWindowLevelStatusBar+99999; 18 | self.clipsToBounds = YES; 19 | [self setHidden:NO]; 20 | [self setAlpha:1.0]; 21 | [self setBackgroundColor:[UIColor clearColor]]; 22 | self.rootViewController=[ShiSanGeViewController sharedInstance]; 23 | } 24 | return self; 25 | } 26 | 27 | - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event 28 | { 29 | UIView *view = [super hitTest:point withEvent:event]; 30 | if (view == self.rootViewController.view) { 31 | return nil; 32 | } 33 | NSLog(@"aaaa%s",__func__); 34 | return view; 35 | } 36 | 37 | + (instancetype)sharedInstance 38 | { 39 | dispatch_once(&_onceToken, ^{ 40 | _sharedInstance = [[self alloc] initWithFrame:[UIScreen mainScreen].bounds]; 41 | }); 42 | return _sharedInstance; 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /hook/YMUIWindow.m: -------------------------------------------------------------------------------- 1 | // 2 | // WX:NongShiFu123 QQ:350722326 3 | // Created by 十三哥 on 2023/5/31. 4 | // Git:https://github.com/nongshifu/PUBG_China_imGui 5 | // 6 | 7 | #import "YMUIWindow.h" 8 | #import "YMUIViewController.h" 9 | @interface YMUIWindow() 10 | @end 11 | 12 | @implementation YMUIWindow 13 | static id _sharedInstance; 14 | static dispatch_once_t _onceToken; 15 | - (instancetype)initWithFrame:(CGRect)frame 16 | { 17 | self = [super initWithFrame:frame]; 18 | if (self) { 19 | self.userInteractionEnabled = NO; 20 | self.windowLevel = UIWindowLevelStatusBar; 21 | self.clipsToBounds = YES; 22 | [self setHidden:NO]; 23 | [self setAlpha:1.0]; 24 | [self setBackgroundColor:[UIColor clearColor]]; 25 | self.rootViewController=[YMUIViewController sharedInstance]; 26 | 27 | } 28 | return self; 29 | } 30 | 31 | 32 | - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event 33 | { 34 | UIView *view = [super hitTest:point withEvent:event]; 35 | if (view == self.rootViewController.view) { 36 | return nil; 37 | } 38 | 39 | return view; 40 | } 41 | 42 | 43 | - (BOOL)_ignoresHitTest { 44 | 45 | return YES; 46 | 47 | } 48 | + (BOOL)_isSecure 49 | { 50 | return YES; 51 | } 52 | 53 | + (instancetype)sharedInstance 54 | { 55 | dispatch_once(&_onceToken, ^{ 56 | _sharedInstance = [[self alloc] initWithFrame:[UIScreen mainScreen].bounds]; 57 | }); 58 | return _sharedInstance; 59 | } 60 | 61 | 62 | 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /Bsphp/bsphp/MF_Base64Additions.h: -------------------------------------------------------------------------------- 1 | // 2 | // MF_Base64Additions.h 3 | // Base64 -- RFC 4648 compatible implementation 4 | // see http://www.ietf.org/rfc/rfc4648.txt for more details 5 | // 6 | // Designed to be compiled with Automatic Reference Counting 7 | // 8 | // Created by Dave Poirier on 2012-06-14. 9 | // Public Domain 10 | // Hosted at https://github.com/ekscrypto/Base64 11 | // 12 | 13 | #import 14 | 15 | @interface NSString (Base64Addition) 16 | +(NSString *)__attribute__((optnone))stringFromBase64String:(NSString *)base64String; 17 | +(NSString *)__attribute__((optnone))stringFromBase64UrlEncodedString:(NSString *)base64UrlEncodedString; 18 | -(NSString *)__attribute__((optnone))base64String; 19 | -(NSString *)__attribute__((optnone))base64UrlEncodedString; 20 | @end 21 | 22 | @interface NSData (Base64Addition) 23 | +(NSData *)__attribute__((optnone))dataWithBase64String:(NSString *)base64String; 24 | +(NSData *)__attribute__((optnone))dataWithBase64UrlEncodedString:(NSString *)base64UrlEncodedString; 25 | -(NSString *)__attribute__((optnone))base64String; 26 | -(NSString *)__attribute__((optnone))base64UrlEncodedString; 27 | @end 28 | 29 | @interface MF_Base64Codec : NSObject 30 | +(NSData *)__attribute__((optnone))dataFromBase64String:(NSString *)base64String; 31 | +(NSString *)__attribute__((optnone))base64StringFromData:(NSData *)data; 32 | +(NSString *)__attribute__((optnone))base64UrlEncodedStringFromBase64String:(NSString *)base64String; 33 | +(NSString *)__attribute__((optnone))base64StringFromBase64UrlEncodedString:(NSString *)base64UrlEncodedString; 34 | @end 35 | -------------------------------------------------------------------------------- /shisangeIMGUI.framework/Headers/imgui_impl_metal.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer Backend for Metal 2 | // This needs to be used along with a Platform Backend (e.g. OSX) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'MTLTexture' as ImTextureID. Read the FAQ about ImTextureID! 6 | // [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices. 7 | 8 | // You can copy and use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 9 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 10 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 11 | 12 | #include "imgui.h" // IMGUI_IMPL_API 13 | 14 | @class MTLRenderPassDescriptor; 15 | @protocol MTLDevice, MTLCommandBuffer, MTLRenderCommandEncoder; 16 | 17 | IMGUI_IMPL_API bool ImGui_ImplMetal_Init(id device); 18 | IMGUI_IMPL_API void ImGui_ImplMetal_Shutdown(); 19 | IMGUI_IMPL_API void ImGui_ImplMetal_NewFrame(MTLRenderPassDescriptor* renderPassDescriptor); 20 | IMGUI_IMPL_API void ImGui_ImplMetal_RenderDrawData(ImDrawData* draw_data, 21 | id commandBuffer, 22 | id commandEncoder); 23 | 24 | // Called by Init/NewFrame/Shutdown 25 | IMGUI_IMPL_API bool ImGui_ImplMetal_CreateFontsTexture(id device); 26 | IMGUI_IMPL_API void ImGui_ImplMetal_DestroyFontsTexture(); 27 | IMGUI_IMPL_API bool ImGui_ImplMetal_CreateDeviceObjects(id device); 28 | IMGUI_IMPL_API void ImGui_ImplMetal_DestroyDeviceObjects(); 29 | -------------------------------------------------------------------------------- /Bsphp/AFNetworking/AFNetworking.h: -------------------------------------------------------------------------------- 1 | // AFNetworking.h 2 | // 3 | // Copyright (c) 2013 AFNetworking (http://afnetworking.com/) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import 24 | #import 25 | #import 26 | 27 | #ifndef _AFNETWORKING_ 28 | #define _AFNETWORKING_ 29 | 30 | #import "AFURLRequestSerialization.h" 31 | #import "AFURLResponseSerialization.h" 32 | #import "AFSecurityPolicy.h" 33 | 34 | #if !TARGET_OS_WATCH 35 | #import "AFNetworkReachabilityManager.h" 36 | #endif 37 | 38 | #import "AFURLSessionManager.h" 39 | #import "AFHTTPSessionManager.h" 40 | 41 | #endif /* _AFNETWORKING_ */ 42 | -------------------------------------------------------------------------------- /PUBG/PUBGTypeHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // WX:NongShiFu123 QQ:350722326 3 | // Created by 十三哥 on 2023/5/31. 4 | // Git:https://github.com/nongshifu/PUBG_China_imGui 5 | // 6 | 7 | #ifndef PUBGTypeHeader_h 8 | #define PUBGTypeHeader_h 9 | 10 | typedef struct GameInfo { 11 | NSString *name; 12 | pid_t pid; 13 | mach_port_t task; 14 | uintptr_t base; 15 | int wztime; 16 | } GameInfo; 17 | 18 | typedef struct FVector2D { 19 | int X; 20 | int Y; 21 | } FVector2D; 22 | 23 | typedef struct FVector3D { 24 | float X; 25 | float Y; 26 | float Z; 27 | } FVector3D; 28 | 29 | typedef struct FVector4D { 30 | float X; 31 | float Y; 32 | float Z; 33 | float W; 34 | } FVector4D; 35 | 36 | typedef struct FVectorRect { 37 | float X; 38 | float Y; 39 | float W; 40 | float H; 41 | } FVectorRect; 42 | 43 | typedef struct FRotator { 44 | float Pitch; 45 | float Yaw; 46 | float Roll; 47 | } FRotator; 48 | 49 | typedef struct FMinimalViewInfo { 50 | FVector3D Location; 51 | FVector3D LocationLocalSpace; 52 | FRotator Rotation; 53 | float FOV; 54 | } FMinimalViewInfo; 55 | 56 | typedef struct FCameraCacheEntry { 57 | float TimeStamp; 58 | FMinimalViewInfo POV; 59 | } FCameraCacheEntry; 60 | 61 | typedef struct D3DXMATRIX { 62 | float _11, _12, _13, _14; 63 | float _21, _22, _23, _24; 64 | float _31, _32, _33, _34; 65 | float _41, _42, _43, _44; 66 | } D3DXMATRIX; 67 | 68 | typedef struct BonesStruct { 69 | FVector3D BonePos[22]; 70 | FVector2D DrawPos[22]; 71 | bool Visibles[22]; 72 | bool Visible; 73 | } BonesStruct; 74 | 75 | typedef struct FTransform { 76 | FVector4D Rotation; 77 | FVector3D Translation; 78 | FVector3D Scale3D; 79 | } FTransform; 80 | //物资 81 | typedef struct { 82 | NSString *className; 83 | uintptr_t player; 84 | } Wuzhi; 85 | 86 | #endif /* PUBGTypeHeader_h */ 87 | -------------------------------------------------------------------------------- /PUBG/ShiSanGeGetGame.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import 4 | #import "PUBGTypeHeader.h" 5 | 6 | bool getGame(const char *processName); 7 | typedef void (^PUBGBlock)(NSArray *playerArray,NSArray *wzArray); 8 | 9 | @interface ShiSanGeGetGame : NSObject 10 | //物资距离 11 | @property (nonatomic, assign) float JuLi; 12 | //物资2D坐标系 13 | @property (nonatomic, assign) FVector2D WuZhi2D; 14 | //物资 15 | @property (nonatomic, assign) uint64_t Player; 16 | //物资模型名字 17 | @property (nonatomic, assign) std::string Name; 18 | 19 | + (instancetype)sharedInstance; 20 | - (void)CacheData; 21 | - (void)getData:(PUBGBlock)block; 22 | @end 23 | 24 | 25 | 26 | @interface PUBGPlayermodel : NSObject 27 | // 编号 28 | @property (nonatomic, assign) int TeamID; 29 | @property (nonatomic, assign) int chiqiang; 30 | // 名称 31 | @property (nonatomic, assign) std::string PlayerName; 32 | // 距离 33 | @property (nonatomic, assign) CGFloat Distance; 34 | // 血量 35 | @property (nonatomic, assign) CGFloat Health; 36 | // 方框 37 | @property (nonatomic, assign) FVectorRect rect; 38 | //持枪 39 | @property (nonatomic, assign) NSString * WeaponName; 40 | // AI,1是人机,0是真人 41 | @property (nonatomic, assign) BOOL isAI; 42 | // 屏幕内外 YES 内 NO 外 43 | @property (nonatomic, assign) BOOL isPm; 44 | // 骨架 45 | @property (nonatomic, assign) FVector2D _0; 46 | @property (nonatomic, assign) FVector2D _1; 47 | @property (nonatomic, assign) FVector2D _2; 48 | @property (nonatomic, assign) FVector2D _3; 49 | @property (nonatomic, assign) FVector2D _4; 50 | @property (nonatomic, assign) FVector2D _5; 51 | @property (nonatomic, assign) FVector2D _6; 52 | @property (nonatomic, assign) FVector2D _7; 53 | @property (nonatomic, assign) FVector2D _8; 54 | @property (nonatomic, assign) FVector2D _9; 55 | @property (nonatomic, assign) FVector2D _10; 56 | @property (nonatomic, assign) FVector2D _11; 57 | @property (nonatomic, assign) FVector2D _12; 58 | @property (nonatomic, assign) FVector2D _13; 59 | @property (nonatomic, assign) FVector2D _14; 60 | @property (nonatomic, assign) FVector2D _15; 61 | @property (nonatomic, assign) FVector2D _16; 62 | @property (nonatomic, assign) FVector2D _17; 63 | @end 64 | -------------------------------------------------------------------------------- /PUBG/PUBGDataModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // WX:NongShiFu123 QQ:350722326 3 | // Created by 十三哥 on 2023/5/31. 4 | // Git:https://github.com/nongshifu/PUBG_China_imGui 5 | // 6 | 7 | #import 8 | #import "PUBGTypeHeader.h" 9 | #import 10 | #include 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface PUBGPlayerWZ : NSObject 14 | //物资距离 15 | @property (nonatomic, assign) float JuLi; 16 | //物资2D坐标系 17 | @property (nonatomic, assign) FVector2D WuZhi2D; 18 | //物资 19 | @property (nonatomic, assign) uintptr_t Player; 20 | //物资模型名字 21 | @property (nonatomic, assign) NSString * Name; 22 | //分类 23 | @property (nonatomic, assign) int Fenlei; 24 | @end 25 | 26 | 27 | 28 | @interface PUBGPlayerModel : NSObject 29 | // 编号 30 | @property (nonatomic, assign) int TeamID; 31 | @property (nonatomic, assign) int chiqiang; 32 | // 名称 33 | @property (nonatomic, assign) NSString *PlayerName; 34 | // 距离 35 | @property (nonatomic, assign) CGFloat Distance; 36 | // 血量 37 | @property (nonatomic, assign) CGFloat Health; 38 | // 方框 39 | @property (nonatomic, assign) FVectorRect rect; 40 | //持枪 41 | @property (nonatomic, assign) NSString * WeaponName; 42 | // AI,1是人机,0是真人 43 | @property (nonatomic, assign) BOOL isAI; 44 | // 屏幕内外 YES 内 NO 外 45 | @property (nonatomic, assign) BOOL isPm; 46 | // 骨架 47 | @property (nonatomic, assign) FVector2D _0; 48 | @property (nonatomic, assign) FVector2D _1; 49 | @property (nonatomic, assign) FVector2D _2; 50 | @property (nonatomic, assign) FVector2D _3; 51 | @property (nonatomic, assign) FVector2D _4; 52 | @property (nonatomic, assign) FVector2D _5; 53 | @property (nonatomic, assign) FVector2D _6; 54 | @property (nonatomic, assign) FVector2D _7; 55 | @property (nonatomic, assign) FVector2D _8; 56 | @property (nonatomic, assign) FVector2D _9; 57 | @property (nonatomic, assign) FVector2D _10; 58 | @property (nonatomic, assign) FVector2D _11; 59 | @property (nonatomic, assign) FVector2D _12; 60 | @property (nonatomic, assign) FVector2D _13; 61 | @property (nonatomic, assign) FVector2D _14; 62 | @property (nonatomic, assign) FVector2D _15; 63 | @property (nonatomic, assign) FVector2D _16; 64 | @property (nonatomic, assign) FVector2D _17; 65 | @end 66 | 67 | NS_ASSUME_NONNULL_END 68 | -------------------------------------------------------------------------------- /UIMem/NSTask.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSTask.h 3 | // MemSearchTest 4 | // 5 | // Created by 李良林 on 2020/11/21. 6 | // Copyright © 2020 李良林. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class NSString, NSArray, NSDictionary; 12 | 13 | @interface NSTask : NSObject 14 | 15 | // Create an NSTask which can be run at a later time 16 | // An NSTask can only be run once. Subsequent attempts to 17 | // run an NSTask will raise. 18 | // Upon task death a notification will be sent 19 | // { Name = NSTaskDidTerminateNotification; object = task; } 20 | // 21 | 22 | - (instancetype)init; 23 | 24 | // set parameters 25 | // these methods can only be done before a launch 26 | // if not set, use current 27 | // if not set, use current 28 | 29 | // set standard I/O channels; may be either an NSFileHandle or an NSPipe 30 | - (void)setStandardInput:(id)input; 31 | - (void)setStandardOutput:(id)output; 32 | - (void)setStandardError:(id)error; 33 | 34 | // get parameters 35 | @property (NS_NONATOMIC_IOSONLY, copy) NSString *launchPath; 36 | @property (NS_NONATOMIC_IOSONLY, copy) NSArray *arguments; 37 | @property (NS_NONATOMIC_IOSONLY, copy) NSDictionary *environment; 38 | @property (NS_NONATOMIC_IOSONLY, copy) NSString *currentDirectoryPath; 39 | 40 | // get standard I/O channels; could be either an NSFileHandle or an NSPipe 41 | - (id)standardInput; 42 | - (id)standardOutput; 43 | - (id)standardError; 44 | 45 | // actions 46 | - (void)launch; 47 | 48 | - (void)interrupt; // Not always possible. Sends SIGINT. 49 | - (void)terminate; // Not always possible. Sends SIGTERM. 50 | 51 | @property (NS_NONATOMIC_IOSONLY, readonly) BOOL suspend; 52 | @property (NS_NONATOMIC_IOSONLY, readonly) BOOL resume; 53 | 54 | // status 55 | @property (NS_NONATOMIC_IOSONLY, readonly) int processIdentifier; 56 | @property (NS_NONATOMIC_IOSONLY, getter=isRunning, readonly) BOOL running; 57 | 58 | @property (NS_NONATOMIC_IOSONLY, readonly) int terminationStatus; 59 | 60 | @end 61 | 62 | @interface NSTask (NSTaskConveniences) 63 | 64 | + (NSTask *)launchedTaskWithLaunchPath:(NSString *)path arguments:(NSArray *)arguments; 65 | // convenience; create and launch 66 | 67 | - (void)waitUntilExit; 68 | // poll the runLoop in defaultMode until task completes 69 | 70 | @end 71 | 72 | FOUNDATION_EXPORT NSString * const NSTaskDidTerminateNotification; 73 | -------------------------------------------------------------------------------- /Bsphp/Config.h: -------------------------------------------------------------------------------- 1 | // 2 | // WX:NongShiFu123 QQ:350722326 3 | // Created by 十三哥 on 2023/5/31. 4 | // Git:https://github.com/nongshifu/PUBG_China_imGui 5 | // 6 | #import 7 | 8 | //全局服务器地址 9 | #define BSPHP_HOST @"https://myradar.cn/AppEn.php?appid=467645342&m=9e8ac707e317651e741a5131be49df7d" 10 | //通信key 11 | #define BSPHP_MUTUALKEY @"7c316f815214a1f86a18e62394528414" 12 | //数据加密密码 13 | #define BSPHP_PASSWORD @"6IrQ34YSce9hrFb2X1" 14 | //接收Sgin验证 注意必须填写 并且有[KEY] 15 | #define BSPHP_INSGIN @"[KEY]RHHGFGSNGRG" 16 | //输出Sgin验证 注意必须填写 并且有[KEY] 17 | #define BSPHP_TOSGIN @"[KEY]RHHGFGSNGRG" 18 | //版本 和软件配置版本号一致 发布新版的时候 修改软件配置的版本号并且在URL那填写下载地址即可 客户端会弹出更新 确定会跳转浏览器下载 19 | #define JN_VERSION @"v1.0" 20 | 21 | //加密秘钥 这个在服务器文件后台 网站目录/include/applibapi/encryption下的bsphp_3des_vi.php 里面保持一致 搜索bsphp666就有3处地方都改掉 和这里源码一致 22 | #define gIv @"NongShiF" 23 | //多少秒定时验证 24 | #define BS_DSQ 600 25 | 26 | //软件高级选项-接收封包加密:返回封包加密 都选择baphp_3des_vi 数据输出格式选择bsphp_json 27 | 28 | /*以下5个 参数 填写在BSPHP后台对应的软件设置-软件描述处 每个功能一个换行 切记 参数为BOOL 值 YES 或NO 大写 顺序不能错源码写死了 29 | 到期时间弹窗:YES 30 | 验证udid还是idfa:YES 31 | 验证版本更新:YES 32 | 过直播:YES 33 | 验证机器码是否是000:YES 34 | */ 35 | 36 | /*参数说明-详情可以看图片 说明.png 37 | 到期时间弹窗:YES 设置YES每次启动都提示到期时间,设置NO 仅首次激活有提示 到期会有提示 正常使用期间不会提示 38 | 验证udid还是idfa:YES 设置YES获取描述文件获取UDID ,设置NO 获取IDFA 无需描述文件 39 | 验证版本更新:YES 设YES验证BS软件配置里面的版本号和上面JN_VERSION处是否一致 不一致就弹出URL 去浏览器下载同时app闪退 强制更新 弹出的URL更新地址在软件配置-URL地址 处 ,设置NO不验证 40 | 过直播:YES 设置YES 弹窗就可以过直播 版本弹窗 时间到期弹窗 公告弹窗等 都能过录屏和截图 直播 41 | 验证机器码是否是000:YES 设YES的话 上面第二个参数 验证udid还是idfa:NO 设置 为NO 仅对IDFA判断是否正常获取 系统设置-隐私-跟踪 没开启的话获取00000- 42 | */ 43 | //如果使用udid获取描述文件 需要udid.php上传到域名指定目录 44 | #define UDID_HOST @"https://ios.weiyicent.com/udid/" 45 | 46 | #define MyLog(fmt, ...) \ 47 | if (isEnabledMyLog) { \ 48 | NSLog((@"MyLog: " fmt), ##__VA_ARGS__); \ 49 | } 50 | //是否打印 51 | #define isEnabledMyLog NO 52 | 53 | @interface NetTool : NSObject 54 | 55 | /** 56 | * AFN异步发送post请求,返回原生数据 57 | * 58 | * @param appendURL 追加URL 59 | * @param param 参数字典 60 | * @param success 成功Block 61 | * @param failure 失败Block 62 | * 63 | * @return NSURLSessionDataTask任务类型 64 | */ 65 | + (NSURLSessionDataTask *)__attribute__((optnone))Post_AppendURL:(NSString *)appendURL myparameters:(NSDictionary *)param mysuccess:(void (^)(id responseObject))success myfailure:(void (^)(NSError *error))failure; 66 | @end 67 | -------------------------------------------------------------------------------- /UIMem/PubgLoad.mm: -------------------------------------------------------------------------------- 1 | // 2 | // WX:NongShiFu123 QQ:350722326 3 | // Created by 十三哥 on 2023/5/31. 4 | // Git:https://github.com/nongshifu/PUBG_China_imGui 5 | // 6 | #import 7 | #import 8 | 9 | #import "gameVV.h" 10 | #import "PubgLoad.h" 11 | #import "ImGuiMem.h" 12 | #import "QQ350722326.h" 13 | #import "ShiSnGeWindow.h" 14 | #import "YMUIWindow.h" 15 | @interface PubgLoad() 16 | 17 | @end 18 | 19 | @implementation PubgLoad 20 | 21 | static id _sharedInstance; 22 | static dispatch_once_t _onceToken; 23 | static float 初始音量; 24 | bool MenDeal; 25 | + (void)load 26 | { 27 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1* NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 28 | NSLog(@"load"); 29 | [[PubgLoad sharedInstance] jtyl]; 30 | }); 31 | } 32 | + (instancetype)sharedInstance 33 | { 34 | dispatch_once(&_onceToken, ^{ 35 | _sharedInstance = [[self alloc] init]; 36 | }); 37 | return _sharedInstance; 38 | } 39 | 40 | - (void)jtyl{ 41 | //音量 42 | AVAudioSession*audioSession = [AVAudioSession sharedInstance]; 43 | [audioSession setActive:YES error:nil]; 44 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(volumeChanged:) name:@"AVSystemController_SystemVolumeDidChangeNotification" object:nil]; 45 | NSLog(@"音量"); 46 | } 47 | - (void)volumeChanged:(NSNotification *)notification { 48 | float 最新音量 = [[[notification userInfo] objectForKey:@"AVSystemController_AudioVolumeNotificationParameter"] floatValue]; 49 | if (初始音量!=最新音量) { 50 | 初始音量=最新音量; 51 | MenDeal = !MenDeal; 52 | //读取游戏进程 存在才显示菜单 游戏关闭则隐藏菜单 53 | if (getGame()){ 54 | [self volumeChanged]; 55 | }else{ 56 | MenDeal=false; 57 | 绘制总开关=false; 58 | } 59 | 60 | } 61 | NSLog(@"Current volume: %f", 最新音量); 62 | } 63 | 64 | - (void)volumeChanged { 65 | //根据 MenDeal 的值添加新的 ImGuiMem 实例 66 | [[ImGuiMem sharedInstance] removeFromSuperview]; 67 | if (MenDeal) { 68 | [[ShiSnGeWindow sharedInstance] addSubview:[ImGuiMem sharedInstance]]; 69 | } else { 70 | [[YMUIWindow sharedInstance] addSubview:[ImGuiMem sharedInstance]]; 71 | 72 | } 73 | //跨进程注销生效 因此需要显示菜单就验证一次 防止到期 74 | [NSObject YzCode:^{ 75 | 76 | }]; 77 | } 78 | 79 | 80 | @end 81 | -------------------------------------------------------------------------------- /Bsphp/bsphp/NSString+URLCode.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+URLCode.m 3 | // LOL 4 | // 5 | // Created by 刘清 on 16/3/10. 6 | // Copyright (c) 2016年 LQ. All rights reserved. 7 | // 8 | 9 | #import "NSString+URLCode.h" 10 | #import 11 | @implementation NSString (URLCode) 12 | 13 | - (NSString *)__attribute__((optnone))URLEncodedString 14 | { 15 | /* 16 | CFURLCreateStringByAddingPercentEscapes函数是Core Foundation框架提供的C函数,可以把内容转换成URL【资源定位符】编码, 17 | 18 | */ 19 | 20 | // NSString *result = ( NSString *) 21 | // CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, 22 | // (CFStringRef)self, 23 | // NULL,//指定了将本身为非法的URL字符不进行编码的字符集合 24 | // CFSTR("!*();+$,%#[] "),//将本身为合法的URL字符需要进行编码的字符集合 25 | // kCFStringEncodingUTF8)); 26 | NSCharacterSet *allowedCharacterSet = [NSCharacterSet characterSetWithCharactersInString:@"!*();+$,%#[] "]; 27 | NSString *result = [self stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacterSet]; 28 | return result; 29 | } 30 | 31 | - (NSString*) __attribute__((optnone))URLDecodedString 32 | { 33 | // CFURLCreateStringByReplacingPercentEscapesUsingEncoding与CFURLCreateStringByAddingPercentEscapes相反,是进行URL解码 34 | // Foundation框架 35 | // NSString*ss; 36 | // [ss stringByReplacingPercentEscapesUsingEncoding:(NSStringEncoding)] 37 | 38 | // CoreFoundation框架 39 | // CFURLCreateStringByReplacingPercentEscapesUsingEncoding 40 | 41 | // NSString *result = ( NSString *) 42 | // CFBridgingRelease(CFURLCreateStringByReplacingPercentEscapesUsingEncoding(kCFAllocatorDefault, 43 | // (CFStringRef)self, 44 | // CFSTR(""),//指定不进行解码的字符集 45 | // kCFStringEncodingUTF8)); 46 | NSString *result = [self stringByRemovingPercentEncoding]; 47 | return result; 48 | } 49 | //md5 50 | - (NSString *)__attribute__((optnone)) md5:(NSString *) input { 51 | const char *cStr = [input UTF8String]; 52 | unsigned char digest[CC_MD5_DIGEST_LENGTH]; 53 | CC_MD5( cStr, (CC_LONG)strlen(cStr), digest ); // This is the md5 call 54 | 55 | NSMutableString *output = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2]; 56 | 57 | for(int i = 0; i < CC_MD5_DIGEST_LENGTH; i++) 58 | [output appendFormat:@"%02x", digest[i]]; 59 | 60 | return output; 61 | } 62 | @end 63 | -------------------------------------------------------------------------------- /Bsphp/bsphp/NSString+Tools.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Tools.m 3 | // XFSettings 4 | // 5 | // Created by apple on 14-8-21. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 8 | 9 | #import "NSString+Tools.h" 10 | 11 | @implementation NSString (Tools) 12 | 13 | //用对象的方法计算文本的大小 14 | - (CGSize)__attribute__((optnone))sizeWithFont:(UIFont*)font andMaxSize:(CGSize)size { 15 | //特殊的格式要求都写在属性字典中 16 | NSDictionary*attrs =@{NSFontAttributeName: font}; 17 | //返回一个矩形,大小等于文本绘制完占据的宽和高。 18 | return [self boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:attrs context:nil].size; 19 | } 20 | 21 | + (CGSize)__attribute__((optnone))sizeWithString:(NSString*)str andFont:(UIFont*)font andMaxSize:(CGSize)size{ 22 | NSDictionary*attrs =@{NSFontAttributeName: font}; 23 | return [str boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:attrs context:nil].size; 24 | } 25 | 26 | 27 | - (CGSize)__attribute__((optnone))sizeOfFontSize:(CGFloat)fontSize 28 | { 29 | return [self sizeOfFontSize:fontSize maxWidth:MAXFLOAT]; 30 | } 31 | - (CGSize)__attribute__((optnone))sizeOfFontSize:(CGFloat)fontSize maxWidth:(CGFloat)maxWidth 32 | { 33 | 34 | return [self boundingRectWithSize:CGSizeMake(maxWidth, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{ 35 | NSFontAttributeName : [UIFont systemFontOfSize:fontSize] 36 | } context:nil].size; 37 | 38 | } 39 | 40 | 41 | - (NSInteger)__attribute__((optnone))fileSize 42 | { 43 | NSFileManager *mgr = [NSFileManager defaultManager]; 44 | // 判断是否为文件 45 | BOOL dir = NO; 46 | BOOL exists = [mgr fileExistsAtPath:self isDirectory:&dir]; 47 | // 文件\文件夹不存在 48 | if (exists == NO) return 0; 49 | 50 | if (dir) { // self是一个文件夹 51 | // 这个方法只会遍历直接内容(一级深度内容) 52 | // [mgr contentsOfDirectoryAtPath:self error:nil]; 53 | // 遍历caches里面的所有内容 --- 直接和间接内容 54 | NSArray *subpaths = [mgr subpathsAtPath:self]; 55 | NSInteger totalByteSize = 0; 56 | for (NSString *subpath in subpaths) { 57 | // 获得全路径 58 | NSString *fullSubpath = [self stringByAppendingPathComponent:subpath]; 59 | // 判断是否为文件 60 | BOOL dir = NO; 61 | [mgr fileExistsAtPath:fullSubpath isDirectory:&dir]; 62 | if (dir == NO) { // 文件 63 | totalByteSize += [[mgr attributesOfItemAtPath:fullSubpath error:nil][NSFileSize] integerValue]; 64 | } 65 | } 66 | return totalByteSize; 67 | } else { // self是一个文件 68 | return [[mgr attributesOfItemAtPath:self error:nil][NSFileSize] integerValue]; 69 | } 70 | } 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /Bsphp/bsphp/DES3Util.m: -------------------------------------------------------------------------------- 1 | // 2 | // DES3Util.m 3 | // TestDes 4 | // 5 | // BSPHP网络验证系统 Bsphp.Com 6 | // Copyright © 2016年 Craftsman. All rights reserved. 7 | // 8 | // 9 | // DES3Util.m 10 | // 11 | #import "Config.h" 12 | #import "DES3Util.h" 13 | #import 14 | #import "MF_Base64Additions.h" 15 | 16 | @implementation DES3Util 17 | 18 | // 加密方法 19 | + (NSString*)__attribute__((optnone))encrypt:(NSString*)plainText gkey:(NSString *)gkey { 20 | NSData* data = [plainText dataUsingEncoding:NSUTF8StringEncoding]; 21 | size_t plainTextBufferSize = [data length]; 22 | const void *vplainText = (const void *)[data bytes]; 23 | 24 | CCCryptorStatus ccStatus; 25 | uint8_t *bufferPtr = NULL; 26 | size_t bufferPtrSize = 0; 27 | size_t movedBytes = 0; 28 | 29 | bufferPtrSize = (plainTextBufferSize + kCCBlockSize3DES) & ~(kCCBlockSize3DES - 1); 30 | bufferPtr = malloc( bufferPtrSize * sizeof(uint8_t)); 31 | memset((void *)bufferPtr, 0x0, bufferPtrSize); 32 | 33 | const void *vkey = (const void *) [gkey UTF8String]; 34 | const void *vinitVec = (const void *) [gIv UTF8String]; 35 | 36 | ccStatus = CCCrypt(kCCEncrypt, 37 | kCCAlgorithm3DES, 38 | kCCOptionPKCS7Padding, 39 | vkey, 40 | kCCKeySize3DES, 41 | vinitVec, 42 | vplainText, 43 | plainTextBufferSize, 44 | (void *)bufferPtr, 45 | bufferPtrSize, 46 | &movedBytes); 47 | 48 | NSData *myData = [NSData dataWithBytes:(const void *)bufferPtr length:(NSUInteger)movedBytes]; 49 | NSString *result = [myData base64String];//[GTMBase64 stringByEncodingData:myData]; 50 | return result; 51 | } 52 | 53 | // 解密方法 54 | + (NSString*)__attribute__((optnone))decrypt:(NSString*)encryptText gkey:(NSString *)gkey { 55 | //NSString *base64Str = [encryptText dataUsingEncoding:NSUTF8StringEncoding] 56 | NSData *encryptData = [NSData dataWithBase64String:encryptText];//[GTMBase64 decodeData:[encryptText dataUsingEncoding:NSUTF8StringEncoding]]; 57 | size_t plainTextBufferSize = [encryptData length]; 58 | const void *vplainText = [encryptData bytes]; 59 | 60 | CCCryptorStatus ccStatus; 61 | uint8_t *bufferPtr = NULL; 62 | size_t bufferPtrSize = 0; 63 | size_t movedBytes = 0; 64 | bufferPtrSize = (plainTextBufferSize + kCCBlockSize3DES) & ~(kCCBlockSize3DES - 1); 65 | bufferPtr = malloc( bufferPtrSize * sizeof(uint8_t)); 66 | memset((void *)bufferPtr, 0x0, bufferPtrSize); 67 | const void *vkey = (const void *) [gkey UTF8String]; 68 | const void *vinitVec = (const void *) [gIv UTF8String]; 69 | 70 | ccStatus = CCCrypt(kCCDecrypt, 71 | kCCAlgorithm3DES, 72 | kCCOptionPKCS7Padding, 73 | vkey, 74 | kCCKeySize3DES, 75 | vinitVec, 76 | vplainText, 77 | plainTextBufferSize, 78 | (void *)bufferPtr, 79 | bufferPtrSize, 80 | &movedBytes); 81 | 82 | NSString *result = [[NSString alloc] initWithData:[NSData dataWithBytes:(const void *)bufferPtr 83 | length:(NSUInteger)movedBytes] encoding:NSUTF8StringEncoding]; 84 | return result; 85 | } 86 | 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /Bsphp/bsphp/Config.m: -------------------------------------------------------------------------------- 1 | 2 | #import "NetWorkingApiClient.h" 3 | #import "Config.h" 4 | #import "DES3Util.h" 5 | #import "NSDictionary+StichingStringkeyValue.h" 6 | #import "NSString+MD5.h" 7 | #import "NSString+URLCode.h" 8 | #define MyLog(fmt, ...) \ 9 | if (isEnabledMyLog) { \ 10 | NSLog((@"MyLog: " fmt), ##__VA_ARGS__); \ 11 | } 12 | 13 | #define isEnabledMyLog NO 14 | 15 | @implementation NetTool : NSObject 16 | + (NSURLSessionDataTask *)__attribute__((optnone))Post_AppendURL:(NSString *)appendURL 17 | myparameters:(NSDictionary *)param 18 | mysuccess:(void (^)(id responseObject))success myfailure:(void (^)(NSError *error))failure{ 19 | NSMutableDictionary *parameters = [[NSMutableDictionary alloc]init]; 20 | [parameters setObject:@"ok" forKey:@"json"]; 21 | if (param != nil) { 22 | NSString *desString = [NSDictionary stitchingStringFromDictionary:param]; 23 | NSString *md5String = [BSPHP_PASSWORD md5:BSPHP_PASSWORD]; 24 | desString = [DES3Util encrypt:desString gkey:md5String]; 25 | 26 | 27 | NSString * sginstr = [BSPHP_INSGIN stringByReplacingOccurrencesOfString:@"[KEY]"withString:desString]; 28 | NSString * sginstrMD5 = [sginstr md5:sginstr]; 29 | MyLog(@"replaceStr=%@",sginstrMD5); 30 | parameters[@"sgin"] = sginstrMD5; 31 | desString = [desString URLEncodedString]; 32 | parameters[@"parameter"] = desString; 33 | } 34 | return [[NetWorkingApiClient sharedNetWorkingApiClient] POST:appendURL 35 | parameters:parameters 36 | progress:nil 37 | success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { 38 | 39 | NSString *str = [[NSString alloc]initWithData:responseObject encoding:NSUTF8StringEncoding]; 40 | NSString *md5String = [BSPHP_PASSWORD md5:BSPHP_PASSWORD]; 41 | str = [DES3Util decrypt:str gkey:md5String]; 42 | MyLog(@"请求网址 = %@",appendURL); 43 | MyLog(@"parameters = %@",parameters); 44 | MyLog(@"服务器返回数据 = %@",str); 45 | NSData * data = [str dataUsingEncoding:NSUTF8StringEncoding]; 46 | NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil]; 47 | MyLog(@"dict = %@",dict); 48 | 49 | NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil]; 50 | 51 | NSString * insginString = [NSString stringWithFormat:@"%@%@%@%@%@", json[@"response"][@"data"], json[@"response"][@"date"],json[@"response"][@"unix"],json[@"response"][@"microtime"],json[@"response"][@"appsafecode"]]; 52 | 53 | insginString = [BSPHP_TOSGIN stringByReplacingOccurrencesOfString:@"[KEY]"withString:insginString]; 54 | //本地签名 55 | md5String = [insginString md5:insginString]; 56 | NSString * sginstrMD5 = json[@"response"][@"sgin"]; 57 | if([md5String isEqualToString:sginstrMD5]){ 58 | //success(data); 59 | MyLog(@"签名验证通过\n"); 60 | 61 | }else{ 62 | MyLog(@"签名验证未通过\n"); 63 | 64 | 65 | NSData *testData = [@"-1000" dataUsingEncoding: NSUTF8StringEncoding]; 66 | data = testData; 67 | } 68 | 69 | 70 | 71 | success(data); 72 | } 73 | failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { 74 | MyLog(@"%@",error); 75 | failure(error); 76 | }]; 77 | 78 | } 79 | 80 | 81 | 82 | 83 | @end 84 | -------------------------------------------------------------------------------- /Bsphp/QQ350722326.mm: -------------------------------------------------------------------------------- 1 | // 2 | // WX:NongShiFu123 QQ:350722326 3 | // Created by 十三哥 on 2023/5/31. 4 | // Git:https://github.com/nongshifu/PUBG_China_imGui 5 | // 6 | 7 | #import "QQ350722326.h" 8 | 9 | #import 10 | #import 11 | #import "NSString+MD5.h" 12 | #import "Config.h" 13 | 14 | #include 15 | #include 16 | #import 17 | static NSTimer*timer; 18 | NSString*验证信息; 19 | NSString*到期时间; 20 | BOOL 验证状态; 21 | 22 | @implementation NSObject (checkStatus) 23 | +(void)load{ 24 | 验证信息=@""; 25 | 到期时间=@""; 26 | 验证状态=NO; 27 | } 28 | - (void)YzCode:(void (^)(void))completion 29 | { 30 | //授权码验证 31 | MyLog(@"授权码验证函数"); 32 | NSMutableDictionary *param = [NSMutableDictionary dictionary]; 33 | param[@"api"] = @"login.ic"; 34 | NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init]; 35 | dateFormatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"zh_Hans_CN"]; 36 | dateFormatter.calendar = [[NSCalendar alloc]initWithCalendarIdentifier:NSCalendarIdentifierISO8601]; 37 | [dateFormatter setDateFormat:@"yyyy-MM-dd#HH:mm:ss"]; 38 | NSString *dateStr = [dateFormatter stringFromDate:[NSDate date]]; 39 | param[@"BSphpSeSsL"] = [dateStr MD5Digest]; 40 | 41 | NSString *nowDateStr = [dateStr stringByReplacingOccurrencesOfString:@"#" withString:@" "]; 42 | param[@"date"] = nowDateStr; 43 | param[@"md5"] = @""; 44 | param[@"mutualkey"] = BSPHP_MUTUALKEY; 45 | param[@"icid"] =[[NSUserDefaults standardUserDefaults]objectForKey:@"km"]; 46 | param[@"icpwd"] = @""; 47 | param[@"key"] = [self getUDID]; 48 | param[@"maxoror"] = [self getUDID]; 49 | [NetTool Post_AppendURL:BSPHP_HOST myparameters:param mysuccess:^(id responseObject) 50 | { 51 | NSError*error; 52 | NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:&error]; 53 | MyLog(@"dicterror=%@",error); 54 | if (dict) 55 | { 56 | NSString *dataString = dict[@"response"][@"data"]; 57 | NSRange range = [dataString rangeOfString:@"|1081|"]; 58 | if (range.location != NSNotFound) 59 | { 60 | NSArray *arr = [dataString componentsSeparatedByString:@"|"]; 61 | if (arr.count >= 6) 62 | { 63 | MyLog(@"验证成功"); 64 | if(![dataString containsString:[NSObject getUDID]]){ 65 | 验证信息=@"授权错误,机器码不正确\n联系管理员解绑或更换卡密"; 66 | 验证状态=NO; 67 | if(completion){ 68 | completion(); 69 | } 70 | }else{ 71 | 72 | 到期时间 = [NSString stringWithFormat:@"%@",arr[4]]; 73 | 验证信息=[NSString stringWithFormat:@"验证成功 到期时间:%@",arr[4]]; 74 | MyLog(@"验证成功=%@",arr[4]); 75 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 76 | 验证状态=YES; 77 | }); 78 | if(completion){ 79 | completion(); 80 | } 81 | } 82 | } 83 | } 84 | else 85 | { 86 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 87 | 88 | 验证信息= dict[@"response"][@"data"];; 89 | MyLog(@"验证失败=%@",验证信息); 90 | 验证状态=NO; 91 | if(completion){ 92 | completion(); 93 | } 94 | }); 95 | 96 | 97 | } 98 | }else{ 99 | 验证信息= dict[@"response"][@"data"];; 100 | 验证状态=NO; 101 | if(completion){ 102 | completion(); 103 | } 104 | } 105 | } myfailure:^(NSError *error) 106 | { 107 | 验证信息= [NSString stringWithFormat:@"error=%@",error]; 108 | 验证状态=NO; 109 | if(completion){ 110 | completion(); 111 | } 112 | }]; 113 | 114 | 115 | } 116 | -(NSString*)getUDID{ 117 | MyLog(@"getUDID函数"); 118 | NSString* UDID; 119 | static CFStringRef (*$MGCopyAnswer)(CFStringRef); 120 | void *gestalt = dlopen("/usr/lib/libMobileGestalt.dylib", RTLD_GLOBAL | RTLD_LAZY); 121 | $MGCopyAnswer = reinterpret_cast(dlsym(gestalt, "MGCopyAnswer")); 122 | UDID=(__bridge NSString *)$MGCopyAnswer(CFSTR("SerialNumber")); 123 | MyLog(@"getUDID函数==%@",UDID); 124 | return UDID; 125 | } 126 | 127 | @end 128 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /Bsphp/AFNetworking/AFSecurityPolicy.h: -------------------------------------------------------------------------------- 1 | // AFSecurityPolicy.h 2 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import 23 | #import 24 | 25 | typedef NS_ENUM(NSUInteger, AFSSLPinningMode) { 26 | AFSSLPinningModeNone, 27 | AFSSLPinningModePublicKey, 28 | AFSSLPinningModeCertificate, 29 | }; 30 | 31 | /** 32 | `AFSecurityPolicy` evaluates server trust against pinned X.509 certificates and public keys over secure connections. 33 | 34 | Adding pinned SSL certificates to your app helps prevent man-in-the-middle attacks and other vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged to route all communication over an HTTPS connection with SSL pinning configured and enabled. 35 | */ 36 | 37 | NS_ASSUME_NONNULL_BEGIN 38 | 39 | @interface AFSecurityPolicy : NSObject 40 | 41 | /** 42 | The criteria by which server trust should be evaluated against the pinned SSL certificates. Defaults to `AFSSLPinningModeNone`. 43 | */ 44 | @property (readonly, nonatomic, assign) AFSSLPinningMode SSLPinningMode; 45 | 46 | /** 47 | The certificates used to evaluate server trust according to the SSL pinning mode. 48 | 49 | By default, this property is set to any (`.cer`) certificates included in the target compiling AFNetworking. Note that if you are using AFNetworking as embedded framework, no certificates will be pinned by default. Use `certificatesInBundle` to load certificates from your target, and then create a new policy by calling `policyWithPinningMode:withPinnedCertificates`. 50 | 51 | Note that if pinning is enabled, `evaluateServerTrust:forDomain:` will return true if any pinned certificate matches. 52 | */ 53 | @property (nonatomic, strong, nullable) NSSet *pinnedCertificates; 54 | 55 | /** 56 | Whether or not to trust servers with an invalid or expired SSL certificates. Defaults to `NO`. 57 | */ 58 | @property (nonatomic, assign) BOOL allowInvalidCertificates; 59 | 60 | /** 61 | Whether or not to validate the domain name in the certificate's CN field. Defaults to `YES`. 62 | */ 63 | @property (nonatomic, assign) BOOL validatesDomainName; 64 | 65 | ///----------------------------------------- 66 | /// @name Getting Certificates from the Bundle 67 | ///----------------------------------------- 68 | 69 | /** 70 | Returns any certificates included in the bundle. If you are using AFNetworking as an embedded framework, you must use this method to find the certificates you have included in your app bundle, and use them when creating your security policy by calling `policyWithPinningMode:withPinnedCertificates`. 71 | 72 | @return The certificates included in the given bundle. 73 | */ 74 | + (NSSet *)__attribute__((optnone))certificatesInBundle:(NSBundle *)bundle; 75 | 76 | ///----------------------------------------- 77 | /// @name Getting Specific Security Policies 78 | ///----------------------------------------- 79 | 80 | /** 81 | Returns the shared default security policy, which does not allow invalid certificates, validates domain name, and does not validate against pinned certificates or public keys. 82 | 83 | @return The default security policy. 84 | */ 85 | + (instancetype)__attribute__((optnone))defaultPolicy; 86 | 87 | ///--------------------- 88 | /// @name Initialization 89 | ///--------------------- 90 | 91 | /** 92 | Creates and returns a security policy with the specified pinning mode. 93 | 94 | @param pinningMode The SSL pinning mode. 95 | 96 | @return A new security policy. 97 | */ 98 | + (instancetype)__attribute__((optnone))policyWithPinningMode:(AFSSLPinningMode)pinningMode; 99 | 100 | /** 101 | Creates and returns a security policy with the specified pinning mode. 102 | 103 | @param pinningMode The SSL pinning mode. 104 | @param pinnedCertificates The certificates to pin against. 105 | 106 | @return A new security policy. 107 | */ 108 | + (instancetype)__attribute__((optnone))policyWithPinningMode:(AFSSLPinningMode)pinningMode withPinnedCertificates:(NSSet *)pinnedCertificates; 109 | 110 | ///------------------------------ 111 | /// @name Evaluating Server Trust 112 | ///------------------------------ 113 | 114 | /** 115 | Whether or not the specified server trust should be accepted, based on the security policy. 116 | 117 | This method should be used when responding to an authentication challenge from a server. 118 | 119 | @param serverTrust The X.509 certificate trust of the server. 120 | @param domain The domain of serverTrust. If `nil`, the domain will not be validated. 121 | 122 | @return Whether or not to trust the server. 123 | */ 124 | - (BOOL)__attribute__((optnone))evaluateServerTrust:(SecTrustRef)serverTrust 125 | forDomain:(nullable NSString *)domain; 126 | 127 | @end 128 | 129 | NS_ASSUME_NONNULL_END 130 | 131 | ///---------------- 132 | /// @name Constants 133 | ///---------------- 134 | 135 | /** 136 | ## SSL Pinning Modes 137 | 138 | The following constants are provided by `AFSSLPinningMode` as possible SSL pinning modes. 139 | 140 | enum { 141 | AFSSLPinningModeNone, 142 | AFSSLPinningModePublicKey, 143 | AFSSLPinningModeCertificate, 144 | } 145 | 146 | `AFSSLPinningModeNone` 147 | Do not used pinned certificates to validate servers. 148 | 149 | `AFSSLPinningModePublicKey` 150 | Validate host certificates against public keys of pinned certificates. 151 | 152 | `AFSSLPinningModeCertificate` 153 | Validate host certificates against pinned certificates. 154 | */ 155 | -------------------------------------------------------------------------------- /shisangeIMGUI.framework/Headers/imconfig.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // COMPILE-TIME OPTIONS FOR DEAR IMGUI 3 | // Runtime options (clipboard callbacks, enabling various features, etc.) can generally be set via the ImGuiIO structure. 4 | // You can use ImGui::SetAllocatorFunctions() before calling ImGui::CreateContext() to rewire memory allocation functions. 5 | //----------------------------------------------------------------------------- 6 | // A) You may edit imconfig.h (and not overwrite it when updating Dear ImGui, or maintain a patch/rebased branch with your modifications to it) 7 | // B) or '#define IMGUI_USER_CONFIG "my_imgui_config.h"' in your project and then add directives in your own file without touching this template. 8 | //----------------------------------------------------------------------------- 9 | // You need to make sure that configuration settings are defined consistently _everywhere_ Dear ImGui is used, which include the imgui*.cpp 10 | // files but also _any_ of your code that uses Dear ImGui. This is because some compile-time options have an affect on data structures. 11 | // Defining those options in imconfig.h will ensure every compilation unit gets to see the same data structure layouts. 12 | // Call IMGUI_CHECKVERSION() from your .cpp files to verify that the data structures your files are using are matching the ones imgui.cpp is using. 13 | //----------------------------------------------------------------------------- 14 | 15 | #pragma once 16 | 17 | //---- Define assertion handler. Defaults to calling assert(). 18 | // If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement. 19 | //#define IM_ASSERT(_EXPR) MyAssert(_EXPR) 20 | //#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts 21 | 22 | //---- Define attributes of all API symbols declarations, e.g. for DLL under Windows 23 | // Using Dear ImGui via a shared library is not recommended, because of function call overhead and because we don't guarantee backward nor forward ABI compatibility. 24 | // DLL users: heaps and globals are not shared across DLL boundaries! You will need to call SetCurrentContext() + SetAllocatorFunctions() 25 | // for each static/DLL boundary you are calling from. Read "Context and Memory Allocators" section of imgui.cpp for more details. 26 | //#define IMGUI_API __declspec( dllexport ) 27 | //#define IMGUI_API __declspec( dllimport ) 28 | 29 | //---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names. 30 | //#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS 31 | 32 | //---- Disable all of Dear ImGui or don't implement standard windows. 33 | // It is very strongly recommended to NOT disable the demo windows during development. Please read comments in imgui_demo.cpp. 34 | //#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty. 35 | //#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. Not recommended. 36 | //#define IMGUI_DISABLE_METRICS_WINDOW // Disable metrics/debugger window: ShowMetricsWindow() will be empty. 37 | 38 | //---- Don't implement some functions to reduce linkage requirements. 39 | //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. (user32.lib/.a, kernel32.lib/.a) 40 | //#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] Don't implement default IME handler. Won't use and link with ImmGetContext/ImmSetCompositionWindow. (imm32.lib/.a) 41 | //#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function (clipboard, ime). 42 | //#define IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS // [OSX] Implement default OSX clipboard handler (need to link with '-framework ApplicationServices', this is why this is not the default). 43 | //#define IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself (e.g. if you don't want to link with vsnprintf) 44 | //#define IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 so you can implement them yourself. 45 | //#define IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite so you can implement them yourself if you don't want to link with fopen/fclose/fread/fwrite. This will also disable the LogToTTY() function. 46 | //#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions(). 47 | 48 | //---- Include imgui_user.h at the end of imgui.h as a convenience 49 | //#define IMGUI_INCLUDE_IMGUI_USER_H 50 | 51 | //---- Pack colors to BGRA8 instead of RGBA8 (to avoid converting from one to another) 52 | //#define IMGUI_USE_BGRA_PACKED_COLOR 53 | 54 | //---- Use 32-bit for ImWchar (default is 16-bit) to support unicode planes 1-16. (e.g. point beyond 0xFFFF like emoticons, dingbats, symbols, shapes, ancient languages, etc...) 55 | //#define IMGUI_USE_WCHAR32 56 | 57 | //---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version 58 | // By default the embedded implementations are declared static and not available outside of Dear ImGui sources files. 59 | //#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h" 60 | //#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h" 61 | //#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION 62 | //#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION 63 | 64 | //---- Use stb_printf's faster implementation of vsnprintf instead of the one from libc (unless IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS is defined) 65 | // Requires 'stb_sprintf.h' to be available in the include path. Compatibility checks of arguments and formats done by clang and GCC will be disabled in order to support the extra formats provided by STB sprintf. 66 | // #define IMGUI_USE_STB_SPRINTF 67 | 68 | //---- Use FreeType to build and rasterize the font atlas (instead of stb_truetype which is embedded by default in Dear ImGui) 69 | // Requires FreeType headers to be available in the include path. Requires program to be compiled with 'misc/freetype/imgui_freetype.cpp' (in this repository) + the FreeType library (not provided). 70 | // On Windows you may use vcpkg with 'vcpkg install freetype' + 'vcpkg integrate install'. 71 | //#define IMGUI_ENABLE_FREETYPE 72 | 73 | //---- Use stb_truetype to build and rasterize the font atlas (default) 74 | // The only purpose of this define is if you want force compilation of the stb_truetype backend ALONG with the FreeType backend. 75 | //#define IMGUI_ENABLE_STB_TRUETYPE 76 | 77 | //---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4. 78 | // This will be inlined as part of ImVec2 and ImVec4 class declarations. 79 | /* 80 | #define IM_VEC2_CLASS_EXTRA \ 81 | ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \ 82 | operator MyVec2() const { return MyVec2(x,y); } 83 | 84 | #define IM_VEC4_CLASS_EXTRA \ 85 | ImVec4(const MyVec4& f) { x = f.x; y = f.y; z = f.z; w = f.w; } \ 86 | operator MyVec4() const { return MyVec4(x,y,z,w); } 87 | */ 88 | 89 | //---- Use 32-bit vertex indices (default is 16-bit) is one way to allow large meshes with more than 64K vertices. 90 | // Your renderer backend will need to support it (most example renderer backends support both 16/32-bit indices). 91 | // Another way to allow large meshes while keeping 16-bit indices is to handle ImDrawCmd::VtxOffset in your renderer. 92 | // Read about ImGuiBackendFlags_RendererHasVtxOffset for details. 93 | //#define ImDrawIdx unsigned int 94 | 95 | //---- Override ImDrawCallback signature (will need to modify renderer backends accordingly) 96 | //struct ImDrawList; 97 | //struct ImDrawCmd; 98 | //typedef void (*MyImDrawCallback)(const ImDrawList* draw_list, const ImDrawCmd* cmd, void* my_renderer_user_data); 99 | //#define ImDrawCallback MyImDrawCallback 100 | 101 | //---- Debug Tools: Macro to break in Debugger 102 | // (use 'Metrics->Tools->Item Picker' to pick widgets with the mouse and break into them for easy debugging.) 103 | //#define IM_DEBUG_BREAK IM_ASSERT(0) 104 | //#define IM_DEBUG_BREAK __debugbreak() 105 | 106 | //---- Debug Tools: Have the Item Picker break in the ItemAdd() function instead of ItemHoverable(), 107 | // (which comes earlier in the code, will catch a few extra items, allow picking items other than Hovered one.) 108 | // This adds a small runtime cost which is why it is not enabled by default. 109 | //#define IMGUI_DEBUG_TOOL_ITEM_PICKER_EX 110 | 111 | //---- Debug Tools: Enable slower asserts 112 | //#define IMGUI_DEBUG_PARANOID 113 | 114 | //---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files. 115 | /* 116 | namespace ImGui 117 | { 118 | void MyFunction(const char* name, const MyMatrix44& v); 119 | } 120 | */ 121 | -------------------------------------------------------------------------------- /Bsphp/AFNetworking/AFNetworkReachabilityManager.h: -------------------------------------------------------------------------------- 1 | // AFNetworkReachabilityManager.h 2 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import 23 | 24 | #if !TARGET_OS_WATCH 25 | #import 26 | 27 | typedef NS_ENUM(NSInteger, AFNetworkReachabilityStatus) { 28 | AFNetworkReachabilityStatusUnknown = -1, 29 | AFNetworkReachabilityStatusNotReachable = 0, 30 | AFNetworkReachabilityStatusReachableViaWWAN = 1, 31 | AFNetworkReachabilityStatusReachableViaWiFi = 2, 32 | }; 33 | 34 | NS_ASSUME_NONNULL_BEGIN 35 | 36 | /** 37 | `AFNetworkReachabilityManager` monitors the reachability of domains, and addresses for both WWAN and WiFi network interfaces. 38 | 39 | Reachability can be used to determine background information about why a network operation failed, or to trigger a network operation retrying when a connection is established. It should not be used to prevent a user from initiating a network request, as it's possible that an initial request may be required to establish reachability. 40 | 41 | See Apple's Reachability Sample Code ( https://developer.apple.com/library/ios/samplecode/reachability/ ) 42 | 43 | @warning Instances of `AFNetworkReachabilityManager` must be started with `-startMonitoring` before reachability status can be determined. 44 | */ 45 | @interface AFNetworkReachabilityManager : NSObject 46 | 47 | /** 48 | The current network reachability status. 49 | */ 50 | @property (readonly, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus; 51 | 52 | /** 53 | Whether or not the network is currently reachable. 54 | */ 55 | @property (readonly, nonatomic, assign, getter = isReachable) BOOL reachable; 56 | 57 | /** 58 | Whether or not the network is currently reachable via WWAN. 59 | */ 60 | @property (readonly, nonatomic, assign, getter = isReachableViaWWAN) BOOL reachableViaWWAN; 61 | 62 | /** 63 | Whether or not the network is currently reachable via WiFi. 64 | */ 65 | @property (readonly, nonatomic, assign, getter = isReachableViaWiFi) BOOL reachableViaWiFi; 66 | 67 | ///--------------------- 68 | /// @name Initialization 69 | ///--------------------- 70 | 71 | /** 72 | Returns the shared network reachability manager. 73 | */ 74 | + (instancetype)__attribute__((optnone))sharedManager; 75 | 76 | /** 77 | Creates and returns a network reachability manager with the default socket address. 78 | 79 | @return An initialized network reachability manager, actively monitoring the default socket address. 80 | */ 81 | + (instancetype)__attribute__((optnone))manager; 82 | 83 | /** 84 | Creates and returns a network reachability manager for the specified domain. 85 | 86 | @param domain The domain used to evaluate network reachability. 87 | 88 | @return An initialized network reachability manager, actively monitoring the specified domain. 89 | */ 90 | + (instancetype)__attribute__((optnone))managerForDomain:(NSString *)domain; 91 | 92 | /** 93 | Creates and returns a network reachability manager for the socket address. 94 | 95 | @param address The socket address (`sockaddr_in6`) used to evaluate network reachability. 96 | 97 | @return An initialized network reachability manager, actively monitoring the specified socket address. 98 | */ 99 | + (instancetype)__attribute__((optnone))managerForAddress:(const void *)address; 100 | 101 | /** 102 | Initializes an instance of a network reachability manager from the specified reachability object. 103 | 104 | @param reachability The reachability object to monitor. 105 | 106 | @return An initialized network reachability manager, actively monitoring the specified reachability. 107 | */ 108 | - (instancetype)__attribute__((optnone))initWithReachability:(SCNetworkReachabilityRef)reachability NS_DESIGNATED_INITIALIZER; 109 | 110 | /** 111 | * Initializes an instance of a network reachability manager 112 | * 113 | * @return nil as this method is unavailable 114 | */ 115 | - (nullable instancetype)__attribute__((optnone))init NS_UNAVAILABLE; 116 | 117 | ///-------------------------------------------------- 118 | /// @name Starting & Stopping Reachability Monitoring 119 | ///-------------------------------------------------- 120 | 121 | /** 122 | Starts monitoring for changes in network reachability status. 123 | */ 124 | - (void)__attribute__((optnone))startMonitoring; 125 | 126 | /** 127 | Stops monitoring for changes in network reachability status. 128 | */ 129 | - (void)__attribute__((optnone))stopMonitoring; 130 | 131 | ///------------------------------------------------- 132 | /// @name Getting Localized Reachability Description 133 | ///------------------------------------------------- 134 | 135 | /** 136 | Returns a localized string representation of the current network reachability status. 137 | */ 138 | - (NSString *)__attribute__((optnone))localizedNetworkReachabilityStatusString; 139 | 140 | ///--------------------------------------------------- 141 | /// @name Setting Network Reachability Change Callback 142 | ///--------------------------------------------------- 143 | 144 | /** 145 | Sets a callback to be executed when the network availability of the `baseURL` host changes. 146 | 147 | @param block A block object to be executed when the network availability of the `baseURL` host changes.. This block has no return value and takes a single argument which represents the various reachability states from the device to the `baseURL`. 148 | */ 149 | - (void)__attribute__((optnone))setReachabilityStatusChangeBlock:(nullable void (^)(AFNetworkReachabilityStatus status))block; 150 | 151 | @end 152 | 153 | ///---------------- 154 | /// @name Constants 155 | ///---------------- 156 | 157 | /** 158 | ## Network Reachability 159 | 160 | The following constants are provided by `AFNetworkReachabilityManager` as possible network reachability statuses. 161 | 162 | enum { 163 | AFNetworkReachabilityStatusUnknown, 164 | AFNetworkReachabilityStatusNotReachable, 165 | AFNetworkReachabilityStatusReachableViaWWAN, 166 | AFNetworkReachabilityStatusReachableViaWiFi, 167 | } 168 | 169 | `AFNetworkReachabilityStatusUnknown` 170 | The `baseURL` host reachability is not known. 171 | 172 | `AFNetworkReachabilityStatusNotReachable` 173 | The `baseURL` host cannot be reached. 174 | 175 | `AFNetworkReachabilityStatusReachableViaWWAN` 176 | The `baseURL` host can be reached via a cellular connection, such as EDGE or GPRS. 177 | 178 | `AFNetworkReachabilityStatusReachableViaWiFi` 179 | The `baseURL` host can be reached via a Wi-Fi connection. 180 | 181 | ### Keys for Notification UserInfo Dictionary 182 | 183 | Strings that are used as keys in a `userInfo` dictionary in a network reachability status change notification. 184 | 185 | `AFNetworkingReachabilityNotificationStatusItem` 186 | A key in the userInfo dictionary in a `AFNetworkingReachabilityDidChangeNotification` notification. 187 | The corresponding value is an `NSNumber` object representing the `AFNetworkReachabilityStatus` value for the current reachability status. 188 | */ 189 | 190 | ///-------------------- 191 | /// @name Notifications 192 | ///-------------------- 193 | 194 | /** 195 | Posted when network reachability changes. 196 | This notification assigns no notification object. The `userInfo` dictionary contains an `NSNumber` object under the `AFNetworkingReachabilityNotificationStatusItem` key, representing the `AFNetworkReachabilityStatus` value for the current network reachability. 197 | 198 | @warning In order for network reachability to be monitored, include the `SystemConfiguration` framework in the active target's "Link Binary With Library" build phase, and add `#import ` to the header prefix of the project (`Prefix.pch`). 199 | */ 200 | FOUNDATION_EXPORT NSString * const AFNetworkingReachabilityDidChangeNotification; 201 | FOUNDATION_EXPORT NSString * const AFNetworkingReachabilityNotificationStatusItem; 202 | 203 | ///-------------------- 204 | /// @name Functions 205 | ///-------------------- 206 | 207 | /** 208 | Returns a localized string representation of an `AFNetworkReachabilityStatus` value. 209 | */ 210 | FOUNDATION_EXPORT NSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status); 211 | 212 | NS_ASSUME_NONNULL_END 213 | #endif 214 | -------------------------------------------------------------------------------- /PUBG.xcodeproj/xcuserdata/shisange.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 9 | 21 | 22 | 23 | 25 | 37 | 38 | 39 | 41 | 53 | 54 | 55 | 57 | 69 | 70 | 71 | 73 | 85 | 86 | 87 | 89 | 101 | 102 | 103 | 105 | 117 | 118 | 119 | 121 | 133 | 134 | 135 | 137 | 149 | 150 | 151 | 153 | 165 | 166 | 167 | 169 | 181 | 182 | 183 | 185 | 197 | 198 | 199 | 201 | 213 | 214 | 215 | 217 | 229 | 230 | 231 | 232 | 233 | -------------------------------------------------------------------------------- /Bsphp/AFNetworking/AFNetworkReachabilityManager.m: -------------------------------------------------------------------------------- 1 | // AFNetworkReachabilityManager.m 2 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import "AFNetworkReachabilityManager.h" 23 | #if !TARGET_OS_WATCH 24 | 25 | #import 26 | #import 27 | #import 28 | #import 29 | #import 30 | 31 | NSString * const AFNetworkingReachabilityDidChangeNotification = @"com.alamofire.networking.reachability.change"; 32 | NSString * const AFNetworkingReachabilityNotificationStatusItem = @"AFNetworkingReachabilityNotificationStatusItem"; 33 | 34 | typedef void (^AFNetworkReachabilityStatusBlock)(AFNetworkReachabilityStatus status); 35 | 36 | NSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status)__attribute__((optnone)) { 37 | switch (status) { 38 | case AFNetworkReachabilityStatusNotReachable: 39 | return NSLocalizedStringFromTable(@"Not Reachable", @"AFNetworking", nil); 40 | case AFNetworkReachabilityStatusReachableViaWWAN: 41 | return NSLocalizedStringFromTable(@"Reachable via WWAN", @"AFNetworking", nil); 42 | case AFNetworkReachabilityStatusReachableViaWiFi: 43 | return NSLocalizedStringFromTable(@"Reachable via WiFi", @"AFNetworking", nil); 44 | case AFNetworkReachabilityStatusUnknown: 45 | default: 46 | return NSLocalizedStringFromTable(@"Unknown", @"AFNetworking", nil); 47 | } 48 | } 49 | 50 | static AFNetworkReachabilityStatus AFNetworkReachabilityStatusForFlags(SCNetworkReachabilityFlags flags)__attribute__((optnone)) { 51 | BOOL isReachable = ((flags & kSCNetworkReachabilityFlagsReachable) != 0); 52 | BOOL needsConnection = ((flags & kSCNetworkReachabilityFlagsConnectionRequired) != 0); 53 | BOOL canConnectionAutomatically = (((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) || ((flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0)); 54 | BOOL canConnectWithoutUserInteraction = (canConnectionAutomatically && (flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0); 55 | BOOL isNetworkReachable = (isReachable && (!needsConnection || canConnectWithoutUserInteraction)); 56 | 57 | AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusUnknown; 58 | if (isNetworkReachable == NO) { 59 | status = AFNetworkReachabilityStatusNotReachable; 60 | } 61 | #if TARGET_OS_IPHONE 62 | else if ((flags & kSCNetworkReachabilityFlagsIsWWAN) != 0) { 63 | status = AFNetworkReachabilityStatusReachableViaWWAN; 64 | } 65 | #endif 66 | else { 67 | status = AFNetworkReachabilityStatusReachableViaWiFi; 68 | } 69 | 70 | return status; 71 | } 72 | 73 | /** 74 | * Queue a status change notification for the main thread. 75 | * 76 | * This is done to ensure that the notifications are received in the same order 77 | * as they are sent. If notifications are sent directly, it is possible that 78 | * a queued notification (for an earlier status condition) is processed after 79 | * the later update, resulting in the listener being left in the wrong state. 80 | */ 81 | static void AFPostReachabilityStatusChange(SCNetworkReachabilityFlags flags, AFNetworkReachabilityStatusBlock block)__attribute__((optnone)) { 82 | AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusForFlags(flags); 83 | dispatch_async(dispatch_get_main_queue(), ^{ 84 | if (block) { 85 | block(status); 86 | } 87 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 88 | NSDictionary *userInfo = @{ AFNetworkingReachabilityNotificationStatusItem: @(status) }; 89 | [notificationCenter postNotificationName:AFNetworkingReachabilityDidChangeNotification object:nil userInfo:userInfo]; 90 | }); 91 | } 92 | 93 | static void AFNetworkReachabilityCallback(SCNetworkReachabilityRef __unused target, SCNetworkReachabilityFlags flags, void *info)__attribute__((optnone)) { 94 | AFPostReachabilityStatusChange(flags, (__bridge AFNetworkReachabilityStatusBlock)info); 95 | } 96 | 97 | 98 | static const void * AFNetworkReachabilityRetainCallback(const void *info) { 99 | return Block_copy(info); 100 | } 101 | 102 | static void AFNetworkReachabilityReleaseCallback(const void *info) { 103 | if (info) { 104 | Block_release(info); 105 | } 106 | } 107 | 108 | @interface AFNetworkReachabilityManager () 109 | @property (readonly, nonatomic, assign) SCNetworkReachabilityRef networkReachability; 110 | @property (readwrite, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus; 111 | @property (readwrite, nonatomic, copy) AFNetworkReachabilityStatusBlock networkReachabilityStatusBlock; 112 | @end 113 | 114 | @implementation AFNetworkReachabilityManager 115 | 116 | + (instancetype)__attribute__((optnone))sharedManager { 117 | static AFNetworkReachabilityManager *_sharedManager = nil; 118 | static dispatch_once_t onceToken; 119 | dispatch_once(&onceToken, ^{ 120 | _sharedManager = [self manager]; 121 | }); 122 | 123 | return _sharedManager; 124 | } 125 | 126 | + (instancetype)__attribute__((optnone))managerForDomain:(NSString *)domain { 127 | SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, [domain UTF8String]); 128 | 129 | AFNetworkReachabilityManager *manager = [[self alloc] initWithReachability:reachability]; 130 | 131 | CFRelease(reachability); 132 | 133 | return manager; 134 | } 135 | 136 | + (instancetype)__attribute__((optnone))managerForAddress:(const void *)address { 137 | SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr *)address); 138 | AFNetworkReachabilityManager *manager = [[self alloc] initWithReachability:reachability]; 139 | 140 | CFRelease(reachability); 141 | 142 | return manager; 143 | } 144 | 145 | + (instancetype)__attribute__((optnone))manager 146 | { 147 | #if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) 148 | struct sockaddr_in6 address; 149 | bzero(&address, sizeof(address)); 150 | address.sin6_len = sizeof(address); 151 | address.sin6_family = AF_INET6; 152 | #else 153 | struct sockaddr_in address; 154 | bzero(&address, sizeof(address)); 155 | address.sin_len = sizeof(address); 156 | address.sin_family = AF_INET; 157 | #endif 158 | return [self managerForAddress:&address]; 159 | } 160 | 161 | - (instancetype)__attribute__((optnone))initWithReachability:(SCNetworkReachabilityRef)reachability { 162 | self = [super init]; 163 | if (!self) { 164 | return nil; 165 | } 166 | 167 | _networkReachability = CFRetain(reachability); 168 | self.networkReachabilityStatus = AFNetworkReachabilityStatusUnknown; 169 | 170 | return self; 171 | } 172 | 173 | - (instancetype)__attribute__((optnone))init NS_UNAVAILABLE 174 | { 175 | return nil; 176 | } 177 | 178 | - (void)__attribute__((optnone))dealloc { 179 | [self stopMonitoring]; 180 | 181 | if (_networkReachability != NULL) { 182 | CFRelease(_networkReachability); 183 | } 184 | } 185 | 186 | #pragma mark - 187 | 188 | - (BOOL)__attribute__((optnone))isReachable { 189 | return [self isReachableViaWWAN] || [self isReachableViaWiFi]; 190 | } 191 | 192 | - (BOOL)__attribute__((optnone))isReachableViaWWAN { 193 | return self.networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWWAN; 194 | } 195 | 196 | - (BOOL)__attribute__((optnone))isReachableViaWiFi { 197 | return self.networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWiFi; 198 | } 199 | 200 | #pragma mark - 201 | 202 | - (void)__attribute__((optnone))startMonitoring { 203 | [self stopMonitoring]; 204 | 205 | if (!self.networkReachability) { 206 | return; 207 | } 208 | 209 | __weak __typeof(self)weakSelf = self; 210 | AFNetworkReachabilityStatusBlock callback = ^(AFNetworkReachabilityStatus status) { 211 | __strong __typeof(weakSelf)strongSelf = weakSelf; 212 | 213 | strongSelf.networkReachabilityStatus = status; 214 | if (strongSelf.networkReachabilityStatusBlock) { 215 | strongSelf.networkReachabilityStatusBlock(status); 216 | } 217 | 218 | }; 219 | 220 | SCNetworkReachabilityContext context = {0, (__bridge void *)callback, AFNetworkReachabilityRetainCallback, AFNetworkReachabilityReleaseCallback, NULL}; 221 | SCNetworkReachabilitySetCallback(self.networkReachability, AFNetworkReachabilityCallback, &context); 222 | SCNetworkReachabilityScheduleWithRunLoop(self.networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes); 223 | 224 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0),^{ 225 | SCNetworkReachabilityFlags flags; 226 | if (SCNetworkReachabilityGetFlags(self.networkReachability, &flags)) { 227 | AFPostReachabilityStatusChange(flags, callback); 228 | } 229 | }); 230 | } 231 | 232 | - (void)__attribute__((optnone))stopMonitoring { 233 | if (!self.networkReachability) { 234 | return; 235 | } 236 | 237 | SCNetworkReachabilityUnscheduleFromRunLoop(self.networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes); 238 | } 239 | 240 | #pragma mark - 241 | 242 | - (NSString *)__attribute__((optnone))localizedNetworkReachabilityStatusString { 243 | return AFStringFromNetworkReachabilityStatus(self.networkReachabilityStatus); 244 | } 245 | 246 | #pragma mark - 247 | 248 | - (void)__attribute__((optnone))setReachabilityStatusChangeBlock:(void (^)(AFNetworkReachabilityStatus status))block { 249 | self.networkReachabilityStatusBlock = block; 250 | } 251 | 252 | #pragma mark - NSKeyValueObserving 253 | 254 | + (NSSet *)__attribute__((optnone))keyPathsForValuesAffectingValueForKey:(NSString *)key { 255 | if ([key isEqualToString:@"reachable"] || [key isEqualToString:@"reachableViaWWAN"] || [key isEqualToString:@"reachableViaWiFi"]) { 256 | return [NSSet setWithObject:@"networkReachabilityStatus"]; 257 | } 258 | 259 | return [super keyPathsForValuesAffectingValueForKey:key]; 260 | } 261 | 262 | @end 263 | #endif 264 | -------------------------------------------------------------------------------- /Bsphp/bsphp/MF_Base64Additions.m: -------------------------------------------------------------------------------- 1 | // 2 | // MF_Base64Additions.m 3 | // Base64 -- RFC 4648 compatible implementation 4 | // see http://www.ietf.org/rfc/rfc4648.txt for more details 5 | // 6 | // Designed to be compiled with Automatic Reference Counting 7 | // 8 | // Created by Dave Poirier on 2012-06-14. 9 | // Public Domain 10 | // Hosted at https://github.com/ekscrypto/Base64 11 | // 12 | 13 | #import "MF_Base64Additions.h" 14 | 15 | @implementation MF_Base64Codec 16 | //加编译器属性 17 | +(NSString *)__attribute__((optnone))base64StringFromBase64UrlEncodedString:(NSString *)base64UrlEncodedString 18 | { 19 | NSString *s = base64UrlEncodedString; 20 | s = [s stringByReplacingOccurrencesOfString:@"-" withString:@"+"]; 21 | s = [s stringByReplacingOccurrencesOfString:@"_" withString:@"/"]; 22 | switch (s.length % 4) { 23 | case 2: 24 | s = [s stringByAppendingString:@"=="]; 25 | break; 26 | case 3: 27 | s = [s stringByAppendingString:@"="]; 28 | break; 29 | default: 30 | break; 31 | } 32 | return s; 33 | } 34 | 35 | +(NSString *)__attribute__((optnone))base64UrlEncodedStringFromBase64String:(NSString *)base64String 36 | { 37 | NSString *s = base64String; 38 | s = [s stringByReplacingOccurrencesOfString:@"=" withString:@""]; 39 | s = [s stringByReplacingOccurrencesOfString:@"+" withString:@"-"]; 40 | s = [s stringByReplacingOccurrencesOfString:@"/" withString:@"_"]; 41 | return s; 42 | } 43 | 44 | +(NSData *)__attribute__((optnone))dataFromBase64String:(NSString *)encoding 45 | { 46 | NSData *data = nil; 47 | unsigned char *decodedBytes = NULL; 48 | @try { 49 | #define __ 255 50 | static char decodingTable[256] = { 51 | __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0x00 - 0x0F 52 | __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0x10 - 0x1F 53 | __,__,__,__, __,__,__,__, __,__,__,62, __,__,__,63, // 0x20 - 0x2F 54 | 52,53,54,55, 56,57,58,59, 60,61,__,__, __, 0,__,__, // 0x30 - 0x3F 55 | __, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14, // 0x40 - 0x4F 56 | 15,16,17,18, 19,20,21,22, 23,24,25,__, __,__,__,__, // 0x50 - 0x5F 57 | __,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40, // 0x60 - 0x6F 58 | 41,42,43,44, 45,46,47,48, 49,50,51,__, __,__,__,__, // 0x70 - 0x7F 59 | __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0x80 - 0x8F 60 | __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0x90 - 0x9F 61 | __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0xA0 - 0xAF 62 | __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0xB0 - 0xBF 63 | __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0xC0 - 0xCF 64 | __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0xD0 - 0xDF 65 | __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0xE0 - 0xEF 66 | __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0xF0 - 0xFF 67 | }; 68 | encoding = [encoding stringByReplacingOccurrencesOfString:@"=" withString:@""]; 69 | NSData *encodedData = [encoding dataUsingEncoding:NSASCIIStringEncoding]; 70 | unsigned char *encodedBytes = (unsigned char *)[encodedData bytes]; 71 | 72 | NSUInteger encodedLength = [encodedData length]; 73 | if( encodedLength >= (NSUIntegerMax - 3) ) return nil; // NSUInteger overflow check 74 | NSUInteger encodedBlocks = (encodedLength+3) >> 2; 75 | NSUInteger expectedDataLength = encodedBlocks * 3; 76 | 77 | unsigned char decodingBlock[4]; 78 | 79 | decodedBytes = malloc(expectedDataLength); 80 | if( decodedBytes != NULL ) { 81 | 82 | NSUInteger i = 0; 83 | NSUInteger j = 0; 84 | NSUInteger k = 0; 85 | unsigned char c; 86 | while( i < encodedLength ) { 87 | c = decodingTable[encodedBytes[i]]; 88 | i++; 89 | if( c != __ ) { 90 | decodingBlock[j] = c; 91 | j++; 92 | if( j == 4 ) { 93 | decodedBytes[k] = (decodingBlock[0] << 2) | (decodingBlock[1] >> 4); 94 | decodedBytes[k+1] = (decodingBlock[1] << 4) | (decodingBlock[2] >> 2); 95 | decodedBytes[k+2] = (decodingBlock[2] << 6) | (decodingBlock[3]); 96 | j = 0; 97 | k += 3; 98 | } 99 | } 100 | } 101 | 102 | // Process left over bytes, if any 103 | if( j == 3 ) { 104 | decodedBytes[k] = (decodingBlock[0] << 2) | (decodingBlock[1] >> 4); 105 | decodedBytes[k+1] = (decodingBlock[1] << 4) | (decodingBlock[2] >> 2); 106 | k += 2; 107 | } else if( j == 2 ) { 108 | decodedBytes[k] = (decodingBlock[0] << 2) | (decodingBlock[1] >> 4); 109 | k += 1; 110 | } 111 | data = [[NSData alloc] initWithBytes:decodedBytes length:k]; 112 | } 113 | } 114 | @catch (NSException *exception) { 115 | data = nil; 116 | NSLog(@"WARNING: error occured while decoding base 32 string: %@", exception); 117 | } 118 | @finally { 119 | if( decodedBytes != NULL ) { 120 | free( decodedBytes ); 121 | } 122 | } 123 | return data; 124 | } 125 | +(NSString *)__attribute__((optnone))base64StringFromData:(NSData *)data 126 | { 127 | NSString *encoding = nil; 128 | unsigned char *encodingBytes = NULL; 129 | @try { 130 | static char encodingTable[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 131 | static NSUInteger paddingTable[] = {0,2,1}; 132 | // Table 1: The Base 64 Alphabet 133 | // 134 | // Value Encoding Value Encoding Value Encoding Value Encoding 135 | // 0 A 17 R 34 i 51 z 136 | // 1 B 18 S 35 j 52 0 137 | // 2 C 19 T 36 k 53 1 138 | // 3 D 20 U 37 l 54 2 139 | // 4 E 21 V 38 m 55 3 140 | // 5 F 22 W 39 n 56 4 141 | // 6 G 23 X 40 o 57 5 142 | // 7 H 24 Y 41 p 58 6 143 | // 8 I 25 Z 42 q 59 7 144 | // 9 J 26 a 43 r 60 8 145 | // 10 K 27 b 44 s 61 9 146 | // 11 L 28 c 45 t 62 + 147 | // 12 M 29 d 46 u 63 / 148 | // 13 N 30 e 47 v 149 | // 14 O 31 f 48 w (pad) = 150 | // 15 P 32 g 49 x 151 | // 16 Q 33 h 50 y 152 | 153 | NSUInteger dataLength = [data length]; 154 | NSUInteger encodedBlocks = dataLength / 3; 155 | if( (encodedBlocks + 1) >= (NSUIntegerMax / 4) ) return nil; // NSUInteger overflow check 156 | NSUInteger padding = paddingTable[dataLength % 3]; 157 | if( padding > 0 ) encodedBlocks++; 158 | NSUInteger encodedLength = encodedBlocks * 4; 159 | 160 | encodingBytes = malloc(encodedLength); 161 | if( encodingBytes != NULL ) { 162 | NSUInteger rawBytesToProcess = dataLength; 163 | NSUInteger rawBaseIndex = 0; 164 | NSUInteger encodingBaseIndex = 0; 165 | unsigned char *rawBytes = (unsigned char *)[data bytes]; 166 | unsigned char rawByte1, rawByte2, rawByte3; 167 | while( rawBytesToProcess >= 3 ) { 168 | rawByte1 = rawBytes[rawBaseIndex]; 169 | rawByte2 = rawBytes[rawBaseIndex+1]; 170 | rawByte3 = rawBytes[rawBaseIndex+2]; 171 | encodingBytes[encodingBaseIndex] = encodingTable[((rawByte1 >> 2) & 0x3F)]; 172 | encodingBytes[encodingBaseIndex+1] = encodingTable[((rawByte1 << 4) & 0x30) | ((rawByte2 >> 4) & 0x0F) ]; 173 | encodingBytes[encodingBaseIndex+2] = encodingTable[((rawByte2 << 2) & 0x3C) | ((rawByte3 >> 6) & 0x03) ]; 174 | encodingBytes[encodingBaseIndex+3] = encodingTable[(rawByte3 & 0x3F)]; 175 | 176 | rawBaseIndex += 3; 177 | encodingBaseIndex += 4; 178 | rawBytesToProcess -= 3; 179 | } 180 | rawByte2 = 0; 181 | switch (dataLength-rawBaseIndex) { 182 | case 2: 183 | rawByte2 = rawBytes[rawBaseIndex+1]; 184 | case 1: 185 | rawByte1 = rawBytes[rawBaseIndex]; 186 | encodingBytes[encodingBaseIndex] = encodingTable[((rawByte1 >> 2) & 0x3F)]; 187 | encodingBytes[encodingBaseIndex+1] = encodingTable[((rawByte1 << 4) & 0x30) | ((rawByte2 >> 4) & 0x0F) ]; 188 | encodingBytes[encodingBaseIndex+2] = encodingTable[((rawByte2 << 2) & 0x3C) ]; 189 | // we can skip rawByte3 since we have a partial block it would always be 0 190 | break; 191 | } 192 | // compute location from where to begin inserting padding, it may overwrite some bytes from the partial block encoding 193 | // if their value was 0 (cases 1-2). 194 | encodingBaseIndex = encodedLength - padding; 195 | while( padding-- > 0 ) { 196 | encodingBytes[encodingBaseIndex++] = '='; 197 | } 198 | encoding = [[NSString alloc] initWithBytes:encodingBytes length:encodedLength encoding:NSASCIIStringEncoding]; 199 | } 200 | } 201 | @catch (NSException *exception) { 202 | encoding = nil; 203 | NSLog(@"WARNING: error occured while tring to encode base 32 data: %@", exception); 204 | } 205 | @finally { 206 | if( encodingBytes != NULL ) { 207 | free( encodingBytes ); 208 | } 209 | } 210 | return encoding; 211 | } 212 | @end 213 | 214 | @implementation NSString (Base64Addition) 215 | -(NSString *)__attribute__((optnone))base64String 216 | { 217 | NSData *utf8encoding = [self dataUsingEncoding:NSUTF8StringEncoding]; 218 | return [MF_Base64Codec base64StringFromData:utf8encoding]; 219 | } 220 | -(NSString *)__attribute__((optnone))base64UrlEncodedString 221 | { 222 | return [MF_Base64Codec base64UrlEncodedStringFromBase64String:[self base64String]]; 223 | } 224 | +(NSString *)__attribute__((optnone))stringFromBase64String:(NSString *)base64String 225 | { 226 | NSData *utf8encoding = [MF_Base64Codec dataFromBase64String:base64String]; 227 | return [[NSString alloc] initWithData:utf8encoding encoding:NSUTF8StringEncoding]; 228 | } 229 | +(NSString *)__attribute__((optnone))stringFromBase64UrlEncodedString:(NSString *)base64UrlEncodedString 230 | { 231 | return [self stringFromBase64String:[MF_Base64Codec base64StringFromBase64UrlEncodedString:base64UrlEncodedString]]; 232 | } 233 | @end 234 | 235 | @implementation NSData (Base64Addition) 236 | +(NSData *)__attribute__((optnone))dataWithBase64String:(NSString *)base64String 237 | { 238 | return [MF_Base64Codec dataFromBase64String:base64String]; 239 | } 240 | +(NSData *)__attribute__((optnone))dataWithBase64UrlEncodedString:(NSString *)base64UrlEncodedString 241 | { 242 | return [self dataWithBase64String:[MF_Base64Codec base64StringFromBase64UrlEncodedString:base64UrlEncodedString]]; 243 | } 244 | -(NSString *)__attribute__((optnone))base64String 245 | { 246 | return [MF_Base64Codec base64StringFromData:self]; 247 | } 248 | -(NSString *)__attribute__((optnone))base64UrlEncodedString 249 | { 250 | return [MF_Base64Codec base64UrlEncodedStringFromBase64String:[self base64String]]; 251 | } 252 | @end 253 | -------------------------------------------------------------------------------- /Bsphp/AFNetworking/AFURLResponseSerialization.h: -------------------------------------------------------------------------------- 1 | // AFURLResponseSerialization.h 2 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import 23 | #import 24 | 25 | NS_ASSUME_NONNULL_BEGIN 26 | 27 | /** 28 | The `AFURLResponseSerialization` protocol is adopted by an object that decodes data into a more useful object representation, according to details in the server response. Response serializers may additionally perform validation on the incoming response and data. 29 | 30 | For example, a JSON response serializer may check for an acceptable status code (`2XX` range) and content type (`application/json`), decoding a valid JSON response into an object. 31 | */ 32 | @protocol AFURLResponseSerialization 33 | 34 | /** 35 | The response object decoded from the data associated with a specified response. 36 | 37 | @param response The response to be processed. 38 | @param data The response data to be decoded. 39 | @param error The error that occurred while attempting to decode the response data. 40 | 41 | @return The object decoded from the specified response data. 42 | */ 43 | - (nullable id)__attribute__((optnone))responseObjectForResponse:(nullable NSURLResponse *)response 44 | data:(nullable NSData *)data 45 | error:(NSError * _Nullable __autoreleasing *)error NS_SWIFT_NOTHROW; 46 | 47 | @end 48 | 49 | #pragma mark - 50 | 51 | /** 52 | `AFHTTPResponseSerializer` conforms to the `AFURLRequestSerialization` & `AFURLResponseSerialization` protocols, offering a concrete base implementation of query string / URL form-encoded parameter serialization and default request headers, as well as response status code and content type validation. 53 | 54 | Any request or response serializer dealing with HTTP is encouraged to subclass `AFHTTPResponseSerializer` in order to ensure consistent default behavior. 55 | */ 56 | @interface AFHTTPResponseSerializer : NSObject 57 | 58 | - (instancetype)__attribute__((optnone))init; 59 | 60 | @property (nonatomic, assign) NSStringEncoding stringEncoding DEPRECATED_MSG_ATTRIBUTE("The string encoding is never used. AFHTTPResponseSerializer only validates status codes and content types but does not try to decode the received data in any way."); 61 | 62 | /** 63 | Creates and returns a serializer with default configuration. 64 | */ 65 | + (instancetype)__attribute__((optnone))serializer; 66 | 67 | ///----------------------------------------- 68 | /// @name Configuring Response Serialization 69 | ///----------------------------------------- 70 | 71 | /** 72 | The acceptable HTTP status codes for responses. When non-`nil`, responses with status codes not contained by the set will result in an error during validation. 73 | 74 | See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 75 | */ 76 | @property (nonatomic, copy, nullable) NSIndexSet *acceptableStatusCodes; 77 | 78 | /** 79 | The acceptable MIME types for responses. When non-`nil`, responses with a `Content-Type` with MIME types that do not intersect with the set will result in an error during validation. 80 | */ 81 | @property (nonatomic, copy, nullable) NSSet *acceptableContentTypes; 82 | 83 | /** 84 | Validates the specified response and data. 85 | 86 | In its base implementation, this method checks for an acceptable status code and content type. Subclasses may wish to add other domain-specific checks. 87 | 88 | @param response The response to be validated. 89 | @param data The data associated with the response. 90 | @param error The error that occurred while attempting to validate the response. 91 | 92 | @return `YES` if the response is valid, otherwise `NO`. 93 | */ 94 | - (BOOL)__attribute__((optnone))validateResponse:(nullable NSHTTPURLResponse *)response 95 | data:(nullable NSData *)data 96 | error:(NSError * _Nullable __autoreleasing *)error; 97 | 98 | @end 99 | 100 | #pragma mark - 101 | 102 | 103 | /** 104 | `AFJSONResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes JSON responses. 105 | 106 | By default, `AFJSONResponseSerializer` accepts the following MIME types, which includes the official standard, `application/json`, as well as other commonly-used types: 107 | 108 | - `application/json` 109 | - `text/json` 110 | - `text/javascript` 111 | */ 112 | @interface AFJSONResponseSerializer : AFHTTPResponseSerializer 113 | 114 | - (instancetype)__attribute__((optnone))init; 115 | 116 | /** 117 | Options for reading the response JSON data and creating the Foundation objects. For possible values, see the `NSJSONSerialization` documentation section "NSJSONReadingOptions". `0` by default. 118 | */ 119 | @property (nonatomic, assign) NSJSONReadingOptions readingOptions; 120 | 121 | /** 122 | Whether to remove keys with `NSNull` values from response JSON. Defaults to `NO`. 123 | */ 124 | @property (nonatomic, assign) BOOL removesKeysWithNullValues; 125 | 126 | /** 127 | Creates and returns a JSON serializer with specified reading and writing options. 128 | 129 | @param readingOptions The specified JSON reading options. 130 | */ 131 | + (instancetype)__attribute__((optnone))serializerWithReadingOptions:(NSJSONReadingOptions)readingOptions; 132 | 133 | @end 134 | 135 | #pragma mark - 136 | 137 | /** 138 | `AFXMLParserResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes XML responses as an `NSXMLParser` objects. 139 | 140 | By default, `AFXMLParserResponseSerializer` accepts the following MIME types, which includes the official standard, `application/xml`, as well as other commonly-used types: 141 | 142 | - `application/xml` 143 | - `text/xml` 144 | */ 145 | @interface AFXMLParserResponseSerializer : AFHTTPResponseSerializer 146 | 147 | @end 148 | 149 | #pragma mark - 150 | 151 | #ifdef __MAC_OS_X_VERSION_MIN_REQUIRED 152 | 153 | /** 154 | `AFXMLDocumentResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes XML responses as an `NSXMLDocument` objects. 155 | 156 | By default, `AFXMLDocumentResponseSerializer` accepts the following MIME types, which includes the official standard, `application/xml`, as well as other commonly-used types: 157 | 158 | - `application/xml` 159 | - `text/xml` 160 | */ 161 | @interface AFXMLDocumentResponseSerializer : AFHTTPResponseSerializer 162 | 163 | - (instancetype)__attribute__((optnone))init; 164 | 165 | /** 166 | Input and output options specifically intended for `NSXMLDocument` objects. For possible values, see the `NSJSONSerialization` documentation section "NSJSONReadingOptions". `0` by default. 167 | */ 168 | @property (nonatomic, assign) NSUInteger options; 169 | 170 | /** 171 | Creates and returns an XML document serializer with the specified options. 172 | 173 | @param mask The XML document options. 174 | */ 175 | + (instancetype)__attribute__((optnone))serializerWithXMLDocumentOptions:(NSUInteger)mask; 176 | 177 | @end 178 | 179 | #endif 180 | 181 | #pragma mark - 182 | 183 | /** 184 | `AFPropertyListResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes XML responses as an `NSXMLDocument` objects. 185 | 186 | By default, `AFPropertyListResponseSerializer` accepts the following MIME types: 187 | 188 | - `application/x-plist` 189 | */ 190 | @interface AFPropertyListResponseSerializer : AFHTTPResponseSerializer 191 | 192 | - (instancetype)__attribute__((optnone))init; 193 | 194 | /** 195 | The property list format. Possible values are described in "NSPropertyListFormat". 196 | */ 197 | @property (nonatomic, assign) NSPropertyListFormat format; 198 | 199 | /** 200 | The property list reading options. Possible values are described in "NSPropertyListMutabilityOptions." 201 | */ 202 | @property (nonatomic, assign) NSPropertyListReadOptions readOptions; 203 | 204 | /** 205 | Creates and returns a property list serializer with a specified format, read options, and write options. 206 | 207 | @param format The property list format. 208 | @param readOptions The property list reading options. 209 | */ 210 | + (instancetype)__attribute__((optnone))serializerWithFormat:(NSPropertyListFormat)format 211 | readOptions:(NSPropertyListReadOptions)readOptions; 212 | 213 | @end 214 | 215 | #pragma mark - 216 | 217 | /** 218 | `AFImageResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes image responses. 219 | 220 | By default, `AFImageResponseSerializer` accepts the following MIME types, which correspond to the image formats supported by UIImage or NSImage: 221 | 222 | - `image/tiff` 223 | - `image/jpeg` 224 | - `image/gif` 225 | - `image/png` 226 | - `image/ico` 227 | - `image/x-icon` 228 | - `image/bmp` 229 | - `image/x-bmp` 230 | - `image/x-xbitmap` 231 | - `image/x-win-bitmap` 232 | */ 233 | @interface AFImageResponseSerializer : AFHTTPResponseSerializer 234 | 235 | #if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH 236 | /** 237 | The scale factor used when interpreting the image data to construct `responseImage`. Specifying a scale factor of 1.0 results in an image whose size matches the pixel-based dimensions of the image. Applying a different scale factor changes the size of the image as reported by the size property. This is set to the value of scale of the main screen by default, which automatically scales images for retina displays, for instance. 238 | */ 239 | @property (nonatomic, assign) CGFloat imageScale; 240 | 241 | /** 242 | Whether to automatically inflate response image data for compressed formats (such as PNG or JPEG). Enabling this can significantly improve drawing performance on iOS when used with `setCompletionBlockWithSuccess:failure:`, as it allows a bitmap representation to be constructed in the background rather than on the main thread. `YES` by default. 243 | */ 244 | @property (nonatomic, assign) BOOL automaticallyInflatesResponseImage; 245 | #endif 246 | 247 | @end 248 | 249 | #pragma mark - 250 | 251 | /** 252 | `AFCompoundSerializer` is a subclass of `AFHTTPResponseSerializer` that delegates the response serialization to the first `AFHTTPResponseSerializer` object that returns an object for `responseObjectForResponse:data:error:`, falling back on the default behavior of `AFHTTPResponseSerializer`. This is useful for supporting multiple potential types and structures of server responses with a single serializer. 253 | */ 254 | @interface AFCompoundResponseSerializer : AFHTTPResponseSerializer 255 | 256 | /** 257 | The component response serializers. 258 | */ 259 | @property (readonly, nonatomic, copy) NSArray > *responseSerializers; 260 | 261 | /** 262 | Creates and returns a compound serializer comprised of the specified response serializers. 263 | 264 | @warning Each response serializer specified must be a subclass of `AFHTTPResponseSerializer`, and response to `-validateResponse:data:error:`. 265 | */ 266 | + (instancetype)__attribute__((optnone))compoundSerializerWithResponseSerializers:(NSArray > *)responseSerializers; 267 | 268 | @end 269 | 270 | ///---------------- 271 | /// @name Constants 272 | ///---------------- 273 | 274 | /** 275 | ## Error Domains 276 | 277 | The following error domain is predefined. 278 | 279 | - `NSString * const AFURLResponseSerializationErrorDomain` 280 | 281 | ### Constants 282 | 283 | `AFURLResponseSerializationErrorDomain` 284 | AFURLResponseSerializer errors. Error codes for `AFURLResponseSerializationErrorDomain` correspond to codes in `NSURLErrorDomain`. 285 | */ 286 | FOUNDATION_EXPORT NSString * const AFURLResponseSerializationErrorDomain; 287 | 288 | /** 289 | ## User info dictionary keys 290 | 291 | These keys may exist in the user info dictionary, in addition to those defined for NSError. 292 | 293 | - `NSString * const AFNetworkingOperationFailingURLResponseErrorKey` 294 | - `NSString * const AFNetworkingOperationFailingURLResponseDataErrorKey` 295 | 296 | ### Constants 297 | 298 | `AFNetworkingOperationFailingURLResponseErrorKey` 299 | The corresponding value is an `NSURLResponse` containing the response of the operation associated with an error. This key is only present in the `AFURLResponseSerializationErrorDomain`. 300 | 301 | `AFNetworkingOperationFailingURLResponseDataErrorKey` 302 | The corresponding value is an `NSData` containing the original data of the operation associated with an error. This key is only present in the `AFURLResponseSerializationErrorDomain`. 303 | */ 304 | FOUNDATION_EXPORT NSString * const AFNetworkingOperationFailingURLResponseErrorKey; 305 | 306 | FOUNDATION_EXPORT NSString * const AFNetworkingOperationFailingURLResponseDataErrorKey; 307 | 308 | NS_ASSUME_NONNULL_END 309 | -------------------------------------------------------------------------------- /Bsphp/AFNetworking/AFSecurityPolicy.m: -------------------------------------------------------------------------------- 1 | // AFSecurityPolicy.m 2 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import "AFSecurityPolicy.h" 23 | 24 | #import 25 | 26 | #if !TARGET_OS_IOS && !TARGET_OS_WATCH && !TARGET_OS_TV 27 | static NSData * AFSecKeyGetData(SecKeyRef key)__attribute__((optnone)) { 28 | CFDataRef data = NULL; 29 | 30 | __Require_noErr_Quiet(SecItemExport(key, kSecFormatUnknown, kSecItemPemArmour, NULL, &data), _out); 31 | 32 | return (__bridge_transfer NSData *)data; 33 | 34 | _out: 35 | if (data) { 36 | CFRelease(data); 37 | } 38 | 39 | return nil; 40 | } 41 | #endif 42 | 43 | static BOOL AFSecKeyIsEqualToKey(SecKeyRef key1, SecKeyRef key2)__attribute__((optnone)) { 44 | #if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV 45 | return [(__bridge id)key1 isEqual:(__bridge id)key2]; 46 | #else 47 | return [AFSecKeyGetData(key1) isEqual:AFSecKeyGetData(key2)]; 48 | #endif 49 | } 50 | 51 | static id AFPublicKeyForCertificate(NSData *certificate) __attribute__((optnone)){ 52 | id allowedPublicKey = nil; 53 | SecCertificateRef allowedCertificate; 54 | SecPolicyRef policy = nil; 55 | SecTrustRef allowedTrust = nil; 56 | SecTrustResultType result; 57 | 58 | allowedCertificate = SecCertificateCreateWithData(NULL, (__bridge CFDataRef)certificate); 59 | __Require_Quiet(allowedCertificate != NULL, _out); 60 | 61 | policy = SecPolicyCreateBasicX509(); 62 | __Require_noErr_Quiet(SecTrustCreateWithCertificates(allowedCertificate, policy, &allowedTrust), _out); 63 | __Require_noErr_Quiet(SecTrustEvaluate(allowedTrust, &result), _out); 64 | 65 | allowedPublicKey = (__bridge_transfer id)SecTrustCopyPublicKey(allowedTrust); 66 | 67 | _out: 68 | if (allowedTrust) { 69 | CFRelease(allowedTrust); 70 | } 71 | 72 | if (policy) { 73 | CFRelease(policy); 74 | } 75 | 76 | if (allowedCertificate) { 77 | CFRelease(allowedCertificate); 78 | } 79 | 80 | return allowedPublicKey; 81 | } 82 | 83 | static BOOL AFServerTrustIsValid(SecTrustRef serverTrust) __attribute__((optnone)){ 84 | BOOL isValid = NO; 85 | SecTrustResultType result; 86 | __Require_noErr_Quiet(SecTrustEvaluate(serverTrust, &result), _out); 87 | 88 | isValid = (result == kSecTrustResultUnspecified || result == kSecTrustResultProceed); 89 | 90 | _out: 91 | return isValid; 92 | } 93 | 94 | static NSArray * AFCertificateTrustChainForServerTrust(SecTrustRef serverTrust)__attribute__((optnone)) { 95 | CFIndex certificateCount = SecTrustGetCertificateCount(serverTrust); 96 | NSMutableArray *trustChain = [NSMutableArray arrayWithCapacity:(NSUInteger)certificateCount]; 97 | 98 | for (CFIndex i = 0; i < certificateCount; i++) { 99 | SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, i); 100 | [trustChain addObject:(__bridge_transfer NSData *)SecCertificateCopyData(certificate)]; 101 | } 102 | 103 | return [NSArray arrayWithArray:trustChain]; 104 | } 105 | 106 | static NSArray * AFPublicKeyTrustChainForServerTrust(SecTrustRef serverTrust)__attribute__((optnone)) { 107 | SecPolicyRef policy = SecPolicyCreateBasicX509(); 108 | CFIndex certificateCount = SecTrustGetCertificateCount(serverTrust); 109 | NSMutableArray *trustChain = [NSMutableArray arrayWithCapacity:(NSUInteger)certificateCount]; 110 | for (CFIndex i = 0; i < certificateCount; i++) { 111 | SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, i); 112 | 113 | SecCertificateRef someCertificates[] = {certificate}; 114 | CFArrayRef certificates = CFArrayCreate(NULL, (const void **)someCertificates, 1, NULL); 115 | 116 | SecTrustRef trust; 117 | __Require_noErr_Quiet(SecTrustCreateWithCertificates(certificates, policy, &trust), _out); 118 | 119 | SecTrustResultType result; 120 | __Require_noErr_Quiet(SecTrustEvaluate(trust, &result), _out); 121 | 122 | [trustChain addObject:(__bridge_transfer id)SecTrustCopyPublicKey(trust)]; 123 | 124 | _out: 125 | if (trust) { 126 | CFRelease(trust); 127 | } 128 | 129 | if (certificates) { 130 | CFRelease(certificates); 131 | } 132 | 133 | continue; 134 | } 135 | CFRelease(policy); 136 | 137 | return [NSArray arrayWithArray:trustChain]; 138 | } 139 | 140 | #pragma mark - 141 | 142 | @interface AFSecurityPolicy() 143 | @property (readwrite, nonatomic, assign) AFSSLPinningMode SSLPinningMode; 144 | @property (readwrite, nonatomic, strong) NSSet *pinnedPublicKeys; 145 | @end 146 | 147 | @implementation AFSecurityPolicy 148 | 149 | + (NSSet *)__attribute__((optnone))certificatesInBundle:(NSBundle *)bundle { 150 | NSArray *paths = [bundle pathsForResourcesOfType:@"cer" inDirectory:@"."]; 151 | 152 | NSMutableSet *certificates = [NSMutableSet setWithCapacity:[paths count]]; 153 | for (NSString *path in paths) { 154 | NSData *certificateData = [NSData dataWithContentsOfFile:path]; 155 | [certificates addObject:certificateData]; 156 | } 157 | 158 | return [NSSet setWithSet:certificates]; 159 | } 160 | 161 | + (NSSet *)__attribute__((optnone))defaultPinnedCertificates { 162 | static NSSet *_defaultPinnedCertificates = nil; 163 | static dispatch_once_t onceToken; 164 | dispatch_once(&onceToken, ^{ 165 | NSBundle *bundle = [NSBundle bundleForClass:[self class]]; 166 | _defaultPinnedCertificates = [self certificatesInBundle:bundle]; 167 | }); 168 | 169 | return _defaultPinnedCertificates; 170 | } 171 | 172 | + (instancetype)__attribute__((optnone))defaultPolicy { 173 | AFSecurityPolicy *securityPolicy = [[self alloc] init]; 174 | securityPolicy.SSLPinningMode = AFSSLPinningModeNone; 175 | 176 | return securityPolicy; 177 | } 178 | 179 | + (instancetype)__attribute__((optnone))policyWithPinningMode:(AFSSLPinningMode)pinningMode { 180 | return [self policyWithPinningMode:pinningMode withPinnedCertificates:[self defaultPinnedCertificates]]; 181 | } 182 | 183 | + (instancetype)__attribute__((optnone))policyWithPinningMode:(AFSSLPinningMode)pinningMode withPinnedCertificates:(NSSet *)pinnedCertificates { 184 | AFSecurityPolicy *securityPolicy = [[self alloc] init]; 185 | securityPolicy.SSLPinningMode = pinningMode; 186 | 187 | [securityPolicy setPinnedCertificates:pinnedCertificates]; 188 | 189 | return securityPolicy; 190 | } 191 | 192 | - (instancetype)__attribute__((optnone))init { 193 | self = [super init]; 194 | if (!self) { 195 | return nil; 196 | } 197 | 198 | self.validatesDomainName = YES; 199 | 200 | return self; 201 | } 202 | 203 | - (void)__attribute__((optnone))setPinnedCertificates:(NSSet *)pinnedCertificates { 204 | _pinnedCertificates = pinnedCertificates; 205 | 206 | if (self.pinnedCertificates) { 207 | NSMutableSet *mutablePinnedPublicKeys = [NSMutableSet setWithCapacity:[self.pinnedCertificates count]]; 208 | for (NSData *certificate in self.pinnedCertificates) { 209 | id publicKey = AFPublicKeyForCertificate(certificate); 210 | if (!publicKey) { 211 | continue; 212 | } 213 | [mutablePinnedPublicKeys addObject:publicKey]; 214 | } 215 | self.pinnedPublicKeys = [NSSet setWithSet:mutablePinnedPublicKeys]; 216 | } else { 217 | self.pinnedPublicKeys = nil; 218 | } 219 | } 220 | 221 | #pragma mark - 222 | 223 | - (BOOL)__attribute__((optnone))evaluateServerTrust:(SecTrustRef)serverTrust 224 | forDomain:(NSString *)domain 225 | { 226 | if (domain && self.allowInvalidCertificates && self.validatesDomainName && (self.SSLPinningMode == AFSSLPinningModeNone || [self.pinnedCertificates count] == 0)) { 227 | // https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/NetworkingTopics/Articles/OverridingSSLChainValidationCorrectly.html 228 | // According to the docs, you should only trust your provided certs for evaluation. 229 | // Pinned certificates are added to the trust. Without pinned certificates, 230 | // there is nothing to evaluate against. 231 | // 232 | // From Apple Docs: 233 | // "Do not implicitly trust self-signed certificates as anchors (kSecTrustOptionImplicitAnchors). 234 | // Instead, add your own (self-signed) CA certificate to the list of trusted anchors." 235 | NSLog(@"In order to validate a domain name for self signed certificates, you MUST use pinning."); 236 | return NO; 237 | } 238 | 239 | NSMutableArray *policies = [NSMutableArray array]; 240 | if (self.validatesDomainName) { 241 | [policies addObject:(__bridge_transfer id)SecPolicyCreateSSL(true, (__bridge CFStringRef)domain)]; 242 | } else { 243 | [policies addObject:(__bridge_transfer id)SecPolicyCreateBasicX509()]; 244 | } 245 | 246 | SecTrustSetPolicies(serverTrust, (__bridge CFArrayRef)policies); 247 | 248 | if (self.SSLPinningMode == AFSSLPinningModeNone) { 249 | return self.allowInvalidCertificates || AFServerTrustIsValid(serverTrust); 250 | } else if (!AFServerTrustIsValid(serverTrust) && !self.allowInvalidCertificates) { 251 | return NO; 252 | } 253 | 254 | switch (self.SSLPinningMode) { 255 | case AFSSLPinningModeNone: 256 | default: 257 | return NO; 258 | case AFSSLPinningModeCertificate: { 259 | NSMutableArray *pinnedCertificates = [NSMutableArray array]; 260 | for (NSData *certificateData in self.pinnedCertificates) { 261 | [pinnedCertificates addObject:(__bridge_transfer id)SecCertificateCreateWithData(NULL, (__bridge CFDataRef)certificateData)]; 262 | } 263 | SecTrustSetAnchorCertificates(serverTrust, (__bridge CFArrayRef)pinnedCertificates); 264 | 265 | if (!AFServerTrustIsValid(serverTrust)) { 266 | return NO; 267 | } 268 | 269 | // obtain the chain after being validated, which *should* contain the pinned certificate in the last position (if it's the Root CA) 270 | NSArray *serverCertificates = AFCertificateTrustChainForServerTrust(serverTrust); 271 | 272 | for (NSData *trustChainCertificate in [serverCertificates reverseObjectEnumerator]) { 273 | if ([self.pinnedCertificates containsObject:trustChainCertificate]) { 274 | return YES; 275 | } 276 | } 277 | 278 | return NO; 279 | } 280 | case AFSSLPinningModePublicKey: { 281 | NSUInteger trustedPublicKeyCount = 0; 282 | NSArray *publicKeys = AFPublicKeyTrustChainForServerTrust(serverTrust); 283 | 284 | for (id trustChainPublicKey in publicKeys) { 285 | for (id pinnedPublicKey in self.pinnedPublicKeys) { 286 | if (AFSecKeyIsEqualToKey((__bridge SecKeyRef)trustChainPublicKey, (__bridge SecKeyRef)pinnedPublicKey)) { 287 | trustedPublicKeyCount += 1; 288 | } 289 | } 290 | } 291 | return trustedPublicKeyCount > 0; 292 | } 293 | } 294 | 295 | return NO; 296 | } 297 | 298 | #pragma mark - NSKeyValueObserving 299 | 300 | + (NSSet *)__attribute__((optnone))keyPathsForValuesAffectingPinnedPublicKeys { 301 | return [NSSet setWithObject:@"pinnedCertificates"]; 302 | } 303 | 304 | #pragma mark - NSSecureCoding 305 | 306 | + (BOOL)__attribute__((optnone))supportsSecureCoding { 307 | return YES; 308 | } 309 | 310 | - (instancetype)__attribute__((optnone))initWithCoder:(NSCoder *)decoder { 311 | 312 | self = [self init]; 313 | if (!self) { 314 | return nil; 315 | } 316 | 317 | self.SSLPinningMode = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(SSLPinningMode))] unsignedIntegerValue]; 318 | self.allowInvalidCertificates = [decoder decodeBoolForKey:NSStringFromSelector(@selector(allowInvalidCertificates))]; 319 | self.validatesDomainName = [decoder decodeBoolForKey:NSStringFromSelector(@selector(validatesDomainName))]; 320 | self.pinnedCertificates = [decoder decodeObjectOfClass:[NSArray class] forKey:NSStringFromSelector(@selector(pinnedCertificates))]; 321 | 322 | return self; 323 | } 324 | 325 | - (void)__attribute__((optnone))encodeWithCoder:(NSCoder *)coder { 326 | [coder encodeObject:[NSNumber numberWithUnsignedInteger:self.SSLPinningMode] forKey:NSStringFromSelector(@selector(SSLPinningMode))]; 327 | [coder encodeBool:self.allowInvalidCertificates forKey:NSStringFromSelector(@selector(allowInvalidCertificates))]; 328 | [coder encodeBool:self.validatesDomainName forKey:NSStringFromSelector(@selector(validatesDomainName))]; 329 | [coder encodeObject:self.pinnedCertificates forKey:NSStringFromSelector(@selector(pinnedCertificates))]; 330 | } 331 | 332 | #pragma mark - NSCopying 333 | 334 | - (instancetype)__attribute__((optnone))copyWithZone:(NSZone *)zone { 335 | AFSecurityPolicy *securityPolicy = [[[self class] allocWithZone:zone] init]; 336 | securityPolicy.SSLPinningMode = self.SSLPinningMode; 337 | securityPolicy.allowInvalidCertificates = self.allowInvalidCertificates; 338 | securityPolicy.validatesDomainName = self.validatesDomainName; 339 | securityPolicy.pinnedCertificates = [self.pinnedCertificates copyWithZone:zone]; 340 | 341 | return securityPolicy; 342 | } 343 | 344 | @end 345 | -------------------------------------------------------------------------------- /PUBG/ESP.mm: -------------------------------------------------------------------------------- 1 | // 2 | // WX:NongShiFu123 QQ:350722326 3 | // Created by 十三哥 on 2023/5/31. 4 | // Git:https://github.com/nongshifu/PUBG_China_imGui 5 | // 6 | #import 7 | #import 8 | #import 9 | #import "ESP.h" 10 | #import "GameVV.h" 11 | #import "PUBGDataModel.h" 12 | #import "PUBGTypeHeader.h" 13 | 14 | #include 15 | #include 16 | #include 17 | #define kWidth [UIScreen mainScreen].bounds.size.width 18 | #define kHeight [UIScreen mainScreen].bounds.size.height 19 | 20 | #pragma mark - 绘制函数 21 | //绘制线条 22 | static void DrawLine(ImVec2 startPoint, ImVec2 endPoint, int color, float thicknes = 1) 23 | { 24 | ImGui::GetOverlayDrawList()->AddLine(startPoint, endPoint, color, thicknes); 25 | } 26 | //绘制文字 27 | static void DrawText(std::string text, ImVec2 pos, bool isCentered, int color, bool outline, float fontSize) 28 | { 29 | const char *str = text.c_str(); 30 | ImVec2 vec2 = pos; 31 | 32 | if (isCentered) { 33 | ImFont* font = ImGui::GetFont(); 34 | font->Scale = 16 / font->FontSize; 35 | 36 | ImVec2 textSize = font->CalcTextSizeA(fontSize, MAXFLOAT, 0.0f, str); 37 | vec2.x -= textSize.x * 0.5f; 38 | } 39 | if (outline) 40 | { 41 | ImU32 outlineColor = 0xFF000000; 42 | ImGui::GetOverlayDrawList()->AddText(ImGui::GetFont(), fontSize, ImVec2(vec2.x + 1, vec2.y + 1), outlineColor, str); 43 | ImGui::GetOverlayDrawList()->AddText(ImGui::GetFont(), fontSize, ImVec2(vec2.x - 1, vec2.y - 1), outlineColor, str); 44 | ImGui::GetOverlayDrawList()->AddText(ImGui::GetFont(), fontSize, ImVec2(vec2.x + 1, vec2.y - 1), outlineColor, str); 45 | ImGui::GetOverlayDrawList()->AddText(ImGui::GetFont(), fontSize, ImVec2(vec2.x - 1, vec2.y + 1), outlineColor, str); 46 | } 47 | ImGui::GetOverlayDrawList()->AddText(ImGui::GetFont(), fontSize, vec2, color, str); 48 | } 49 | //绘制扇形 50 | static void DrawSector(ImDrawList* drawList, const ImVec2& center, float radius, float fromAngle, float toAngle, ImU32 color, int num_segments) 51 | { 52 | const float PI = 3.14159265358979323846f; 53 | 54 | // 计算角度 55 | fromAngle = fromAngle * PI / 180.0f; 56 | toAngle = toAngle * PI / 180.0f; 57 | 58 | // 计算每段的增量角 59 | float deltaAngle = (toAngle - fromAngle) / (float)num_segments; 60 | 61 | // 添加中心顶点 62 | drawList->PathLineTo(center); 63 | 64 | // 添加弧顶点 65 | for (int i = 0; i <= num_segments; ++i) 66 | { 67 | float angle = fromAngle + deltaAngle * (float)i; 68 | ImVec2 pos(center.x + radius * cosf(angle), center.y + radius * sinf(angle)); 69 | drawList->PathLineTo(pos); 70 | } 71 | 72 | //关闭路径 73 | drawList->PathFillConvex(color); 74 | } 75 | 76 | #pragma mark - 初始化全局变量 开关 颜色 搭配.h里面用extern作为全局变量 方便菜单那边读取和赋值 77 | bool 绘制总开关,过直播开关, 无后座开关,自瞄开关,追踪开关,手雷预警开关,聚点开关,防抖开关; 78 | bool 射线开关,骨骼开关,方框开关,距离开关,血条开关,名字开关,背景开关,边缘开关,附近人数开关,手持武器开关; 79 | bool 物资总开关,载具开关,药品开关,投掷物开关,枪械开关,配件开关,子弹开关,其他物资开关,高级物资开关,倍镜开关,头盔开关,护甲开关,背包开关,物资调试开关; 80 | float 追踪距离; 81 | float 追踪圆圈; 82 | int 追踪部位; 83 | float 自瞄速度; 84 | //初始化颜色 85 | ImVec4 血条颜色 = ImVec4(1.0f, 0.0f, 0.0f, 1.0f); 86 | ImVec4 方框颜色 = ImVec4(0.0f, 1.0f, 0.0f, 1.0f); 87 | ImVec4 射线颜色 = ImVec4(1.0f, 1.0f, 0.0f, 1.0f); 88 | ImVec4 骨骼颜色 = ImVec4(1.0f, 1.0f, 0.0f, 1.0f); 89 | ImVec4 距离颜色 = ImVec4(0.0f, 1.0f, 0.0f, 1.0f); 90 | ImVec4 手持武器颜色 = ImVec4(0.0f, 1.0f, 0.0f, 1.0f); 91 | ImVec4 名字颜色 = ImVec4(1.0f, 1.0f, 1.0f, 1.0f); 92 | ImVec4 背景颜色 = ImVec4(0.0f, 1.0f, 1.0f, 1.0f); 93 | ImVec4 物资颜色[15]; 94 | #pragma mark - 初始化队伍颜色向量 95 | // 根据队标生成不同颜色 96 | std::unordered_map team_colors; 97 | static ImVec4 GetTeamColor(int team_id) 98 | { 99 | // 检查地图中是否已存在团队颜色 100 | auto it = team_colors.find(team_id); 101 | if (it != team_colors.end()) { 102 | return it->second; 103 | } 104 | 105 | // Generate a new random color for the team 106 | 107 | static std::random_device rd; 108 | static std::mt19937 rng(rd()); 109 | std::uniform_real_distribution dist(0.0f, 1.0f); 110 | ImVec4 color(dist(rng), dist(rng), dist(rng), 1.0f); 111 | 112 | // Add the new color to themap 113 | team_colors.insert(std::make_pair(team_id, color)); 114 | 115 | return color; 116 | } 117 | //清空每局游戏结束清空 118 | static void EndGame() 119 | { 120 | team_colors.clear(); 121 | } 122 | 123 | #pragma mark - ESP 124 | 125 | @implementation ESP{ 126 | dispatch_source_t timer; 127 | } 128 | #pragma mark - 单例 129 | + (instancetype)sharedInstance { 130 | static ESP *sharedInstance = nil; 131 | static dispatch_once_t onceToken; 132 | dispatch_once(&onceToken, ^{ 133 | sharedInstance = [[self alloc] initWithFrame:[UIScreen mainScreen].bounds]; 134 | }); 135 | return sharedInstance; 136 | } 137 | #pragma mark - 当前页面视图初始化 138 | - (instancetype)initWithFrame:(CGRect)frame 139 | { 140 | self = [super initWithFrame:frame]; 141 | if (self) { 142 | 物资颜色[0] = ImVec4(1.0f, 0.0f, 0.0f, 1.0f); // 红色 143 | 物资颜色[1] = ImVec4(1.0f, 0.5f, 0.0f, 1.0f); // 橙色 144 | 物资颜色[2] = ImVec4(1.0f, 1.0f, 0.0f, 1.0f); // 黄色 145 | 物资颜色[3] = ImVec4(0.0f, 1.0f, 0.0f, 1.0f); // 绿色 146 | 物资颜色[4] = ImVec4(0.0f, 1.0f, 1.0f, 1.0f); // 青色 147 | 物资颜色[5] = ImVec4(0.0f, 0.0f, 1.0f, 1.0f); // 蓝色 148 | 物资颜色[6] = ImVec4(0.5f, 0.0f, 1.0f, 1.0f); // 紫色 149 | 物资颜色[7] = ImVec4(1.0f, 0.0f, 1.0f, 1.0f); // 粉色 150 | 物资颜色[8] = ImVec4(0.5f, 0.5f, 0.5f, 1.0f); // 灰色 151 | 物资颜色[9] = ImVec4(1.0f, 1.0f, 1.0f, 1.0f); // 白色 152 | 物资颜色[10] = ImVec4(0.0f, 0.0f, 0.0f, 1.0f); // 黑色 153 | 物资颜色[11] = ImVec4(0.5f, 0.7f, 0.2f, 1.0f); // 深绿色 154 | 物资颜色[12] = ImVec4(0.8f, 0.2f, 0.8f, 1.0f); // 紫红色 155 | 物资颜色[13] = ImVec4(0.7f, 0.7f, 0.7f, 1.0f); // 浅灰色 156 | 物资颜色[14] = ImVec4(0.2f, 0.2f, 0.2f, 1.0f); // 深灰色 157 | } 158 | return self; 159 | } 160 | 161 | #pragma mark - 绘制玩家 162 | //绘制玩家 163 | 164 | - (void)绘制玩家:(ImDrawList*)MsDrawList{ 165 | //创建单例 每秒读取一次玩家数组 166 | static dispatch_once_t onceToken; 167 | dispatch_once(&onceToken, ^{ 168 | 169 | // 创建 GCD定时器 170 | timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_main_queue()); 171 | 172 | // 设置定时器的执行时间间隔、起始时间和精度 173 | uint64_t interval = 2 * NSEC_PER_SEC; // 时间间隔为2秒 174 | uint64_t leeway = 0 * NSEC_PER_SEC; // 定时器的精度为0秒 175 | dispatch_time_t startTime = dispatch_time(DISPATCH_TIME_NOW, 0); 176 | dispatch_source_set_timer(timer, startTime, interval, leeway); 177 | 178 | // 设置定时器的执行任务 179 | dispatch_source_set_event_handler(timer, ^{ 180 | // 定时器每执行一次,就会调用这个 block 中的代码 181 | //多线程 182 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ 183 | //回到主线程的方法 184 | [[GameVV factory] getNSArray];//每秒读取一次玩家数组 185 | 186 | }); 187 | 188 | 189 | }); 190 | 191 | // 启动定时器 192 | dispatch_resume(timer); 193 | 194 | }); 195 | 196 | //开始读取数据和绘制 197 | if(!绘制总开关)return; 198 | NSArray*playerArray=[[GameVV factory] getData]; 199 | //绘制玩家 200 | int 真人=0; 201 | int 人机=0; 202 | for (NSInteger i = 0; i < playerArray.count; i++) { 203 | PUBGPlayerModel *model = playerArray[i]; 204 | static CGFloat x = 0; 205 | static CGFloat y = 0; 206 | static CGFloat w = 0; 207 | static CGFloat h = 0; 208 | //开始绘制 解析玩家方框 209 | x = model.rect.X; 210 | y = model.rect.Y; 211 | w = model.rect.W; 212 | h = model.rect.H; 213 | float xd = x+w/2; 214 | float yd = y; 215 | //屏幕外面 只绘制射线然后跳出 执行下一个玩家 避免绘制其他占用内存CPU=============== 216 | if (model.isAI) { 217 | 人机++; 218 | }else{ 219 | 真人++; 220 | } 221 | if (model.isPm==NO){ 222 | if(射线开关){ 223 | MsDrawList->AddLine(ImVec2(kWidth/2, 40), ImVec2(xd, yd-40),ImColor(model.isAI ? ImVec4(0.0f, 1.0f, 0.0f, 1.0f) : 射线颜色 ),1); 224 | } 225 | continue; 226 | } 227 | 228 | 229 | //屏幕里面 由开关控制绘制内容======================= 230 | //射线 231 | if(射线开关){ 232 | MsDrawList->AddLine(ImVec2(kWidth/2, 40), ImVec2(xd, yd-40),ImColor(model.isAI ? ImVec4(0.0f, 1.0f, 0.0f, 1.0f) : 射线颜色 ),1); 233 | } 234 | if(追踪开关){ 235 | MsDrawList->AddCircle(ImVec2(kWidth/2, kHeight/2), 追踪圆圈, ImColor(射线颜色)); 236 | } 237 | 238 | if(背景开关){ 239 | //信息背景 240 | ImVec4 背景颜色 = GetTeamColor(model.TeamID); 241 | MsDrawList->AddLine(ImVec2(xd-40,yd-16), ImVec2(xd+40,yd-16), ImColor(model.isAI ? ImVec4(0.0f, 0.0f, 1.0f, 1.0f) : 背景颜色 ),13); 242 | 243 | //对标背景 244 | MsDrawList->AddLine(ImVec2(xd-40,yd-16), ImVec2(xd-25,yd-16), ImColor(ImVec4(1.0f, 0.0f, 1.0f, 0.7f)),14); 245 | } 246 | if (名字开关) { 247 | //名字 248 | if (model.PlayerName.length>1) { 249 | char* ii = (char*) [model.PlayerName cStringUsingEncoding:NSUTF8StringEncoding]; 250 | DrawText(ii, ImVec2(xd+10 , y-21), true, ImColor(名字颜色), false, 10); 251 | } 252 | 253 | 254 | //对标 255 | if (model.TeamID > 0) { 256 | char* i = (char*) [[NSString stringWithFormat:@"%d",model.TeamID] cStringUsingEncoding:NSUTF8StringEncoding]; 257 | DrawText(i, ImVec2(xd-30 , y-21), true, ImColor(ImVec4(1.0f, 1.0f, 0.0f, 1.0f)), false, 10); 258 | } 259 | 260 | } 261 | if(距离开关 && (int)model.Distance>1){ 262 | //距离 263 | char* juli = (char*) [[NSString stringWithFormat:@"%dm",(int)model.Distance] cStringUsingEncoding:NSUTF8StringEncoding]; 264 | DrawText(juli, ImVec2(xd+20, yd-35), true, ImColor(距离颜色), false, 12); 265 | 266 | } 267 | 268 | if(血条开关){ 269 | //血条背景 270 | MsDrawList->AddLine(ImVec2(xd-40,yd-9), ImVec2(xd+40,yd-9), ImColor(0xFFFFFFFF),3);//白色 271 | //血条 272 | MsDrawList->AddLine(ImVec2(xd-40,yd-9), ImVec2(xd-40+0.8*model.Health,yd-9), ImColor(model.isAI ? ImVec4(0.0f, 1.0f, 1.0f, 0.0f) : 血条颜色 ),3); 273 | } 274 | 275 | if (手持武器开关 && model.WeaponName.length>1) { 276 | 277 | char* dis = (char*) [[NSString stringWithFormat:@"%@",model.WeaponName] cStringUsingEncoding:NSUTF8StringEncoding]; 278 | DrawText(dis, ImVec2(xd-20, yd-35), true, ImColor(ImVec4(1.0f, 1.0f, 1.0f, 1.0f)), false, 10); 279 | } 280 | 281 | if(方框开关){ 282 | for (int i = 0; i < 8; i++) { 283 | float x1, y1, x2, y2; 284 | switch (i) { 285 | case 0: // 左上角横线 286 | x1 = x; 287 | y1 = y; 288 | x2 = x + w / 4; 289 | y2 = y; 290 | break; 291 | case 1: // 右上角横线 292 | x1 = x + w; 293 | y1 = y; 294 | x2 = x + w - w/4; 295 | y2 = y; 296 | break; 297 | case 2: // 左下角横线 298 | x1 = x; 299 | y1 = y + h; 300 | x2 = x + w/4; 301 | y2 = y + h; 302 | break; 303 | case 3: // 右下角横线 304 | x1 = x + w; 305 | y1 = y + h; 306 | x2 = x + w - w/4; 307 | y2 = y + h; 308 | break; 309 | case 4: // 左上侧竖线 310 | x1 = x; 311 | y1 = y; 312 | x2 = x; 313 | y2 = y + h / 4; 314 | break; 315 | case 5: // 右上侧竖线 316 | x1 = x + w; 317 | y1 = y; 318 | x2 = x + w; 319 | y2 = y + h / 4; 320 | break; 321 | case 6: // 左侧底部部竖线 322 | x1 = x; 323 | y1 = y + h; 324 | x2 = x; 325 | y2 = y + h - h/4; 326 | break; 327 | case 7: // 右侧底部部竖线 328 | x1 = x + w; 329 | y1 = y + h; 330 | x2 = x + w; 331 | y2 = y + h - h/4; 332 | break; 333 | } 334 | MsDrawList->AddLine(ImVec2(x1, y1), ImVec2(x2, y2), ImColor(方框颜色), 1); 335 | 336 | } 337 | 338 | } 339 | if (骨骼开关) { 340 | //躯干 341 | DrawLine(ImVec2(model._0.X, model._0.Y),ImVec2(model._1.X, model._1.Y),ImColor(model.isAI ? ImVec4(0.0f, 1.0f, 0.0f, 1.0f) : 骨骼颜色), 1); 342 | DrawLine(ImVec2(model._1.X, model._1.Y),ImVec2(model._2.X, model._2.Y),ImColor(model.isAI ? ImVec4(0.0f, 1.0f, 0.0f, 1.0f) : 骨骼颜色), 1); 343 | DrawLine(ImVec2(model._2.X, model._2.Y),ImVec2(model._3.X, model._3.Y),ImColor(model.isAI ? ImVec4(0.0f, 1.0f, 0.0f, 1.0f) : 骨骼颜色), 1); 344 | DrawLine(ImVec2(model._3.X, model._3.Y),ImVec2(model._4.X, model._4.Y),ImColor(model.isAI ? ImVec4(0.0f, 1.0f, 0.0f, 1.0f) : 骨骼颜色), 1); 345 | DrawLine(ImVec2(model._4.X, model._4.Y),ImVec2(model._5.X, model._5.Y),ImColor(model.isAI ? ImVec4(0.0f, 1.0f, 0.0f, 1.0f) : 骨骼颜色), 1); 346 | 347 | //胸-有肩膀-右肘-右手 348 | DrawLine(ImVec2(model._2.X, model._2.Y),ImVec2(model._6.X, model._6.Y),ImColor(model.isAI ? ImVec4(0.0f, 1.0f, 0.0f, 1.0f) : 骨骼颜色), 1); 349 | DrawLine(ImVec2(model._6.X, model._6.Y),ImVec2(model._7.X, model._7.Y),ImColor(model.isAI ? ImVec4(0.0f, 1.0f, 0.0f, 1.0f) : 骨骼颜色), 1); 350 | DrawLine(ImVec2(model._7.X, model._7.Y),ImVec2(model._8.X, model._8.Y),ImColor(model.isAI ? ImVec4(0.0f, 1.0f, 0.0f, 1.0f) : 骨骼颜色), 1); 351 | // 352 | //胸-腰-盆骨 353 | DrawLine(ImVec2(model._2.X, model._2.Y),ImVec2(model._9.X, model._9.Y),ImColor(model.isAI ? ImVec4(0.0f, 1.0f, 0.0f, 1.0f) : 骨骼颜色), 1); 354 | DrawLine(ImVec2(model._9.X, model._9.Y),ImVec2(model._10.X, model._10.Y),ImColor(model.isAI ? ImVec4(0.0f, 1.0f, 0.0f, 1.0f) : 骨骼颜色), 1); 355 | DrawLine(ImVec2(model._10.X, model._10.Y),ImVec2(model._11.X, model._11.Y),ImColor(model.isAI ? ImVec4(0.0f, 1.0f, 0.0f, 1.0f) : 骨骼颜色), 1); 356 | 357 | //盆骨-左盆骨 358 | DrawLine(ImVec2(model._5.X, model._5.Y),ImVec2(model._12.X, model._12.Y),ImColor(model.isAI ? ImVec4(0.0f, 1.0f, 0.0f, 1.0f) : 骨骼颜色), 1); 359 | //左盆骨-左膝盖 360 | DrawLine(ImVec2(model._12.X, model._12.Y),ImVec2(model._13.X, model._13.Y),ImColor(model.isAI ? ImVec4(0.0f, 1.0f, 0.0f, 1.0f) : 骨骼颜色), 1); 361 | //左膝盖-左脚 362 | DrawLine(ImVec2(model._13.X, model._13.Y),ImVec2(model._14.X, model._14.Y),ImColor(model.isAI ? ImVec4(0.0f, 1.0f, 0.0f, 1.0f) : 骨骼颜色), 1); 363 | 364 | //盆骨-右盆骨 365 | DrawLine(ImVec2(model._5.X, model._5.Y),ImVec2(model._15.X, model._15.Y),ImColor(model.isAI ? ImVec4(0.0f, 1.0f, 0.0f, 1.0f) : 骨骼颜色), 1); 366 | //右盆骨-右膝盖 367 | DrawLine(ImVec2(model._15.X, model._15.Y),ImVec2(model._16.X, model._16.Y),ImColor(model.isAI ? ImVec4(0.0f, 1.0f, 0.0f, 1.0f) : 骨骼颜色), 1); 368 | //右膝盖-右脚 369 | DrawLine(ImVec2(model._16.X, model._16.Y),ImVec2(model._17.X, model._17.Y),ImColor(model.isAI ? ImVec4(0.0f, 1.0f, 0.0f, 1.0f) : 骨骼颜色), 1); 370 | } 371 | } 372 | if (附近人数开关) { 373 | NSString *resnhustr; 374 | if (playerArray.count == 0) { 375 | EndGame();//清空队伍颜色 376 | resnhustr = @"安全"; 377 | } else { 378 | resnhustr = [NSString stringWithFormat:@" 真人:%d AI:%d", 真人,人机]; 379 | } 380 | const char *cString = [resnhustr cStringUsingEncoding:NSUTF8StringEncoding]; 381 | DrawText(cString, ImVec2(kWidth/2 , 10), true, ImColor(ImVec4(1.0f, 0.0f, 0.0f, 1.0f)), false, 20); 382 | } 383 | 384 | NSArray*wzArray=[[GameVV factory] getwzData]; 385 | for (NSInteger i = 0; i < wzArray.count; i++){ 386 | 387 | PUBGPlayerWZ *mode = wzArray[i]; 388 | NSString*NewName=[NSString stringWithFormat:@"%@ %.1f",mode.Name,mode.JuLi]; 389 | 390 | if (NewName.length>1) { 391 | const char *cString = [NewName cStringUsingEncoding:NSUTF8StringEncoding]; 392 | DrawText(cString, ImVec2(mode.WuZhi2D.X , mode.WuZhi2D.Y), true, ImColor(ImVec4(物资颜色[mode.Fenlei])), false, 10); 393 | } 394 | } 395 | 396 | } 397 | 398 | 399 | @end 400 | -------------------------------------------------------------------------------- /Bsphp/AFNetworking/AFHTTPSessionManager.m: -------------------------------------------------------------------------------- 1 | // AFHTTPSessionManager.m 2 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import "AFHTTPSessionManager.h" 23 | 24 | #import "AFURLRequestSerialization.h" 25 | #import "AFURLResponseSerialization.h" 26 | 27 | #import 28 | #import 29 | #import 30 | 31 | #import 32 | #import 33 | #import 34 | #import 35 | #import 36 | 37 | #if TARGET_OS_IOS || TARGET_OS_TV 38 | #import 39 | #elif TARGET_OS_WATCH 40 | #import 41 | #endif 42 | 43 | @interface AFHTTPSessionManager () 44 | @property (readwrite, nonatomic, strong) NSURL *baseURL; 45 | @end 46 | 47 | @implementation AFHTTPSessionManager 48 | @dynamic responseSerializer; 49 | 50 | + (instancetype)__attribute__((optnone))manager { 51 | return [[[self class] alloc] initWithBaseURL:nil]; 52 | } 53 | 54 | - (instancetype)__attribute__((optnone))init { 55 | return [self initWithBaseURL:nil]; 56 | } 57 | 58 | - (instancetype)__attribute__((optnone))initWithBaseURL:(NSURL *)url { 59 | return [self initWithBaseURL:url sessionConfiguration:nil]; 60 | } 61 | 62 | - (instancetype)__attribute__((optnone))initWithSessionConfiguration:(NSURLSessionConfiguration *)configuration { 63 | return [self initWithBaseURL:nil sessionConfiguration:configuration]; 64 | } 65 | 66 | - (instancetype)__attribute__((optnone))initWithBaseURL:(NSURL *)url 67 | sessionConfiguration:(NSURLSessionConfiguration *)configuration 68 | { 69 | self = [super initWithSessionConfiguration:configuration]; 70 | if (!self) { 71 | return nil; 72 | } 73 | 74 | // Ensure terminal slash for baseURL path, so that NSURL +URLWithString:relativeToURL: works as expected 75 | if ([[url path] length] > 0 && ![[url absoluteString] hasSuffix:@"/"]) { 76 | url = [url URLByAppendingPathComponent:@""]; 77 | } 78 | 79 | self.baseURL = url; 80 | 81 | self.requestSerializer = [AFHTTPRequestSerializer serializer]; 82 | self.responseSerializer = [AFJSONResponseSerializer serializer]; 83 | 84 | return self; 85 | } 86 | 87 | #pragma mark - 88 | 89 | - (void)__attribute__((optnone))setRequestSerializer:(AFHTTPRequestSerializer *)requestSerializer { 90 | NSParameterAssert(requestSerializer); 91 | 92 | _requestSerializer = requestSerializer; 93 | } 94 | 95 | - (void)__attribute__((optnone))setResponseSerializer:(AFHTTPResponseSerializer *)responseSerializer { 96 | NSParameterAssert(responseSerializer); 97 | 98 | [super setResponseSerializer:responseSerializer]; 99 | } 100 | 101 | @dynamic securityPolicy; 102 | 103 | - (void)__attribute__((optnone))setSecurityPolicy:(AFSecurityPolicy *)securityPolicy { 104 | if (securityPolicy.SSLPinningMode != AFSSLPinningModeNone && ![self.baseURL.scheme isEqualToString:@"https"]) { 105 | NSString *pinningMode = @"Unknown Pinning Mode"; 106 | switch (securityPolicy.SSLPinningMode) { 107 | case AFSSLPinningModeNone: pinningMode = @"AFSSLPinningModeNone"; break; 108 | case AFSSLPinningModeCertificate: pinningMode = @"AFSSLPinningModeCertificate"; break; 109 | case AFSSLPinningModePublicKey: pinningMode = @"AFSSLPinningModePublicKey"; break; 110 | } 111 | NSString *reason = [NSString stringWithFormat:@"A security policy configured with `%@` can only be applied on a manager with a secure base URL (i.e. https)", pinningMode]; 112 | @throw [NSException exceptionWithName:@"Invalid Security Policy" reason:reason userInfo:nil]; 113 | } 114 | 115 | [super setSecurityPolicy:securityPolicy]; 116 | } 117 | 118 | #pragma mark - 119 | 120 | - (NSURLSessionDataTask *)__attribute__((optnone))GET:(NSString *)URLString 121 | parameters:(id)parameters 122 | success:(void (^)(NSURLSessionDataTask *task, id responseObject))success 123 | failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure 124 | { 125 | 126 | return [self GET:URLString parameters:parameters progress:nil success:success failure:failure]; 127 | } 128 | 129 | - (NSURLSessionDataTask *)__attribute__((optnone))GET:(NSString *)URLString 130 | parameters:(id)parameters 131 | progress:(void (^)(NSProgress * _Nonnull))downloadProgress 132 | success:(void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success 133 | failure:(void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure 134 | { 135 | 136 | NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"GET" 137 | URLString:URLString 138 | parameters:parameters 139 | uploadProgress:nil 140 | downloadProgress:downloadProgress 141 | success:success 142 | failure:failure]; 143 | 144 | [dataTask resume]; 145 | 146 | return dataTask; 147 | } 148 | 149 | - (NSURLSessionDataTask *)__attribute__((optnone))HEAD:(NSString *)URLString 150 | parameters:(id)parameters 151 | success:(void (^)(NSURLSessionDataTask *task))success 152 | failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure 153 | { 154 | NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"HEAD" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:^(NSURLSessionDataTask *task, __unused id responseObject) { 155 | if (success) { 156 | success(task); 157 | } 158 | } failure:failure]; 159 | 160 | [dataTask resume]; 161 | 162 | return dataTask; 163 | } 164 | 165 | - (NSURLSessionDataTask *)__attribute__((optnone))POST:(NSString *)URLString 166 | parameters:(id)parameters 167 | success:(void (^)(NSURLSessionDataTask *task, id responseObject))success 168 | failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure 169 | { 170 | return [self POST:URLString parameters:parameters progress:nil success:success failure:failure]; 171 | } 172 | 173 | - (NSURLSessionDataTask *)__attribute__((optnone))POST:(NSString *)URLString 174 | parameters:(id)parameters 175 | progress:(void (^)(NSProgress * _Nonnull))uploadProgress 176 | success:(void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success 177 | failure:(void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure 178 | { 179 | NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"POST" URLString:URLString parameters:parameters uploadProgress:uploadProgress downloadProgress:nil success:success failure:failure]; 180 | 181 | [dataTask resume]; 182 | 183 | return dataTask; 184 | } 185 | 186 | - (NSURLSessionDataTask *)__attribute__((optnone))POST:(NSString *)URLString 187 | parameters:(nullable id)parameters 188 | constructingBodyWithBlock:(nullable void (^)(id _Nonnull))block 189 | success:(nullable void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success 190 | failure:(nullable void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure 191 | { 192 | return [self POST:URLString parameters:parameters constructingBodyWithBlock:block progress:nil success:success failure:failure]; 193 | } 194 | 195 | - (NSURLSessionDataTask *)__attribute__((optnone))POST:(NSString *)URLString 196 | parameters:(id)parameters 197 | constructingBodyWithBlock:(void (^)(id formData))block 198 | progress:(nullable void (^)(NSProgress * _Nonnull))uploadProgress 199 | success:(void (^)(NSURLSessionDataTask *task, id responseObject))success 200 | failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure 201 | { 202 | NSError *serializationError = nil; 203 | NSMutableURLRequest *request = [self.requestSerializer multipartFormRequestWithMethod:@"POST" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters constructingBodyWithBlock:block error:&serializationError]; 204 | if (serializationError) { 205 | if (failure) { 206 | dispatch_async(self.completionQueue ?: dispatch_get_main_queue(), ^{ 207 | failure(nil, serializationError); 208 | }); 209 | } 210 | 211 | return nil; 212 | } 213 | 214 | __block NSURLSessionDataTask *task = [self uploadTaskWithStreamedRequest:request progress:uploadProgress completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) { 215 | if (error) { 216 | if (failure) { 217 | failure(task, error); 218 | } 219 | } else { 220 | if (success) { 221 | success(task, responseObject); 222 | } 223 | } 224 | }]; 225 | 226 | [task resume]; 227 | 228 | return task; 229 | } 230 | 231 | - (NSURLSessionDataTask *)__attribute__((optnone))PUT:(NSString *)URLString 232 | parameters:(id)parameters 233 | success:(void (^)(NSURLSessionDataTask *task, id responseObject))success 234 | failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure 235 | { 236 | NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"PUT" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:success failure:failure]; 237 | 238 | [dataTask resume]; 239 | 240 | return dataTask; 241 | } 242 | 243 | - (NSURLSessionDataTask *)__attribute__((optnone))PATCH:(NSString *)URLString 244 | parameters:(id)parameters 245 | success:(void (^)(NSURLSessionDataTask *task, id responseObject))success 246 | failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure 247 | { 248 | NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"PATCH" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:success failure:failure]; 249 | 250 | [dataTask resume]; 251 | 252 | return dataTask; 253 | } 254 | 255 | - (NSURLSessionDataTask *)__attribute__((optnone))DELETE:(NSString *)URLString 256 | parameters:(id)parameters 257 | success:(void (^)(NSURLSessionDataTask *task, id responseObject))success 258 | failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure 259 | { 260 | NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"DELETE" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:success failure:failure]; 261 | 262 | [dataTask resume]; 263 | 264 | return dataTask; 265 | } 266 | 267 | - (NSURLSessionDataTask *)__attribute__((optnone))dataTaskWithHTTPMethod:(NSString *)method 268 | URLString:(NSString *)URLString 269 | parameters:(id)parameters 270 | uploadProgress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgress 271 | downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgress 272 | success:(void (^)(NSURLSessionDataTask *, id))success 273 | failure:(void (^)(NSURLSessionDataTask *, NSError *))failure 274 | { 275 | NSError *serializationError = nil; 276 | NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:method URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters error:&serializationError]; 277 | if (serializationError) { 278 | if (failure) { 279 | dispatch_async(self.completionQueue ?: dispatch_get_main_queue(), ^{ 280 | failure(nil, serializationError); 281 | }); 282 | } 283 | 284 | return nil; 285 | } 286 | 287 | __block NSURLSessionDataTask *dataTask = nil; 288 | dataTask = [self dataTaskWithRequest:request 289 | uploadProgress:uploadProgress 290 | downloadProgress:downloadProgress 291 | completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) { 292 | if (error) { 293 | if (failure) { 294 | failure(dataTask, error); 295 | } 296 | } else { 297 | if (success) { 298 | success(dataTask, responseObject); 299 | } 300 | } 301 | }]; 302 | 303 | return dataTask; 304 | } 305 | 306 | #pragma mark - NSObject 307 | 308 | - (NSString *)__attribute__((optnone))description { 309 | return [NSString stringWithFormat:@"<%@: %p, baseURL: %@, session: %@, operationQueue: %@>", NSStringFromClass([self class]), self, [self.baseURL absoluteString], self.session, self.operationQueue]; 310 | } 311 | 312 | #pragma mark - NSSecureCoding 313 | 314 | + (BOOL)__attribute__((optnone))supportsSecureCoding { 315 | return YES; 316 | } 317 | 318 | - (instancetype)__attribute__((optnone))initWithCoder:(NSCoder *)decoder { 319 | NSURL *baseURL = [decoder decodeObjectOfClass:[NSURL class] forKey:NSStringFromSelector(@selector(baseURL))]; 320 | NSURLSessionConfiguration *configuration = [decoder decodeObjectOfClass:[NSURLSessionConfiguration class] forKey:@"sessionConfiguration"]; 321 | if (!configuration) { 322 | NSString *configurationIdentifier = [decoder decodeObjectOfClass:[NSString class] forKey:@"identifier"]; 323 | if (configurationIdentifier) { 324 | #if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1100) 325 | configuration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:configurationIdentifier]; 326 | #else 327 | configuration = [NSURLSessionConfiguration backgroundSessionConfiguration:configurationIdentifier]; 328 | #endif 329 | } 330 | } 331 | 332 | self = [self initWithBaseURL:baseURL sessionConfiguration:configuration]; 333 | if (!self) { 334 | return nil; 335 | } 336 | 337 | self.requestSerializer = [decoder decodeObjectOfClass:[AFHTTPRequestSerializer class] forKey:NSStringFromSelector(@selector(requestSerializer))]; 338 | self.responseSerializer = [decoder decodeObjectOfClass:[AFHTTPResponseSerializer class] forKey:NSStringFromSelector(@selector(responseSerializer))]; 339 | AFSecurityPolicy *decodedPolicy = [decoder decodeObjectOfClass:[AFSecurityPolicy class] forKey:NSStringFromSelector(@selector(securityPolicy))]; 340 | if (decodedPolicy) { 341 | self.securityPolicy = decodedPolicy; 342 | } 343 | 344 | return self; 345 | } 346 | 347 | - (void)__attribute__((optnone))encodeWithCoder:(NSCoder *)coder { 348 | [super encodeWithCoder:coder]; 349 | 350 | [coder encodeObject:self.baseURL forKey:NSStringFromSelector(@selector(baseURL))]; 351 | if ([self.session.configuration conformsToProtocol:@protocol(NSCoding)]) { 352 | [coder encodeObject:self.session.configuration forKey:@"sessionConfiguration"]; 353 | } else { 354 | [coder encodeObject:self.session.configuration.identifier forKey:@"identifier"]; 355 | } 356 | [coder encodeObject:self.requestSerializer forKey:NSStringFromSelector(@selector(requestSerializer))]; 357 | [coder encodeObject:self.responseSerializer forKey:NSStringFromSelector(@selector(responseSerializer))]; 358 | [coder encodeObject:self.securityPolicy forKey:NSStringFromSelector(@selector(securityPolicy))]; 359 | } 360 | 361 | #pragma mark - NSCopying 362 | 363 | - (instancetype)__attribute__((optnone))copyWithZone:(NSZone *)zone { 364 | AFHTTPSessionManager *HTTPClient = [[[self class] allocWithZone:zone] initWithBaseURL:self.baseURL sessionConfiguration:self.session.configuration]; 365 | 366 | HTTPClient.requestSerializer = [self.requestSerializer copyWithZone:zone]; 367 | HTTPClient.responseSerializer = [self.responseSerializer copyWithZone:zone]; 368 | HTTPClient.securityPolicy = [self.securityPolicy copyWithZone:zone]; 369 | return HTTPClient; 370 | } 371 | 372 | @end 373 | -------------------------------------------------------------------------------- /UIMem/ImGuiMem.mm: -------------------------------------------------------------------------------- 1 | // 2 | // WX:NongShiFu123 QQ:350722326 3 | // Created by 十三哥 on 2023/5/31. 4 | // Git:https://github.com/nongshifu/PUBG_China_imGui 5 | // 6 | #import "ImGuiMem.h" 7 | #import 8 | #import 9 | #import 10 | #import 11 | #import 12 | #import 13 | #import "YMUIWindow.h" 14 | #import "PubgLoad.h" 15 | #import "GameVV.h" 16 | #import "QQ350722326.h" 17 | #import "ESP.h" 18 | #define kWidth [UIScreen mainScreen].bounds.size.width 19 | #define kHeight [UIScreen mainScreen].bounds.size.height 20 | 21 | //Text:文本颜色 22 | //TextDisabled:禁用文本颜色 23 | //WindowBg:窗口背景颜色 24 | //ChildBg:子窗口背景颜色 25 | //PopupBg:弹出窗口背景颜色 26 | //Border:边框颜色 27 | //BorderShadow:边框阴影颜色 28 | //FrameBg:框架背景颜色 29 | //FrameBgHovered:鼠标悬停时的框架背景颜色 30 | //FrameBgActive:被按下时的框架背景颜色 31 | //TitleBg:标题栏背景颜色 32 | //TitleBgActive:被激活的标题栏背景颜色 33 | //TitleBgCollapsed:折叠的标题栏背景颜色 34 | //MenuBarBg:菜单栏背景颜色 35 | //ScrollbarBg:滚动条背景颜色 36 | //ScrollbarGrab:滚动条抓手颜色 37 | //ScrollbarGrabHovered:鼠标悬停时的滚动条抓手颜色 38 | //ScrollbarGrabActive:被按下时的滚动条抓手颜色 39 | //CheckMark:复选框标记颜色 40 | //SliderGrab:滑块颜色 41 | //SliderGrabActive:被按下时的滑块颜色 42 | //Button:按钮颜色 43 | //ButtonHovered:鼠标悬停时的按钮颜色 44 | //ButtonActive:被按下时的按钮颜色 45 | //Header:标头背景颜色 46 | //HeaderHovered:鼠标悬停时的标头背景颜色 47 | //HeaderActive:被按下时的标头背景颜色 48 | //Separator:分隔符颜色 49 | //SeparatorHovered:鼠标悬停时的分隔符颜色 50 | //SeparatorActive:被按下时的分隔符颜色 51 | //ResizeGrip:调整大小手柄颜色 52 | //ResizeGripHovered:鼠标悬停时的调整大小手柄颜色 53 | //ResizeGripActive:被按下时的调整大小手柄颜色 54 | //PlotLines:线性图线条颜色 55 | //PlotLinesHovered:鼠标悬停时的线性图线条颜色 56 | //PlotHistogram:直方图颜色 57 | //PlotHistogramHovered:鼠标悬停时的直方图颜色 58 | //TextSelectedBg:文本选中时的背景颜色 59 | //例子 60 | //ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.2f, 0.3f, 0.4f, 1.0f)); // 将被按下时按钮的颜色设置为深蓝色 61 | @interface ImGuiMem () 62 | 63 | @property (nonatomic, strong) MTKView *mtkView; 64 | @property (nonatomic, strong) id device; 65 | @property (nonatomic, strong) id commandQueue; 66 | 67 | @end 68 | 69 | 70 | @implementation ImGuiMem 71 | static int 字体大小; 72 | + (instancetype)sharedInstance { 73 | static ImGuiMem *sharedInstance = nil; 74 | static dispatch_once_t onceToken; 75 | dispatch_once(&onceToken, ^{ 76 | sharedInstance = [[self alloc] initWithFrame:[YMUIWindow sharedInstance].bounds]; 77 | 78 | }); 79 | return sharedInstance; 80 | } 81 | 82 | - (instancetype)initWithFrame:(CGRect)frame 83 | { 84 | self = [super initWithFrame:frame]; 85 | if (self) { 86 | 字体大小=15; 87 | self.secureTextEntry=YES; 88 | _device = MTLCreateSystemDefaultDevice(); 89 | _commandQueue = [_device newCommandQueue]; 90 | 91 | if (!self.device) abort(); 92 | 93 | IMGUI_CHECKVERSION(); 94 | ImGui::CreateContext(); 95 | ImGuiIO& io = ImGui::GetIO(); (void)io; 96 | 97 | ImGui::StyleColorsDark(); 98 | // ImGui::StyleColorsLight(); 99 | //系统默认字体 100 | // NSString *FontPath = @"/System/Library/Fonts/LanguageSupport/PingFang.ttc"; 101 | // io.Fonts->AddFontFromFileTTF(FontPath.UTF8String, 40.f,NULL,io.Fonts->GetGlyphRangesChineseFull()); 102 | //第三方字体 103 | ImFontConfig config; 104 | config.FontDataOwnedByAtlas = false; 105 | io.Fonts->AddFontFromMemoryTTF((void *)jijia_data, jijia_size, 15, NULL,io.Fonts->GetGlyphRangesChineseFull()); 106 | 107 | 108 | //加载 109 | ImGui_ImplMetal_Init(_device); 110 | 111 | CGFloat w = CGRectGetWidth(frame); 112 | CGFloat h = CGRectGetHeight(frame); 113 | self.mtkView = [[MTKView alloc] initWithFrame:CGRectMake(0, 0, w, h) device:_device]; 114 | self.mtkView.clearColor = MTLClearColorMake(0, 0, 0, 0); 115 | self.mtkView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0]; 116 | self.mtkView.clipsToBounds = YES; 117 | self.mtkView.delegate = self; 118 | 119 | 120 | [self.subviews.firstObject addSubview:self.mtkView]; 121 | 122 | // 禁用键盘响应 123 | self.userInteractionEnabled = YES; 124 | } 125 | return self; 126 | } 127 | 128 | - (BOOL)canBecomeFirstResponder { 129 | return NO; 130 | } 131 | 132 | - (void)layoutSubviews { 133 | [super layoutSubviews]; 134 | 135 | CGFloat w = CGRectGetWidth(self.frame); 136 | CGFloat h = CGRectGetHeight(self.frame); 137 | self.mtkView.frame = CGRectMake(0, 0, w, h); 138 | } 139 | 140 | #pragma mark - MTKViewDelegate 141 | 142 | 143 | - (void)drawInMTKView:(MTKView*)view 144 | { 145 | ImGuiIO& io = ImGui::GetIO(); 146 | io.DisplaySize.x = view.bounds.size.width; 147 | io.DisplaySize.y = view.bounds.size.height; 148 | 149 | CGFloat framebufferScale = view.window.screen.scale ?: UIScreen.mainScreen.scale; 150 | io.DisplayFramebufferScale = ImVec2(framebufferScale, framebufferScale); 151 | io.DeltaTime = 1 / float(view.preferredFramesPerSecond ?: 60); 152 | 153 | id commandBuffer = [self.commandQueue commandBuffer]; 154 | 155 | MTLRenderPassDescriptor* renderPassDescriptor = view.currentRenderPassDescriptor; 156 | if (renderPassDescriptor != nil) 157 | { 158 | id renderEncoder = [commandBuffer renderCommandEncoderWithDescriptor:renderPassDescriptor]; 159 | [renderEncoder pushDebugGroup:@"ImGui shisange"]; 160 | 161 | ImGui_ImplMetal_NewFrame(renderPassDescriptor); 162 | ImGui::NewFrame(); 163 | 164 | //默认窗口大小 165 | CGFloat width =350;//宽度 166 | CGFloat height =300;//高度 167 | ImGui::SetNextWindowSize(ImVec2(width, height), ImGuiCond_FirstUseEver);//大小 168 | 169 | //默认显示位置 屏幕中央 170 | CGFloat x = ((self.frame.size.width) - width) / 2; 171 | CGFloat y = ((self.frame.size.height) - height) / 2; 172 | 173 | ImGui::SetNextWindowPos(ImVec2(x, y), ImGuiCond_FirstUseEver);//默认位置 174 | //开始绘制========================== 175 | ImDrawList*MsDrawList = ImGui::GetForegroundDrawList();//读取整个菜单元素 176 | [self Drawing:MsDrawList]; 177 | 178 | ImGui::Render(); 179 | ImDrawData* draw_data = ImGui::GetDrawData(); 180 | ImGui_ImplMetal_RenderDrawData(draw_data, commandBuffer, renderEncoder); 181 | 182 | [renderEncoder popDebugGroup]; 183 | [renderEncoder endEncoding]; 184 | [commandBuffer presentDrawable:view.currentDrawable]; 185 | 186 | } 187 | [commandBuffer commit]; 188 | } 189 | 190 | #pragma mark - IMGUI菜单 191 | char 输入框内容[256] = ""; 192 | static bool 全选; 193 | static bool 全选绘制; 194 | bool 一次调用; 195 | - (void)Drawing:(ImDrawList*)drawList 196 | { 197 | 198 | 199 | if(MenDeal){ 200 | 201 | 202 | ImGui::Begin("十三哥微信: NongShiFu123",&MenDeal); 203 | ImGui::Checkbox("总开关", &绘制总开关); 204 | ImGui::SameLine(); 205 | ImGui::Checkbox("附近人数", &附近人数开关); 206 | ImGui::SameLine(); 207 | if(ImGui::Checkbox("过直播", &过直播开关)){ 208 | self.secureTextEntry=过直播开关; 209 | } 210 | 211 | 212 | ImGui::SameLine(); 213 | ImGui::SameLine(); 214 | ImGui::SameLine(); 215 | if(ImGui::Button("注销")){ 216 | exit(0); 217 | } 218 | ImGui::NewLine(); 219 | if (!验证状态) { 220 | NSString*km=[[NSUserDefaults standardUserDefaults] objectForKey:@"km"]; 221 | bool validated = false; 222 | ImGui::Text("请先验证"); 223 | ImGui::Text("%s", [验证信息 UTF8String]); 224 | ImGui::Text("卡密:%s", [km UTF8String]); 225 | if (ImGui::Button("复制卡密")) { 226 | UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; 227 | pasteboard.string=km; 228 | } 229 | ImGui::NewLine(); 230 | // 输入框 231 | ImGui::InputText("##input", 输入框内容, sizeof(输入框内容)); 232 | 233 | // 粘贴按钮 234 | if (ImGui::Button("粘贴")) { 235 | UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; 236 | NSString *text = pasteboard.string; 237 | if (text != nil) { 238 | NSLog(@"粘贴=%@",text); 239 | strncpy(输入框内容, text.UTF8String, sizeof(输入框内容)); 240 | ImGui::SetNextItemWidth(-1); 241 | ImGui::InputText("##input", 输入框内容, sizeof(输入框内容)); 242 | } 243 | } 244 | ImGui::SameLine(); 245 | if (ImGui::Button("清除")) { 246 | strncpy(输入框内容, @"".UTF8String, sizeof(输入框内容)); 247 | 248 | } 249 | ImGui::SameLine(); 250 | 251 | ImGui::SameLine(); 252 | 253 | // 确认按钮 254 | if (ImGui::Button("确认激活")) { 255 | validated = true; 256 | if (validated) { 257 | validated = false; 258 | // 验证通过的逻辑 259 | NSString *inputString = [NSString stringWithUTF8String:输入框内容]; 260 | [[NSUserDefaults standardUserDefaults] setObject:inputString forKey:@"km"]; 261 | [NSObject YzCode:^{ 262 | NSLog(@"验证"); 263 | }]; 264 | 265 | } 266 | } 267 | 268 | 269 | }else{ 270 | //选项卡例子============= 271 | ImGui::BeginTabBar("绘制功能"); // 开始一个选项卡栏 272 | 273 | if (ImGui::BeginTabItem("绘制功能")) // 开始第一个选项卡 274 | { 275 | 276 | // 在这里添加第一个选项卡的内容 277 | ImGui::Checkbox("信息背景", &背景开关); 278 | ImGui::SameLine(); 279 | if(ImGui::Checkbox("全选绘制", &全选绘制)){ 280 | 射线开关=全选绘制; 281 | 血条开关=全选绘制; 282 | 骨骼开关=全选绘制; 283 | 名字开关=全选绘制; 284 | 距离开关=全选绘制; 285 | 286 | } 287 | ImGui::Checkbox("射线", &射线开关); 288 | ImGui::SameLine(); 289 | ImGui::ColorEdit4("射线颜色", (float*) &射线颜色); 290 | 291 | 292 | ImGui::Checkbox("血条", &血条开关); 293 | ImGui::SameLine(); 294 | ImGui::ColorEdit4("血条颜色", (float*) &血条颜色); 295 | 296 | ImGui::Checkbox("骨骼", &骨骼开关); 297 | ImGui::SameLine(); 298 | ImGui::ColorEdit4("骨骼颜色", (float*) &骨骼颜色); 299 | 300 | ImGui::Checkbox("名字", &名字开关); 301 | ImGui::SameLine(); 302 | ImGui::ColorEdit4("名字颜色", (float*) &名字颜色); 303 | 304 | ImGui::Checkbox("距离", &距离开关); 305 | ImGui::SameLine(); 306 | ImGui::ColorEdit4("距离颜色", (float*) &距离颜色); 307 | 308 | 309 | ImGui::Text("绘制越多,越是消耗性能掉帧.高配土豪可忽略。。。"); 310 | 311 | ImGui::EndTabItem(); // 结束第一个选项卡 312 | } 313 | 314 | if (ImGui::BeginTabItem("物资绘制")) // 开始第二个选项卡 315 | { 316 | // 在这里添加第二个选项卡的内容 317 | ImGui::Checkbox("物资总开关", &物资总开关); 318 | ImGui::SameLine(); 319 | ImGui::Checkbox("手雷预警", &手雷预警开关); 320 | ImGui::SameLine(); 321 | if(ImGui::Checkbox("全选物资", &全选)){ 322 | 手持武器开关=全选;高级物资开关=全选;载具开关=全选;倍镜开关=全选;药品开关=全选;枪械开关=全选;配件开关=全选;头盔开关=全选; 323 | 护甲开关=全选;背包开关=全选;投掷物开关=全选;子弹开关=全选;其他物资开关=全选; 324 | } 325 | ImGui::SameLine(); 326 | ImGui::Checkbox("调试模式", &物资调试开关); 327 | ImGui::NewLine(); 328 | 329 | ImGui::Checkbox("手持", &手持武器开关); 330 | ImGui::SameLine(); 331 | ImGui::Checkbox("高级", &高级物资开关); 332 | ImGui::SameLine(); 333 | ImGui::Checkbox("载具", &载具开关); 334 | ImGui::SameLine(); 335 | ImGui::Checkbox("倍镜", &倍镜开关); 336 | 337 | 338 | ImGui::Checkbox("药品", &药品开关); 339 | ImGui::SameLine(); 340 | ImGui::Checkbox("枪械", &枪械开关); 341 | ImGui::SameLine(); 342 | ImGui::Checkbox("配件", &配件开关); 343 | 344 | 345 | 346 | ImGui::Checkbox("头盔", &头盔开关); 347 | ImGui::SameLine(); 348 | ImGui::Checkbox("护甲", &护甲开关); 349 | ImGui::SameLine(); 350 | ImGui::Checkbox("背包", &背包开关); 351 | ImGui::SameLine(); 352 | ImGui::Checkbox("投掷物", &投掷物开关); 353 | 354 | 355 | ImGui::Checkbox("子弹", &子弹开关); 356 | ImGui::SameLine(); 357 | ImGui::Checkbox("其他", &其他物资开关); 358 | 359 | ImGui::SameLine(); 360 | ImGui::NewLine(); 361 | ImGui::NewLine(); 362 | ImGui::Text("物资开启可能会掉帧"); 363 | 364 | ImGui::EndTabItem(); 365 | } 366 | 367 | if (ImGui::BeginTabItem("高级功能")) // 开始第二个选项卡 368 | { 369 | ImGui::Checkbox("无后座", &无后座开关); 370 | ImGui::SameLine(); 371 | ImGui::Checkbox("子弹聚点", &聚点开关); 372 | ImGui::SameLine(); 373 | ImGui::Checkbox("镜头防抖", &防抖开关); 374 | 375 | ImGui::Checkbox("追踪", &追踪开关); 376 | ImGui::SameLine(); 377 | static const char* items[] = { "头", "胸", "脊柱", "盆骨" , "脚"}; 378 | static int 复选; 379 | 380 | if (ImGui::RadioButton(items[0], &复选, 0)) { 381 | // 当用户勾选了 "头" 时,将追踪位置设置为6 382 | 追踪部位 = 6; 383 | } 384 | ImGui::SameLine(); 385 | 386 | if (ImGui::RadioButton(items[1], &复选, 1)) { 387 | // 当用户勾选了 "胸" 时,将追踪位置设置为4 388 | 追踪部位 = 4; 389 | } 390 | ImGui::SameLine(); 391 | 392 | if (ImGui::RadioButton(items[2], &复选, 2)) { 393 | // 当用户勾选了 "脊柱" 时,将追踪位置设置为3 394 | 追踪部位 = 3; 395 | } 396 | ImGui::SameLine(); 397 | 398 | if (ImGui::RadioButton(items[3], &复选, 3)) { 399 | // 当用户勾选了 "盆骨" 时,将追踪位置设置为2 400 | 追踪部位 = 2; 401 | } 402 | ImGui::SameLine(); 403 | 404 | if (ImGui::RadioButton(items[4], &复选, 4)) { 405 | // 当用户勾选了 "脚" 时,将追踪位置设置为59 406 | 追踪部位 = 59; 407 | } 408 | ImGui::SliderFloat("追踪半径", &追踪圆圈, 0, 100); 409 | ImGui::SliderFloat("追踪距离", &追踪距离, 0, 300); 410 | 411 | 412 | ImGui::NewLine(); 413 | ImGui::Checkbox("自瞄", &自瞄开关); 414 | ImGui::SliderFloat("自瞄速度", &自瞄速度, 1, 20); 415 | 416 | ImGui::NewLine(); 417 | const char* cstr = strdup([到期时间 UTF8String]); 418 | ImGui::Text("人生如戏-全靠演技 到期时间:%s",cstr); 419 | ImGui::EndTabItem(); 420 | } 421 | if (ImGui::BeginTabItem("验证")) // 开始第二个选项卡 422 | { 423 | static const char* items[] = { "深色模式", "浅色模式"}; 424 | static int 复选; 425 | 426 | if(ImGui::RadioButton(items[0], &复选, 0)){ 427 | ImGui::StyleColorsDark(); 428 | } 429 | ImGui::SameLine(); 430 | if(ImGui::RadioButton(items[1], &复选, 1)){ 431 | ImGui::StyleColorsLight(); 432 | } 433 | 434 | ImGui::NewLine(); 435 | NSString*km=[[NSUserDefaults standardUserDefaults] objectForKey:@"km"]; 436 | const char* kmcstr = strdup([km UTF8String]); 437 | ImGui::NewLine(); 438 | ImGui::Text("卡密:%s",kmcstr); 439 | if (ImGui::Button("复制本地卡密")) { 440 | UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; 441 | pasteboard.string=km; 442 | 443 | } 444 | ImGui::NewLine(); 445 | const char* cstr = strdup([到期时间 UTF8String]); 446 | ImVec4 color = ImVec4(1.0f, 0.0f, 0.0f, 1.0f); // 红色 447 | ImGui::PushStyleColor(ImGuiCol_Text, color); 448 | ImGui::Text("到期时间:%s", cstr); 449 | ImGui::PopStyleColor(); 450 | 451 | ImGui::NextColumn(); 452 | ImGui::EndTabItem(); 453 | } 454 | 455 | ImGui::EndTabBar(); // 结束选项卡栏 456 | ImGui::NewLine(); 457 | 458 | } 459 | 460 | 461 | 462 | ImGui::NewLine(); 463 | ImGui::Text("QQ:350722326 %.1f (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 464 | ImGui::End(); 465 | 466 | 一次调用=false; 467 | 468 | } 469 | if (!MenDeal && !一次调用) { 470 | [[ImGuiMem sharedInstance] removeFromSuperview]; 471 | [[YMUIWindow sharedInstance] addSubview:[ImGuiMem sharedInstance]]; 472 | 一次调用=true; 473 | } 474 | 475 | if (绘制总开关 && 验证状态) { 476 | [[ESP sharedInstance] 绘制玩家:drawList]; 477 | } 478 | 479 | } 480 | 481 | #pragma mark - 触摸互动 482 | - (void)updateIOWithTouchEvent:(UIEvent *)event 483 | { 484 | UITouch *anyTouch = event.allTouches.anyObject; 485 | CGPoint touchLocation = [anyTouch locationInView:self]; 486 | 487 | ImGuiIO &io = ImGui::GetIO(); 488 | io.MousePos = ImVec2(touchLocation.x, touchLocation.y); 489 | 490 | 491 | BOOL hasActiveTouch = NO; 492 | for (UITouch *touch in event.allTouches) { 493 | if (touch.phase != UITouchPhaseEnded && touch.phase != UITouchPhaseCancelled) { 494 | 495 | hasActiveTouch = YES; 496 | break; 497 | } 498 | } 499 | io.MouseDown[0] = hasActiveTouch; 500 | } 501 | 502 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 503 | { 504 | [self updateIOWithTouchEvent:event]; 505 | } 506 | 507 | - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 508 | { 509 | [self updateIOWithTouchEvent:event]; 510 | } 511 | 512 | - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event 513 | { 514 | [self updateIOWithTouchEvent:event]; 515 | } 516 | 517 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event 518 | { 519 | [self updateIOWithTouchEvent:event]; 520 | } 521 | 522 | @end 523 | 524 | -------------------------------------------------------------------------------- /Bsphp/AFNetworking/AFHTTPSessionManager.h: -------------------------------------------------------------------------------- 1 | // AFHTTPSessionManager.h 2 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import 23 | #if !TARGET_OS_WATCH 24 | #import 25 | #endif 26 | #import 27 | 28 | #if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV 29 | #import 30 | #else 31 | #import 32 | #endif 33 | 34 | #import "AFURLSessionManager.h" 35 | 36 | /** 37 | `AFHTTPSessionManager` is a subclass of `AFURLSessionManager` with convenience methods for making HTTP requests. When a `baseURL` is provided, requests made with the `GET` / `POST` / et al. convenience methods can be made with relative paths. 38 | 39 | ## Subclassing Notes 40 | 41 | Developers targeting iOS 7 or Mac OS X 10.9 or later that deal extensively with a web service are encouraged to subclass `AFHTTPSessionManager`, providing a class method that returns a shared singleton object on which authentication and other configuration can be shared across the application. 42 | 43 | For developers targeting iOS 6 or Mac OS X 10.8 or earlier, `AFHTTPRequestOperationManager` may be used to similar effect. 44 | 45 | ## Methods to Override 46 | 47 | To change the behavior of all data task operation construction, which is also used in the `GET` / `POST` / et al. convenience methods, override `dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:`. 48 | 49 | ## Serialization 50 | 51 | Requests created by an HTTP client will contain default headers and encode parameters according to the `requestSerializer` property, which is an object conforming to ``. 52 | 53 | Responses received from the server are automatically validated and serialized by the `responseSerializers` property, which is an object conforming to `` 54 | 55 | ## URL Construction Using Relative Paths 56 | 57 | For HTTP convenience methods, the request serializer constructs URLs from the path relative to the `-baseURL`, using `NSURL +URLWithString:relativeToURL:`, when provided. If `baseURL` is `nil`, `path` needs to resolve to a valid `NSURL` object using `NSURL +URLWithString:`. 58 | 59 | Below are a few examples of how `baseURL` and relative paths interact: 60 | 61 | NSURL *baseURL = [NSURL URLWithString:@"http://example.com/v1/"]; 62 | [NSURL URLWithString:@"foo" relativeToURL:baseURL]; // http://example.com/v1/foo 63 | [NSURL URLWithString:@"foo?bar=baz" relativeToURL:baseURL]; // http://example.com/v1/foo?bar=baz 64 | [NSURL URLWithString:@"/foo" relativeToURL:baseURL]; // http://example.com/foo 65 | [NSURL URLWithString:@"foo/" relativeToURL:baseURL]; // http://example.com/v1/foo 66 | [NSURL URLWithString:@"/foo/" relativeToURL:baseURL]; // http://example.com/foo/ 67 | [NSURL URLWithString:@"http://example2.com/" relativeToURL:baseURL]; // http://example2.com/ 68 | 69 | Also important to note is that a trailing slash will be added to any `baseURL` without one. This would otherwise cause unexpected behavior when constructing URLs using paths without a leading slash. 70 | 71 | @warning Managers for background sessions must be owned for the duration of their use. This can be accomplished by creating an application-wide or shared singleton instance. 72 | */ 73 | 74 | NS_ASSUME_NONNULL_BEGIN 75 | 76 | @interface AFHTTPSessionManager : AFURLSessionManager 77 | 78 | /** 79 | The URL used to construct requests from relative paths in methods like `requestWithMethod:URLString:parameters:`, and the `GET` / `POST` / et al. convenience methods. 80 | */ 81 | @property (readonly, nonatomic, strong, nullable) NSURL *baseURL; 82 | 83 | /** 84 | Requests created with `requestWithMethod:URLString:parameters:` & `multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:` are constructed with a set of default headers using a parameter serialization specified by this property. By default, this is set to an instance of `AFHTTPRequestSerializer`, which serializes query string parameters for `GET`, `HEAD`, and `DELETE` requests, or otherwise URL-form-encodes HTTP message bodies. 85 | 86 | @warning `requestSerializer` must not be `nil`. 87 | */ 88 | @property (nonatomic, strong) AFHTTPRequestSerializer * requestSerializer; 89 | 90 | /** 91 | Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to an instance of `AFJSONResponseSerializer`. 92 | 93 | @warning `responseSerializer` must not be `nil`. 94 | */ 95 | @property (nonatomic, strong) AFHTTPResponseSerializer * responseSerializer; 96 | 97 | ///------------------------------- 98 | /// @name Managing Security Policy 99 | ///------------------------------- 100 | 101 | /** 102 | The security policy used by created session to evaluate server trust for secure connections. `AFURLSessionManager` uses the `defaultPolicy` unless otherwise specified. A security policy configured with `AFSSLPinningModePublicKey` or `AFSSLPinningModeCertificate` can only be applied on a session manager initialized with a secure base URL (i.e. https). Applying a security policy with pinning enabled on an insecure session manager throws an `Invalid Security Policy` exception. 103 | */ 104 | @property (nonatomic, strong) AFSecurityPolicy *securityPolicy; 105 | 106 | ///--------------------- 107 | /// @name Initialization 108 | ///--------------------- 109 | 110 | /** 111 | Creates and returns an `AFHTTPSessionManager` object. 112 | */ 113 | + (instancetype)__attribute__((optnone))manager; 114 | 115 | /** 116 | Initializes an `AFHTTPSessionManager` object with the specified base URL. 117 | 118 | @param url The base URL for the HTTP client. 119 | 120 | @return The newly-initialized HTTP client 121 | */ 122 | - (instancetype)__attribute__((optnone))initWithBaseURL:(nullable NSURL *)url; 123 | 124 | /** 125 | Initializes an `AFHTTPSessionManager` object with the specified base URL. 126 | 127 | This is the designated initializer. 128 | 129 | @param url The base URL for the HTTP client. 130 | @param configuration The configuration used to create the managed session. 131 | 132 | @return The newly-initialized HTTP client 133 | */ 134 | - (instancetype)__attribute__((optnone))initWithBaseURL:(nullable NSURL *)url 135 | sessionConfiguration:(nullable NSURLSessionConfiguration *)configuration NS_DESIGNATED_INITIALIZER; 136 | 137 | ///--------------------------- 138 | /// @name Making HTTP Requests 139 | ///--------------------------- 140 | 141 | /** 142 | Creates and runs an `NSURLSessionDataTask` with a `GET` request. 143 | 144 | @param URLString The URL string used to create the request URL. 145 | @param parameters The parameters to be encoded according to the client request serializer. 146 | @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. 147 | @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. 148 | 149 | @see -dataTaskWithRequest:completionHandler: 150 | */ 151 | - (nullable NSURLSessionDataTask *)__attribute__((optnone))GET:(NSString *)URLString 152 | parameters:(nullable id)parameters 153 | success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success 154 | failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE; 155 | 156 | 157 | /** 158 | Creates and runs an `NSURLSessionDataTask` with a `GET` request. 159 | 160 | @param URLString The URL string used to create the request URL. 161 | @param parameters The parameters to be encoded according to the client request serializer. 162 | @param downloadProgress A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue. 163 | @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. 164 | @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. 165 | 166 | @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler: 167 | */ 168 | - (nullable NSURLSessionDataTask *)__attribute__((optnone))GET:(NSString *)URLString 169 | parameters:(nullable id)parameters 170 | progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgress 171 | success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success 172 | failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; 173 | 174 | /** 175 | Creates and runs an `NSURLSessionDataTask` with a `HEAD` request. 176 | 177 | @param URLString The URL string used to create the request URL. 178 | @param parameters The parameters to be encoded according to the client request serializer. 179 | @param success A block object to be executed when the task finishes successfully. This block has no return value and takes a single arguments: the data task. 180 | @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. 181 | 182 | @see -dataTaskWithRequest:completionHandler: 183 | */ 184 | - (nullable NSURLSessionDataTask *)__attribute__((optnone))HEAD:(NSString *)URLString 185 | parameters:(nullable id)parameters 186 | success:(nullable void (^)(NSURLSessionDataTask *task))success 187 | failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; 188 | 189 | /** 190 | Creates and runs an `NSURLSessionDataTask` with a `POST` request. 191 | 192 | @param URLString The URL string used to create the request URL. 193 | @param parameters The parameters to be encoded according to the client request serializer. 194 | @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. 195 | @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. 196 | 197 | @see -dataTaskWithRequest:completionHandler: 198 | */ 199 | - (nullable NSURLSessionDataTask *)__attribute__((optnone))POST:(NSString *)URLString 200 | parameters:(nullable id)parameters 201 | success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success 202 | failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE; 203 | 204 | /** 205 | Creates and runs an `NSURLSessionDataTask` with a `POST` request. 206 | 207 | @param URLString The URL string used to create the request URL. 208 | @param parameters The parameters to be encoded according to the client request serializer. 209 | @param uploadProgress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. 210 | @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. 211 | @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. 212 | 213 | @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler: 214 | */ 215 | - (nullable NSURLSessionDataTask *)__attribute__((optnone))POST:(NSString *)URLString 216 | parameters:(nullable id)parameters 217 | progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress 218 | success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success 219 | failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; 220 | 221 | /** 222 | Creates and runs an `NSURLSessionDataTask` with a multipart `POST` request. 223 | 224 | @param URLString The URL string used to create the request URL. 225 | @param parameters The parameters to be encoded according to the client request serializer. 226 | @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol. 227 | @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. 228 | @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. 229 | 230 | @see -dataTaskWithRequest:completionHandler: 231 | */ 232 | - (nullable NSURLSessionDataTask *)__attribute__((optnone))POST:(NSString *)URLString 233 | parameters:(nullable id)parameters 234 | constructingBodyWithBlock:(nullable void (^)(id formData))block 235 | success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success 236 | failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE; 237 | 238 | /** 239 | Creates and runs an `NSURLSessionDataTask` with a multipart `POST` request. 240 | 241 | @param URLString The URL string used to create the request URL. 242 | @param parameters The parameters to be encoded according to the client request serializer. 243 | @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol. 244 | @param uploadProgress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. 245 | @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. 246 | @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. 247 | 248 | @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler: 249 | */ 250 | - (nullable NSURLSessionDataTask *)__attribute__((optnone))POST:(NSString *)URLString 251 | parameters:(nullable id)parameters 252 | constructingBodyWithBlock:(nullable void (^)(id formData))block 253 | progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress 254 | success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success 255 | failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; 256 | 257 | /** 258 | Creates and runs an `NSURLSessionDataTask` with a `PUT` request. 259 | 260 | @param URLString The URL string used to create the request URL. 261 | @param parameters The parameters to be encoded according to the client request serializer. 262 | @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. 263 | @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. 264 | 265 | @see -dataTaskWithRequest:completionHandler: 266 | */ 267 | - (nullable NSURLSessionDataTask *)__attribute__((optnone))PUT:(NSString *)URLString 268 | parameters:(nullable id)parameters 269 | success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success 270 | failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; 271 | 272 | /** 273 | Creates and runs an `NSURLSessionDataTask` with a `PATCH` request. 274 | 275 | @param URLString The URL string used to create the request URL. 276 | @param parameters The parameters to be encoded according to the client request serializer. 277 | @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. 278 | @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. 279 | 280 | @see -dataTaskWithRequest:completionHandler: 281 | */ 282 | - (nullable NSURLSessionDataTask *)__attribute__((optnone))PATCH:(NSString *)URLString 283 | parameters:(nullable id)parameters 284 | success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success 285 | failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; 286 | 287 | /** 288 | Creates and runs an `NSURLSessionDataTask` with a `DELETE` request. 289 | 290 | @param URLString The URL string used to create the request URL. 291 | @param parameters The parameters to be encoded according to the client request serializer. 292 | @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. 293 | @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. 294 | 295 | @see -dataTaskWithRequest:completionHandler: 296 | */ 297 | - (nullable NSURLSessionDataTask *)__attribute__((optnone))DELETE:(NSString *)URLString 298 | parameters:(nullable id)parameters 299 | success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success 300 | failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; 301 | 302 | @end 303 | 304 | NS_ASSUME_NONNULL_END 305 | --------------------------------------------------------------------------------