Friday, July 3, 2015

increase soundcloud cache

tl;dr: i can't link to the apk because i'm not getting banned for you. you can repeat these steps yourself if you're interested. i can't stop anyone from posting a link in the comments. sorry!


background

soundcloud used to let you cache a lot of songs for offline listening. then they took it away. i'm half sure they have some reason for doing it that has vaguely to do with money dollars. but, hey, when you have a nice feature and you take it away, peeps get mad. the mad peeps are here:
https://www.soundcloudcommunity.com/soundcloud/topics/how-do-i-change-the-size-of-the-mobile-audio-cache-on-android (warning, internet drama)

many users recommend downloading 2.8.3, which you can find in the crybaby fest linked above. personally, i'm not content rolling with an ancient version like some bucolic hillbilly. nah. i must break the latest version and get all those sweet sweet features.


compare old and new

i reckoned the best way to find where the cache was controlled would be to compare 2.8.3 and 2.8.4, where it changed. maybe there was just a setting somewhere they changed, or a number was reduced from "big" to "tiny". here's how i did it:

  1. acquire 2.8.3 and 2.8.4. former was in link above, latter was from play store. i used this extension to download from play
  2. convert apks to jars with enjarify
  3. use latest jd-gui to get java for whole app (file -> save all sources)
  4. use diff -rq <dir1> <dir2> to get a sense of what changed
  5. give up on diff inspection because delta was huge
  6. randomly search for "cache" in 2.8.3
thank you soundcloud, for not obfuscating your app at all. it was much easier to find what i was looking for with class and variable names. it takes about an hour to setup proguard such that you still get debugging symbols, but hey, whatever, right?

found some likely places for cache control in 2.8.3, but it looked like there was an api rewrite between 2.8.3 and 2.8.4, so even if i found it, it wouldn't help me, because none of that code was used in later versions.

enjarify is supposed to be this snazzy new dex -> java class conversion tool. the results were "meh". i'm sure it's going to be very good eventually, and i have more faith in the professionalism of the devs of enjarify than, say, other devs.


educated guess searching

started searching around for the word "cache". there's quite a lot of caching going on. i poked around a few files that looked like they were just setting up LRU caches for something, and those looked promising, but then i found: Lcom/soundcloud/android/playback/CacheConfig;.


results

public class CacheConfig
{

  // ~524 megs
  static final long MAX_SIZE_BYTES = 524288000L;

  // ~63 megs, aka "fuck you lol"
  static final long MIN_SIZE_BYTES = 62914560L;

  public static long getCacheSize(@Nullable String country) {
    if ((ScTextUtils.isBlank(country)) || (Locale.US.getCountry().equalsIgnoreCase(country))
        || (Locale.GERMANY.getCountry().equalsIgnoreCase(country))
        || (Locale.FRANCE.getCountry().equalsIgnoreCase(country))
        || (Locale.UK.getCountry().equalsIgnoreCase(country))) {
      return MIN_SIZE_BYTES;
    }

    return MAX_SIZE_BYTES;
  }

}

boom sha ka la ka. this must be it. if you're in the US, Germany, France, or UK, you get burned with a tiny, micro cache. here's what the fix looks like:
.method public static getCacheSize(Ljava/lang/String;)J
    .registers 3
    .param p0    # Ljava/lang/String;
        .annotation build Landroid/support/annotation/Nullable;
        .end annotation
    .end param

    .prologue
    .line 15
    # return "totally random" number, 555555
    const-wide/32 v0, 0x4fb10040
    return-wide v0

    invoke-static {p0}, Lcom/soundcloud/android/utils/ScTextUtils;->isBlank(Ljava/lang/String;)Z
    # ...

unfortunately, this creates new problems. as soon as you modify the code, you have to update the dex. if you update the dex, you break the signature and have to resign. if you resign, it breaks facebook logins, and probably some other stuff, because they uses signatures to generate a token that identifies which app is trying to do the login. luckily, antilvl knows how to handle spoofing signatures.



25 comments :

  1. modified version here: https://mega.co.nz/#!69oCkIJQ!0OWfDn6TK9HuUqJDG9s5TG5PTJd8nx8CqTMCy6W1Vcw

    ReplyDelete
    Replies
    1. Hey dude I am one of the bucolic Hillibillies from the Soundcloud link you mentioned before. As you aknowledged Ver. 2.8.3 was the best one for the stream cache option and it was OK for a lot of guys who didn't want to look at those aweful graphic contents and just want to play and listen to music. Since many of us can't code and are too busy to learn that, if you version of modified apk file works, can you share it?? If you won't than it means that it does not work.
      PS: apparently Ver 2.8.3 it's not working anymore, Android does not allow it to connect to the Soundcloud accounts, basically. See what you can do ... If can you...

      Delete
  2. though antilvl signature spoof doesnot work on every app nowdays lohan bro it was amazing before i guess some other checks nowi tried so i make patcher to patch dalvikcache keeping developer signature same its much easy though :P
    regards
    jasi2169

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. and lohan cant we do like this much easy way

      public class CacheConfig
      {

      // ~524 megs
      static final long MAX_SIZE_BYTES = 524288000L;

      // ~63 megs, aka "fuck you lol"
      static final long MIN_SIZE_BYTES = 62914560L;

      public static long getCacheSize() {
      // just remove if condition all is good what you say :P every one is equal in our eyes
      return MAX_SIZE_BYTES;
      }

      }

      Delete
    3. you could patch the code in a lot of different ways. your way seems like it would work too.

      Delete
    4. did u saw android crackmes i sent 2 android cracmes in email ?

      Delete
  3. i got question, but not on this topic, but dont know where to post it. is it possible deobsfucate smali code ? application is protected by proguard i assume, class names are like a/b/c and fields have only 'a','b','c' . methods are the same names. only single letters. i would like if you point me to some web site where can i get more info about deobsfucating. (sorry for the english :) ). ps: i like this blog.

    ReplyDelete
    Replies
    1. no you cant get original class names but its still easy to patch though until something comes with arrays encryption if you got what i mean :)

      regards
      jasi2169

      Delete
    2. so figuring out how application works.

      Delete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Hi, Enjarify developer here. What problems did you have with Enjarify? Do you have any suggestions? (If so, please file an issue at https://github.com/google/enjarify)

    ReplyDelete
  6. If you guys are intersted in modding Android games, take a look at my blog

    http://iandrohackerdk.blogspot.dk/

    ReplyDelete
  7. By letting posting along with sound cloud like podcasts and all we can share what we are thinking and the piece of information towards the people. Thank you for made here with code.
    SEO Company in Chennai

    ReplyDelete
  8. Superb. I really enjoyed very much with this article here. Really it is an amazing article I had ever read. I hope it will help a lot for all. Thank you so much for this amazing posts and please keep update like this excellent article.thank you for sharing such a great blog with us. expecting for your.
    Digital Marketing Company in India

    ReplyDelete
  9. Hello everyone , We launched new Carding and Hacking forum www.cardmafia.ws which is 100% Free to join and you can get free credit cards, paypal, SMTP, RDP, Webmail, Mailer, Porn account, Dumps, Hacking and Carding Tutorials, and we are also doing Western Union money tranfer and Electronics Shipment and much more you cant even imagine so join now for free and enjoy all free stuffs..www.cardmafia.ws

    ReplyDelete
  10. Excellent goods from you. I’ve understand your stuff previous to and you’re just too excellent. I actually like what you’ve acquired here, certainly like what you are stating and the way in which you say it. You make it enjoyable and you still take care of to keep it sensible. I can not wait to read far more from you. This is actually a tremendous site..
    Mobile App Development Company
    Android app Development Company
    ios app development Company
    Mobile App Development Companies

    ReplyDelete
  11. It's interesting that many of the bloggers your tips helped to clarify a few things for me as well as giving.. very specific nice content. And tell people specific ways to live their lives.Sometimes you just have to yell at people and give them a good shake to get your point across.
    Mobile App Development Company
    Android app Development Company
    ios app development Company
    Mobile App Development Companies
    Mobile App Development Company in india

    ReplyDelete
  12. Thanks for sharing great information if you are looking for best Cashless discount cards India, Privilege shopping cards Noida, Privilege shopping cards Noida, Discount cards Delhi NCR, Discount Offers in Noida then visit now Deal & discounts and offers in Noida, Delhi, Privilege shopping cards Noida

    ReplyDelete
  13. Hai Thanks for sharing valuable info about Andriod. Now a day’s everyone is depend on andriod . This blog post is really helped a lot. Nice tutorial. Please keep sharing updated tutorials…

    ReplyDelete
  14. The feeling was shared. This page is great. You can refer to this page. It also has similar content.
    download apk

    ReplyDelete
  15. Wow! Great post! The content is very rich, and I really like it.android

    ReplyDelete


  16. Its a wonderful post and very helpful, thanks for all this information. You are including better information regarding this topic in an effective way.Thank you so much

    Installment loans
    Payday loans
    Title loans
    Cash Advances

    ReplyDelete
  17. Nice blog.. Thanks for sharing informative blog.. I just want to say that all the information you have given here is awesome...great and nice blog thanks sharing. Android development company

    ReplyDelete

Do NOT post about or link to specific apps!