A simple EventEmitter in C++

EventEmitter coming with node.js is handy most of the time, and I implement this useful utility in C++ after finishing writing Functor. Yes, we need Functor to make it much more easier to write this fabulous utility. (Why don't you use lamdba? I'll talk about that later in this post)

It's extremely simple to use EventEmitter in node.js

const EventEmitter = require('events');

class MyEmitter extends EventEmitter {}

const myEmitter = new MyEmitter();
myEmitter.on('event', () => {
console.log('an event occurred!');
});
myEmitter.emit('event');

And the C++ version of EventEmitter need to be as easy as it is in node.js. As a matter of fact, this class made it.

#include <iostream>
#include <sstream>
#include <vector>
#include "EventEmitter.hpp"

using namespace std;

class emitter : public EventEmitter {
};

int main(int argc, const char * argv[]) {
emitter emitter;
emitter.on("event", [&emitter](int data) {
ostringstream osstream;
osstream << "data: " << data << '\n';
std::cout << osstream.str();
});

for (int i = 0; i < 10; i++) {
emitter.emit("event", i);
});
}

for (auto &t : threads) t.join();
}


Avoid XREF in Hopper and IDA

This post demonstrates how to avoid XREF in Hopper and IDA.

In other language:

Protection against Cycript/Runtime

This post is mainly to demonstrate some possible protections against Cycript/Runtime. There are 5 parts.

• Stop cycript's choose(ClassName)
• Memcpy
• Move to our own memory blocks
• Useless setter/getter
• Encrypt memory data

"Swift support" for class-dump

I added "Swift support" for class-dump.

Now, this tool can dump Objective-C headers even the MachO file uses Swift and ObjC at the same time. Notice, only ObjC headers can be dumped!

LAST, THIS IS AN EXPERIMENTAL VERSION.

"Swift support" for class-dump

I added "Swift support" for class-dump.

Now, this tool can dump Objective-C headers even the MachO file uses Swift and ObjC at the same time. Notice, only ObjC headers can be dumped!

LAST, THIS IS AN EXPERIMENTAL VERSION.

Bypass sandbox and present an alert in other apps

There is a historic way to present your alert in other apps, which can date back to iOS 5 or even easier.

You can refer to those links.
Can you use CFUserNotification with IOS 5.1
There is even a wiki page on iPhoneDevWiki, CFUserNotification.
(Update 1) Here is the official source code from Apple.

Recently, this guy who comes up with a possible way of using this old method to steal Apple ID.

The analysis of how to specific a port to device with iOSOpenDev

Yesterday I wrote a post about How to specific a port to device with iOSOpenDev. It's more like a tutor due to lacking of the process of analysis. So I decide to write about the process how did I analyze it so you can add this feature on yourselves when iOSOpenDev updates someday.

I'll keep this post as simple as I can, but I'll assume you've already had some basic knowledge.

MIT Algorithms (3)

Sorting
-How fast can we sort
-It depends on model:)

the model is of what you can do with the elements

e.g
Quicksort       θ(nlgn)
Heapsort        θ(nlgn)
merge sort      θ(nlgn)
insertion sort  θ(n2)

so, can we do better than θ(nlgn)?

Swift and Objective-C tweak supporting

With increment of swift, it's not ridiculous that using swift when you do some jailbreak development. If the tweak can get a better UI and I can code easier, there is no reason to refuse swift.

But one thing we should care about is that, Xcode 6 (and later) will link swift's dylib something like @rpath/libswiftDarwin.dylib.

That means if you didn't put those dylib files into a directory named Frameworks which right under your executable file's directory, it will just crash when you try to launch them. 继续阅读Swift and Objective-C tweak supporting

Here's to the crazy ones

Here's to the crazy ones: the misfits, the rebels, the troublemakers, the round pegs in the square holes, the ones who see things differently.

They are not fond of rules. They have no respect of status quo. You can quote them, disagree with them, glorify or vilify them. About the only thing you can't do, is ignore them, because they change things. They push human race forward.

Some may see them as the crazy ones. We see genius，because the people who are crazy enough to think they can change the world ... are the ones who do.