• IOS判断设备是否已越狱



    转自:http://www.cnblogs.com/supercheng/archive/2012/12/05/2804166.html

    - (BOOL)isJailbroken { BOOL jailbroken = NO; NSString *cydiaPath = @"/Applications/Cydia.app"; NSString *aptPath = @"/private/var/lib/apt/"; if ([[NSFileManagerdefaultManager] fileExistsAtPath:cydiaPath]) { jailbroken = YES; } if ([[NSFileManagerdefaultManager] fileExistsAtPath:aptPath]) { jailbroken = YES; } return jailbroken; }
    判断软件是否被破解应该是就判断有没有加那个key吧?

    Info.list

      <key>SignerIdentity</key>

      <string>Apple iPhone OS Application Signing</string> 

    sg_trans.gif

    转载

    正文开始

    Umeng统计的Mobclick.h里面已经包含了越狱检测的代码,可以直接使用

    /*方法名: * isJailbroken *介绍: * 类方法,判断设备是否越狱,判断方法根据 apt和Cydia.app的path来判断 *参数说明: * 无 * * *

    /#pragma mark utils api //类方法,判断当前设备是否已经越狱

    + (BOOL)isJailbroken; //类方法,判断你的App是否被破解

    + (BOOL)isPirated;

    apt和Cydia的方式来进行判断的,没看见源码

    然后再介绍两种方法来查看是否已经越狱,知其然知其所以然、、、

    1. apt

    - (BOOL) hasAPT

    {

    return [[NSFileManager defaultManager] fileExistsAtPath:@"/private/var/lib/apt/"];

    }

    2. system

    - (BOOL) successCallSystem

    {

    return (system("ls") == 0) ? YES : NO;

    }

    3.

      staticconstchar* jailbreak_apps[] =

        {

            "/Applications/Cydia.app", 

            "/Applications/limera1n.app", 

            "/Applications/greenpois0n.app", 

            "/Applications/blackra1n.app",

            "/Applications/blacksn0w.app",

            "/Applications/redsn0w.app",

            "/Applications/Absinthe.app",

            NULL,

        };

        - (BOOL) isJailBroken

        {

            // Now check for known jailbreak apps. If we encounter one, the device is jailbroken.

            for(inti = 0; jailbreak_apps[i] != NULL; ++i)

            {

                if([[NSFileManagerdefaultManager] fileExistsAtPath:[NSStringstringWithUTF8String:jailbreak_apps[i]]])

                {

                    //NSLog(@"isjailbroken: %s", jailbreak_apps[i]);

                    returnYES;

                }

            }

            // TODO: Add more checks? This is an arms-race we're bound to lose.

            returnNO;

        }

    @interface UIDevice (Helper)  
    - (BOOL)isJailbroken;  
    @end

    @implementation UIDevice (Helper)  
    - (BOOL)isJailbroken {  
      BOOL jailbroken = NO;  
      NSString *cydiaPath = @"/Applications/Cydia.app";  
      NSString *aptPath = @"/private/var/lib/apt/";  
      if ([[NSFileManager defaultManager] fileExistsAtPath:cydiaPath]) {  
        jailbroken = YES;  
      }  
      if ([[NSFileManager defaultManager] fileExistsAtPath:aptPath]) {  
        jailbroken = YES;  
      }  
      return jailbroken;  
    }  
    @end

  • 相关阅读:
    Scala In 5 Years – My Prediction « GridGain – Real Time Big Data
    牛魔王珍满福拉面 北京团购网|京东团购
    Build WebKit On Windows 白果果白的专栏 博客频道 CSDN.NET
    fabulous
    Selenimu做爬虫 oscarxie 博客园
    EA gpl
    数据挖掘与Taco Bell编程
    test cpp could not compiled on ubuntu use g++,i'll tried lateor on win platform
    How to use ActiveRecord without Rails
    svn添加新项目管理并添加到trac 知识是一种越吃越饿的粮食 ITeye技术网站
  • 原文地址:https://www.cnblogs.com/muyushifang07/p/5207740.html
Copyright © 2020-2023  润新知