login::login(QWidget *parent) : QWidget(parent) { this->setWindowTitle("Login"); this->resize(300,150); user = new QLabel("insert your username :"******"insert your password :"******"show password",this); showpass->setGeometry(130,80,100,15); connect(showpass,SIGNAL(stateChanged(int)),this,SLOT(showpassword())); ok = new QPushButton("login",this); ok->setGeometry(125,110,50,25); reg = new QPushButton("quit",this); reg->setGeometry(180,110,50,25); connect(reg,SIGNAL(clicked()),this,SLOT(close())); connect(ok,SIGNAL(clicked()),this,SLOT(checkpass())); /*if(inuser->text() == "nazem" && inpass->text() == "1234"){ connect(ok,SIGNAL(clicked()),this,SLOT(open_npage())); } else if(inuser->text() == "teacher" && inpass->text() == "12345"){ connect(ok,SIGNAL(clicked()),this,SLOT(open_tpage())); }*/ }
void command_adminlogin(char *params) { char adminpass[31]; char rootpass[31]; char buffer[256]; char *realadminpass = config_getoption("ADMIN_PASS"); if (sscanf(params, "%30s %30s", adminpass, rootpass) < 2) loginfailed(); if (!realadminpass[0]) loginfailed(); if (strcmp(crypt(adminpass, realadminpass), realadminpass)) loginfailed(); /* Admin password is right */ strcpy(user, "root"); init_userinfo(); if (checkpass(rootpass)) loginfailed(); /* Root password is right as well */ signal(SIGALRM, SIG_IGN); control_printf(SL_SUCCESS, "230 Administrative login successful."); bftpd_log("Administrative login SUCCESSFUL\n"); while (fgets(buffer, sizeof(buffer), stdin)) { admin_parsecmd(buffer); } exit(0); }
static void iauth_loc_xquery(struct server *source, const char routing[], const char query[]) { if (!strncmp(query, "LOGIN2 ", strlen("LOGIN2 "))) { /* Make "user" static for better valgrind tests. */ static struct userNode user; const char *ip_str, *hostname, *username, *account, *password; struct handle_info *hi = NULL; char *qdup, *saveptr = NULL; unsigned int ii; int valid = 0; /* Parse the arguments. */ qdup = strdup(query + strlen("LOGIN2 ")); ip_str = strtok_r(qdup, " ", &saveptr); hostname = strtok_r(NULL, " ", &saveptr); username = strtok_r(NULL, " ", &saveptr); account = strtok_r(NULL, " ", &saveptr); password = strtok_r(NULL, " ", &saveptr); if (!password) { login2_bad_syntax: irc_xresponse(source, routing, "NO Bad LOGIN2 syntax"); free(qdup); return; } if (account[0] == ':') account++; /* Set up (the rest of) the fake user. */ user.nick = "?"; if (!irc_pton(&user.ip, NULL, ip_str)) goto login2_bad_syntax; strncpy(user.ident, username, sizeof(user.ident)); strncpy(user.hostname, hostname, sizeof(user.hostname)); /* Check against the account. */ hi = get_handle_info(account); if (hi && (hi->masks->used == 0)) valid = 1; for (ii = 0; hi && (ii < hi->masks->used); ++ii) { if (user_matches_glob(&user, hi->masks->list[ii], 0)) valid = 1; } if (hi && !checkpass(password, hi->passwd)) valid = 0; /* Send our response. */ free(qdup); if (valid) { char response[68]; snprintf(response, sizeof(response), "OK %s:%lu", hi->handle, hi->registered); irc_xresponse(source, routing, response); } else { irc_xresponse(source, routing, "AGAIN Bad username, account or source"); } } /* else unknown or unsupported command */ }
char *snpp_login(int s, char *what) { char *u, *p; struct user usr; u=strdup(what); for(p=u; *p&&*p!=' '; p++); if(*p) { *p=NULL; p++; } _ndebug(3, ("Login: ``%s''\nPasswd: ``%s''\n", u, p)); if(conf.udb.u_exists(u)) { usr=conf.udb.getuser(u); } else { free(u); puttext(s, INVALIDLOGIN); return(NULL); } if(strlen(usr.passwd)<(size_t)13) { free(u); puttext(s, INVALIDLOGIN); return(NULL); } if(checkpass(usr.passwd, p)) { _ndebug(2, ("SNPP login for user ``%s''\n", usr.name)); puttext(s, LOGINOK); } else { _ndebug(2, ("SNPP invalid login for user ``%s''\n", usr.name)); free(u); u=NULL; puttext(s, INVALIDLOGIN); } return(u); }
static inline void bruteforce(char *pass,byte ind) { for(register byte i=0;i<16;i++) { //speed-hack check if there is more two character consecutive if (ind>=2) if (pass[0] == pass[1] && pass[1] == pass[2]) continue; pass[ind]=characters[i]; if (ind==9) { if(checkpass(pass)) printf("%s\n",pass); } else bruteforce(pass,ind+1); } }
int main(int argc, char **argv) { printf("ExploitMe - Mission 2\n"); if(argc != 2) { printf("Please provide a password...\n"); return 1; } if(checkpass(argv[1])) printf("Access granted!\n"); else printf("Access denied!\n"); return 0; }
int change_pass(char *from, char *msg) { UserList *tmp; char *old_pass, *new_pass, *args; args = LOCAL_COPY(msg); next_arg(args, &args); old_pass = next_arg(args, &args); new_pass = next_arg(args, &args); if ((tmp = (UserList *) lookup_userlevelc(from, FromUserHost, "*", NULL))) { if (tmp->password) { if (!old_pass || !new_pass) return 0; if (!(checkpass(old_pass, tmp->password))) { int old_display_win = window_display; window_display = 0; malloc_strcpy(&tmp->password, cryptit(new_pass)); savelists(NULL, NULL, NULL, NULL); window_display = old_display_win; return 1; } } /* user doesn't have a pass, so set it up */ if (old_pass) { int old_display_win = window_display; window_display = 0; tmp->password = m_strdup(cryptit(old_pass)); savelists(NULL, NULL, NULL, NULL); window_display = old_display_win; return 1; } } return 0; }
int bftpd_login(char *password) { #if 0 // brcm char str[256]; char *foo; int maxusers; #endif //brcm //printf("In bftpd_login password=%s, user=%s\n", password, user); // brcm if (!getpwnam(user)) { control_printf(SL_FAILURE, "421 Login incorrect."); return 1; } // brcm add local/remote login check if ((glbAccessMode == CLI_ACCESS_LOCAL && (strcmp(user, "user") && strcmp(user, "root"))) || (glbAccessMode == CLI_ACCESS_REMOTE && strcmp(user, "support"))) { control_printf(SL_FAILURE, "421 Login incorrect."); return 1; } #if 0 //brcm if (strncasecmp(foo = config_getoption("DENY_LOGIN"), "no", 2)) { if (foo[0] != '\0') { if (strncasecmp(foo, "yes", 3)) control_printf(SL_FAILURE, "421-Server disabled.\r\n421 Reason: %s", foo); else control_printf(SL_FAILURE, "421 Login incorrect."); bftpd_log("Login as user '%s' failed: Server disabled.\n", user); exit(0); } } maxusers = strtoul(config_getoption("USERLIMIT_GLOBAL"), NULL, 10); if ((maxusers) && (maxusers == bftpdutmp_usercount("*"))) { control_printf(SL_FAILURE, "421 There are already %i users logged in.", maxusers); exit(0); } maxusers = strtoul(config_getoption("USERLIMIT_SINGLEUSER"), NULL, 10); if ((maxusers) && (maxusers == bftpdutmp_usercount(user))) { control_printf(SL_FAILURE, "421 User %s is already logged in %i times.", user, maxusers); exit(0); } #endif //brcm if(checkuser() || checkshell()) { control_printf(SL_FAILURE, "421 Login incorrect."); exit(0); } if (checkpass(password)) return 1; #if 0 //brcm if (strcasecmp((char *) config_getoption("RATIO"), "none")) { sscanf((char *) config_getoption("RATIO"), "%i/%i", &ratio_send, &ratio_recv); } strcpy(str, config_getoption("ROOTDIR")); if (!str[0]) strcpy(str, "%h"); replace(str, "%u", userinfo.pw_name); replace(str, "%h", userinfo.pw_dir); if (!strcasecmp(config_getoption("RESOLVE_UIDS"), "yes")) { passwdfile = fopen("/etc/passwd", "r"); groupfile = fopen("/etc/group", "r"); } #endif //brcm setgid(userinfo.pw_gid); initgroups(userinfo.pw_name, userinfo.pw_gid); #if 0 //brcm if (strcasecmp(config_getoption("DO_CHROOT"), "no")) { if (chroot(str)) { control_printf(SL_FAILURE, "421 Unable to change root directory.\r\n%s.", strerror(errno)); exit(0); } if (bftpd_setuid(userinfo.pw_uid)) { control_printf(SL_FAILURE, "421 Unable to change uid."); exit(0); } if (chdir("/")) { control_printf(SL_FAILURE, "421 Unable to change working directory.\r\n%s.", strerror(errno)); exit(0); } } else { if (bftpd_setuid(userinfo.pw_uid)) { control_printf(SL_FAILURE, "421 Unable to change uid."); exit(0); } if (chdir(str)) { control_printf(SL_FAILURE, "230 Couldn't change cwd to '%s': %s.", str, strerror(errno)); chdir("/"); } } new_umask(); print_file(230, config_getoption("MOTD_USER")); #endif //brcm control_printf(SL_SUCCESS, "230 User logged in."); #ifdef HAVE_UTMP_H bftpd_logwtmp(1); #endif #if 0 //brcm bftpdutmp_log(1); bftpd_log("Successfully logged in as user '%s'.\n", user); if (config_getoption("AUTO_CHDIR")[0]) chdir(config_getoption("AUTO_CHDIR")); #endif //brcm state = STATE_AUTHENTICATED; //brcm bftpd_cwd_init(); return 0; }