dsc_extractor的安装

本文介绍了一种方法,用于创建文件夹并安装所需工具,最终编译出可执行文件dsc_extractor,该文件能够从dyld_shared_cache_armx中提取Framework和privateFramework的二进制文件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

首先我们可以自己去创建文件夹下面,然后去进行安装,安装完成之后编译得到可执行文件就可以了,下面就说一下步骤

  • 1、找个目录创建一个文件夹 利用命令行工具输入命令 mkdir dsc_extractor
  • 2、进入到这个目录下 cd dsc_extractor
  • 3、通过wget进行安装 wget http://opensource.apple.com/tarballs/dyld/dyld-210.2.3.tar.gz 如果我们没有wget的话,可以先去通过brew去下一个 直接输入brew install wget,wget是一个从网络上自动下载文件的自由工具,支持通过HTTP、HTTPS、FTP三个最常见的TCP/IP协议下载,并可以使用HTTP代理。wget名称的由来是“World Wide Web”与“get”的结合
  • 4、tar xvf dyld-210.2.3.tar.gz 解压压缩包其中参数x代表的就是解压,v就是解压或者压缩过程中是否电视文件,参数f就是我们需要自己要去指定文件名,f的后面不能再接其他参数了
  • 5、cd dyld-210.2.3/launch-cache/ 然后我们再在命令行输入 touch dsc_extractor.patch
  • 6、把这个网址里面的内容拷贝到dsc_extractor.patch文件当中
  • 7、输入patch < dsc_extractor.patch,如果报错下面的错的话,我们需要这么做
    这里写图片描述
    将dsc_extractor.patch文件中的下面的内容

    -#if 0
    +/* #if 0 */


改成这样的,也就是说就是把0改成1
-#if 1
+/* #if 1 */ 然后就是在+/* #endif */ 后 按下回车,添加一行,然后再次运行,可能会报下面的错误,但我直接忽略好像没什么问题 ![这里写图片描述](https://img-blog.youkuaiyun.com/20180514174856347?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L1pDTVVDWlg=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
  • 8、执行clang++ -o dsc_extractor dsc_extractor.cpp dsc_iterator.cpp 命令,如果会报下面的错误的话,我们又要去解决
    这里写图片描述

将dsc_extractor.cpp文件当中的

const char* afterSlash = &dirs[1];

改成下面的,其实就是去掉了const

char* afterSlash = &dirs[1];

然后再将

#if 0

修改为

#if 1

还有就是将下面的注释给打开

/* #endif */

也就是变成这样子

#endif

然后我们再次运行,可能会报一个如下所示的警告,但其实不要紧,因为可执行文件已经生成了
这里写图片描述

这里写图片描述

然后我们就可以去利用dsc_extractor去进行将苹果把Framewrok和privateFramework混合在dyld_shared_cache_armx文件下的二进制文件给提取出来了

class MSMDAERNet(nn.Module): def init(self, pretrained=False, number_of_source=15, number_of_category=4): super(MSMDAERNet, self).init() self.sharedNet = pretrained_CFE(pretrained=pretrained) # for i in range(1, number_of_source): # exec('self.DSFE' + str(i) + '=DSFE()') # exec('self.cls_fc_DSC' + str(i) + '=nn.Linear(32,' + str(number_of_category) + ')') for i in range(number_of_source): exec('self.DSFE' + str(i) + '=DSFE()') exec('self.cls_fc_DSC' + str(i) + '=nn.Linear(32,' + str(number_of_category) + ')') def forward(self, data_src, number_of_source, data_tgt=0, label_src=0, mark=0): ''' description: take one source data and the target data in every forward operation. the mmd loss is calculated between the source data and the target data (both after the DSFE) the discrepency loss is calculated between all the classifiers' results (test on the target data) the cls loss is calculated between the ground truth label and the prediction of the mark-th classifier 之所以target data每一条线都要过一遍是因为要计算discrepency loss, mmd和cls都只要mark-th那条线就行 param {type}: mark: int, the order of the current source data_src: take one source data each time number_of_source: int label_Src: corresponding label data_tgt: target data return {type} ''' mmd_loss = 0 disc_loss = 0 data_tgt_DSFE = [] if self.training == True: # common feature extractor data_src_CFE = self.sharedNet(data_src) data_tgt_CFE = self.sharedNet(data_tgt) # Each domian specific feature extractor # to extract the domain specific feature of target data for i in range(number_of_source): DSFE_name = 'self.DSFE' + str(i) data_tgt_DSFE_i = eval(DSFE_name)(data_tgt_CFE) data_tgt_DSFE.append(data_tgt_DSFE_i) # Use the specific feature extractor # to extract the source data, and calculate the mmd loss DSFE_name = 'self.DSFE' + str(mark) data_src_DSFE = eval(DSFE_name)(data_src_CFE) # mmd_loss += utils.mmd(data_src_DSFE, data_tgt_DSFE[mark]) mmd_loss += utils.mmd_linear(data_src_DSFE, data_tgt_DSFE[mark]) # discrepency loss for i in range(len(data_tgt_DSFE)): if i != mark: disc_loss += torch.mean(torch.abs( F.softmax(data_tgt_DSFE[mark], dim=1) - F.softmax(data_tgt_DSFE[i], dim=1) )) # domain specific classifier and cls_loss DSC_name = 'self.cls_fc_DSC' + str(mark) pred_src = eval(DSC_name)(data_src_DSFE) cls_loss = F.nll_loss(F.log_softmax( pred_src, dim=1), label_src.squeeze()) return cls_loss, mmd_loss, disc_loss中data_tgt_DSFE的长度
06-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值