Wednesday, September 15, 2010

Enabling Internet on Android Emulators

Every Android emulator I'd create and test would not have internet. Digging into the issue it seems to be some of the features I was adding like GSM modem support so I created one without any features and internet worked fine.

Also, another handy trick is using an HTTP proxy so you can view all of your web traffic easily. Sure you could just fire up wireshark but this is a little cleaner looking:
http://aurirahimzadeh.spaces.live.com/blog/cns!F5CF78DEA3328162!3717.entry

Thursday, July 22, 2010

Smali syntax highlighting

I've been doing a lot of Android APK hacking lately and that means reading a lot of code created by smali, the dex format disassembler. Since it's not that popular I could not find any syntax highlighting or smali editor anywhere so I created my own.

This is a wordfile for UltraEdit that provides some much needed syntax highlighting. I dug around the Smali code as much as I could to make sure everything was good. It handles all the keywords and operations.

Here's my code:
// Last updated 7/21/2010
/L20"Smali" Nocase Line Comment = # String Chars = " File Extensions = SMALI Escape Char = \
/Colors = 0,8421376,8421376,8421504,255,
/Colors Back = 16777215,16777215,16777215,16777215,16777215,
/Colors Auto Back = 1,1,1,1,1,
/Font Style = 0,0,0,0,0,
/Open Brace Strings = "{" "(" "["
/Close Brace Strings = "}" ")" "]"
/Open Fold Strings = ".annotation" ".field" ".method"
/Close Fold Strings = ".end annotation" ".end field" ".end method"
/Indent Strings = "{" ".method"
/Unindent Strings = "}" ".end method"
/Delimiters = " $(), +.:;=>{}~
/C1"Keywords 1" STYLE_KEYWORD Colors = 16711680 Colors Back = 16777215 Colors Auto Back = 1 Font Style = 1
.annotation .array-data
.catch .catchall .class
.end .enum .epilogue
.field
.implements .line
.local .locals
.method
.packed-switch .parameter .prologue
.registers .restart
.source .sparse-switch .subannotation .super
annotation array-data
field
local
method
packed-switch parameter
sparse-switch subannotation
/C2"Keywords 2" STYLE_KEYWORD Colors = 32768 Colors Back = 16777215 Colors Auto Back = 1 Font Style = 0
abstract annotation
bridge
constructor
declared-synchronized
enum
final
interface
native
private protected public
static strictfp synchronized synthetic system
transient
varargs volatile
/C3"Instructions" Colors = 33023 Colors Back = 16777215 Colors Auto Back = 1 Font Style = 0
add-double add-float add-int add-int/2addr add-int/lit8 add-int/lit16 add-int/lit32 add-int/lit64
add-long add-long/2addr aget aget-boolean aget-byte aget-char aget-object aget-short aget-wide and-int
and-int/2addr and-long aput aput-boolean aput-byte aput-char aput-object aput-short aput-wide array-length
check-cast cmpg-double cmpg-float cmpl-double cmpl-float cmp-long const const/16 const/4 const/high16v0 const-class const-string const-string-jumbo
const-wide const-wide/16 const-wide/32 const-wide/high16
div-double div-float div-int div-int/2addr div-long double-to-float double-to-int double-to-long
fill-array-data filled-new-array filled-new-array-range float-to-double float-to-int float-to-long
goto goto/16 goto/32
if-eq if-eqz if-ge if-gez if-gt if-gtz if-le if-lez if-lt if-ltz if-ne if-nez iget iget-boolean iget-byte iget-char iget-object iget-short
iget-wide instance-of int-to-byte int-to-char int-to-double int-to-float int-to-long int-to-short invoke-direct invoke-direct/range invoke-interface
invoke-interface-range invoke-static invoke-static/range invoke-super invoke-super/range invoke-virtual invoke-virtual/range iput iput-boolean
iput-byte iput-char iput-object iput-short iput-wide
long-to-double long-to-float long-to-int
monitor-enter monitor-exit move move/16 move/from16 move-exception move-object move-object/16 move-object/from16 move-result move-result-object
move-result-wide move-wide move-wide/16 move-wide/from16 mul-double mul-float mul-int mul-int/2addr mul-long mul-long/2addr
neg-double neg-float neg-int neg-long new-array new-instance nop not-int not-long
or-int or-int/2addr or-long
packed-switch
rem-double rem-float rem-int rem-int/2addr rem-long return return-object return-void return-wide
sget sget-boolean sget-byte sget-char sget-object sget-short sget-wide shl-int shl-int/2addr shl-long shr-int shr-int/2addr shr-long
sparse-switch sput sput-boolean sput-byte sput-char sput-object sput-short sput-wide sub-double sub-float sub-int sub-int/2addr
sub-long sub-long/2addr
throw
ushr-int ushr-int/2addr ushr-long
xor-int xor-int/2addr xor-long
/C4"Keywords 3" Colors = 16744448 Colors Back = 16777215 Colors Auto Back = 1 Font Style = 0
true
false
null
/C5"Keywords 4" Colors = 4210816 Colors Back = 16777215 Colors Auto Back = 1 Font Style = 0
build
runtime
system
/C6"Section 1" Colors = 33023 Colors Back = 16777215 Colors Auto Back = 1 Font Style = 0
** : ...
/C7"Section 2" Colors = 4227200 Colors Back = 16777215 Colors Auto Back = 1 Font Style = 0
** $ ...
/C8"Delimiters" Colors = 16711680 Colors Back = 16777215 Colors Auto Back = 1 Font Style = 0
=
:

I'll keep an updated version here.

Monday, July 5, 2010

Brain Drugs and my Quest for Sapho Juice

Does the idea of giving your brain a safe and effective boost as good or better than caffeine sound good to you? Are you a student or just enjoy using your brain all the time? "Well hell yea woaw!" is my answer for all those questions. It's all done using a newly emerging type of brain drugs called nootropics.

So I've been listening to a lot of the Dune audio books and fell in love with the idea of sapho juice. It's an imaginary tonic that the highly-trained mind-like-a-computer mentants would drink to improve their cognitive capacity. It was a bitter, cranberry-tasting drink that stained the lips. Anyway, I started digging around trying to come up with ideas for my own recipe and I found this post:
http://www.imminst.org/forum/index.php?showtopic=6018&st=0&p=56900&hl=sapho&fromsearch=1&#entry56900

I hadn't heard of nootropics but they seemed to be exactly what I wanted. Further Wikinvestigation turned up some valuable knowledge:
http://en.wikipedia.org/wiki/Nootropic

Nootropics are a class of cognitive-enhancing drugs that are either highly nontoxic or neuroprotective. That's right. They're either really safe or good for you. Now, granted, we have to have higher standards of evidence to be absolutely sure, and it's not safe to just start trusting everything you read on Wikipedia. However, too many people are using this stuff and claiming to get real results and it's not obviously a scam. (I did some searches for that, too.)

I played around in the nootropic subform for a few days, getting some ideas. Then I went over to Ebay and purchased 60 grams of the most well known and widely used nootropic piracatam and 25 grams of the fat-soluble version called aniracetam, which some people claim is more potent. I figured I'd just mix them together and swirl 'em up. I also read you needed lots of choline to make the drugs more bio-available, so I tried to find a good source of choline. All of the supplements were too expensive for me, but consider the fact that I'm cheap and didn't want to go all out on some strange white powders I'd be buying online and ingesting. So I settled on lecithin, which is actually quite good for you and has been used as a food additive for a while.

Once everything came in, this is what I used for my first sapho juice recipe:
1 small cup of kombucha brewed with green tea and yerba mate (for the caffeine)
~1g piracetam
~400mg aniracetam
2 tea spoons lecithin

The flavor was.. terrible. I figured if I was going to have terrible tastes, I should mix them together and let them fight it out. The result was better than you'd expect, with the kombucha over powering everything else.

The results were quite good. Concentration was more intense and focus was easier. I'm quite sensitive to caffeine and this taken in the morning made me hyper productive until about 3 o'clock, which is when I normally start misfiring in my head. Coming up and while it was rocking my thoughts came quite easily and I was VERY chatty. It was QUITE enjoyable without being too enjoyable. The coming down was surprisingly mild. I just felt a little extra tired after work. Taking it in the evening was great. I enjoyed the extra desire to talk with my girlfriend and I slept just fine and woke up in the morning feeling normal.

All in all, with my dosages and tolerances it's about like half a cup of coffee or more with much less jitters and much less of the 5-minute experience of full-body-omg-I-can-FEEL-the-universe I get. The entire adventure so far has been about 40 bucks but I bought more and have played with different recipes which I'll write about in the future.
I'd also suggest playing around this forum for a bit to get some other ideas: http://www.imminst.org/forum/index.php?showforum=169