int main(const int argc, const char* argv[]) { if (argc != 3 && argc != 4 && argc != 5) { logError(L"Not enough arguments, requiring 2: <target> <dll> [<0|default 1|inject, 2|eject>]!", argc); system("PAUSE"); return 0; } std::string sTarget(argv[1]); std::string sDll(argv[2]); auto option = 0; auto isRemoteThread = true; if(argc > 3) { isRemoteThread = atoi(argv[3]) == 0 ? true : false; } if(argc == 5) { option = atoi(argv[4]); if(option>2 || option < 0) { logError(L"Invalid 3rd parameter given.", option); system("PAUSE"); return 0; } } logInfo(L"Injecting DLL into " + std::wstring(sTarget.begin(), sTarget.end())); //SetDebugPrivilege(); Injector* iInjector = nullptr; if(isRemoteThread) { iInjector = new RemoteThreadInjector(sTarget, sDll); } else { iInjector = new WindowsHookInjector(sTarget, sDll); } if (option == 0 || option == 1) { iInjector->inject(); logInfo(L"Finished injecting"); system("PAUSE"); } if(option == 0 || option == 2) { iInjector->free(); logInfo(L"Ejected!"); system("PAUSE"); } iInjector->Release(); delete iInjector; return 0; }
void execute() { if ( q && !q->done() ) return; if ( q && q->done() && !p ) { Row * r = q->nextRow(); q = 0; if ( !r ) quit( EX_NOUSER, "No such user: "******"login" ) && r->getEString( "login" ) == "anonymous" ) quit( EX_DATAERR, "Cannot deliver to the anonymous user" ); if ( mbn.isEmpty() ) { mb = Mailbox::find( r->getInt( "mailbox" ) ); } else { UString pre; if ( !r->isNull( "namespace" ) && !mbn.startsWith( "/" ) ) pre = r->getUString( "namespace" ) + "/" + r->getUString( "login" ) + "/"; mb = Mailbox::find( pre + mbn ); User * u = new User; UString anyone; anyone.append( "anyone" ); u->setLogin( anyone ); if ( mb ) p = new Permissions( mb, u, this ); } if ( !mb ) quit( EX_CANTCREAT, "No such mailbox" ); } if ( p && !p->ready() ) return; if ( p && !p->allowed( Permissions::Post ) ) quit( EX_NOPERM, "User 'anyone' does not have 'p' right on mailbox " + mbn.ascii().quoted( '\'' ) ); if ( !i ) { EStringList x; m->setFlags( mb, &x ); i = new Injector( this ); List<Injectee> y; y.append( m ); i->addInjection( &y ); i->execute(); } if ( !i->done() ) return; if ( i->failed() ) quit( EX_SOFTWARE, "Injection error: " + i->error() ); i = 0; EventLoop::shutdown(); }
int main(int argc, char **argv) { map<string, string> params; if(!parseCmdLine(params, argc, argv)) errorExit("Couldn't parse the command-line\n"); string src = Injector::verifyParameter(params, "src"); Icon* icon = Icon::parse(src); string platform = Injector::verifyParameter(params, "platform"); initInjectors(); map<string, Injector*>::iterator i = gInjectors.find(platform); if(i == gInjectors.end()) errorExit("Not an available platform.\n"); string dst = Injector::verifyParameter(params, "dst"); Injector* injector = (*i).second; injector->inject(icon, params); return 0; }
int main(int argc,char **argv) { if(argc < 5) { Injector::usage(); exit ( EXIT_ERR ); } Injector * pInjector = Injector::initInjector(argc, argv); if(pInjector == NULL) { cerr << "Exception, Abort" << endl; exit ( EXIT_ERR ); } pInjector->startInjection(); free(pInjector); return 0; }
int main(int argc, char **argv) { map<string, string> params; if(!parseCmdLine(params, argc, argv)) errorExit("Couldn't parse the command-line\n"); string src = Injector::verifyParameter(params, "src"); string platform = Injector::verifyParameter(params, "platform"); initInjectors(); // We support old, inconsistent platforms as well as the new platform based format string newPlatform = oldInjectors[platform]; if (!newPlatform.empty()) { //printf("(Using platform %s instead of %s)\n", newPlatform.c_str(), platform.c_str()); platform = newPlatform; } map<string, Injector*>::iterator i = gInjectors.find(platform); if(i == gInjectors.end()) errorExit("Not an available platform.\n"); string dst = Injector::verifyParameter(params, "dst"); Icon* icon = Icon::parse(src, platform); Injector* injector = (*i).second; injector->inject(icon, params); return 0; }
extern "C" void DPPatchRemoteTask( pid_t pid, const char *pPathToPatch ) { Injector *pObj = NULL; // currently, Rosetta patching is only supported from IA-32 // processes #if defined(__i386__) if ( IsRosettaProcess( pid ) ) { // use rosetta-handling injector pObj = new RosettaInjector( pid, pPathToPatch ); } else { #endif // use standard injector pObj = new Injector( pid, pPathToPatch ); #if defined(__i386__) } #endif pObj->Inject( ); delete pObj; }
void Initializer::run() { Injector* injector = new PlatformInjector(libraryPath_); injector->startAndAttach(tibiaPath_, QStringList(), workingDirectory_); connect(injector, SIGNAL(finished(int)), SIGNAL(finished())); }
// create the Injector object use the system arg... Injector * Injector::initInjector( int argc, char **argv ) { Injector * pInjector = new Injector( ); if ( pInjector == NULL) { return NULL; } #ifdef DEBUG printf("argc = %d", argc); for(int i = 0; i < argc; i++) { printf("argv[%d] = %s\n", i, argv[i]); } #endif /// get arguments while(argc > 0) { argc--; argv++; if(strcmp(argv[0], "-e") == 0) { pInjector->m_exeArguments = argv + 1; break; } else if(strcmp(argv[0], "-p") == 0) { pInjector->m_targetPid = atoi(argv[1]); #ifdef DEBUG printf("The pid of the process you want to inject is %s == %d", argv[1], pInjector->m_targetPid); #endif break; } else if(strcmp(argv[0], "-c") == 0) // -c to set the config file... { // you can see we read the config file in // int Injector::initFaultTable( void ) // // add by gatieme @ // or you can use the // -l --location stack|data|text // -m --mode random | address // -t --type // -t --timeout pInjector->m_memoryFaultTablePath = argv[1]; argv++; } else { printf("Unknown option: %s\n", argv[0]); pInjector->usage(); delete( pInjector ); return NULL; } } if( pInjector->initFaultTable() == RT_FAIL ) { delete( pInjector ); return NULL; } return pInjector; }