Server IP : 80.241.246.6 / Your IP : 216.73.216.129 Web Server : Apache/2.4.25 (Debian) System : Linux kharagauli 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64 User : www-data ( 33) PHP Version : 7.0.33-0+deb9u12 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/doc/netcat-traditional/examples/data/ |
Upload File : |
/* generate ^@string1^@string2^@cmd^@ input to netcat, for scripting up rsh/rexec attacks. Needs to be a prog because shells strip out nulls. args: locuser remuser [cmd] remuser passwd [cmd] cmd defaults to "pwd". ... whatever. _H*/ #include <stdio.h> /* change if you like; "id" is a good one for figuring out if you won too */ static char cmd[] = "pwd"; static char buf [4096]; main(argc, argv) int argc; char * argv[]; { register int x; register int y; char * p; char * q; p = buf; memset (buf, 0, sizeof (buf)); p++; /* first null */ y = 1; if (! argv[1]) goto wrong; strncpy (p, argv[1], sizeof (buf) - y); /* first arg plus another null */ x = strlen (argv[1]) + 1; p += x; y += x; if (y >= sizeof (buf)) goto over; if (! argv[2]) goto wrong; strncpy (p, argv[2], sizeof (buf) - y); /* second arg plus null */ x = strlen (argv[2]) + 1; p += x; y += x; if (y >= sizeof (buf)) goto over; q = cmd; if (argv[3]) q = argv[3]; strncpy (p, q, sizeof (buf) - y); /* the command, plus final null */ x = strlen (q) + 1; p += x; y += x; if (y >= sizeof (buf)) goto over; strncpy (p, "\n", sizeof (buf) - y); /* and a newline, so it goes */ y++; write (1, buf, y); /* zot! */ exit (0); wrong: fprintf (stderr, "wrong! needs 2 or more args.\n"); exit (1); over: fprintf (stderr, "out of memory!\n"); exit (1); }