Adds auto-execute support (hex edit the binary and change the # * 8192 to a list of commands, separated by newlines, ending with a NULL byte, keeping the same buffer size).
git-svn-id: file:///home/svn/framework3/trunk@5180 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
parent
b64f52a19d
commit
0f5d0164a3
File diff suppressed because one or more lines are too long
|
@ -2,14 +2,12 @@
|
|||
* Copyright (c) 2004-2005 vlad902 <vlad902 [at] gmail.com>
|
||||
* Copyright (c) 2007 H D Moore <hdm [at] metasploit.com>
|
||||
* This file is part of the Metasploit Framework.
|
||||
* $Revision: 2055 $
|
||||
* $Revision$
|
||||
*/
|
||||
|
||||
#ifndef _CMD_H
|
||||
#define _CMD_H
|
||||
|
||||
|
||||
|
||||
/* Base */
|
||||
int process_input(char *, int);
|
||||
void parse(char *, int *, char * []);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright (c) 2004-2005 vlad902 <vlad902 [at] gmail.com>
|
||||
* Copyright (c) 2007 H D Moore <hdm [at] metasploit.com>
|
||||
* This file is part of the Metasploit Framework.
|
||||
* $Revision: 2053 $
|
||||
* $Revision$
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2005 vlad902 <vlad902 [at] gmail.com>
|
||||
* This file is part of the Metasploit Framework.
|
||||
* $Revision: 2036 $
|
||||
* $Revision$
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright (c) 2004-2005 vlad902 <vlad902 [at] gmail.com>
|
||||
* Copyright (c) 2007 H D Moore <hdm [at] metasploit.com>
|
||||
* This file is part of the Metasploit Framework.
|
||||
* $Revision: 2036 $
|
||||
* $Revision$
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright (c) 2004-2005 vlad902 <vlad902 [at] gmail.com>
|
||||
* Copyright (c) 2007 H D Moore <hdm [at] metasploit.com>
|
||||
* This file is part of the Metasploit Framework.
|
||||
* $Revision: 2053 $
|
||||
* $Revision$
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2005 vlad902 <vlad902 [at] gmail.com>
|
||||
* This file is part of the Metasploit Framework.
|
||||
* $Revision: 2036 $
|
||||
* $Revision$
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2007 H D Moore <hdm [at] metasploit.com>
|
||||
* This file is part of the Metasploit Framework.
|
||||
* $Revision: 2053 $
|
||||
* $Revision$
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2005 vlad902 <vlad902 [at] gmail.com>
|
||||
* This file is part of the Metasploit Framework.
|
||||
* $Revision: 2036 $
|
||||
* $Revision$
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright (c) 2004-2005 vlad902 <vlad902 [at] gmail.com>
|
||||
* Copyright (c) 2007 H D Moore <hdm [at] metasploit.com>
|
||||
* This file is part of the Metasploit Framework.
|
||||
* $Revision: 2036 $
|
||||
* $Revision$
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2005 vlad902 <vlad902 [at] gmail.com>
|
||||
* This file is part of the Metasploit Framework.
|
||||
* $Revision: 2036 $
|
||||
* $Revision$
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright (c) 2004-2005 vlad902 <vlad902 [at] gmail.com>
|
||||
* Copyright (c) 2007 H D Moore <hdm [at] metasploit.com>
|
||||
* This file is part of the Metasploit Framework.
|
||||
* $Revision: 2054 $
|
||||
* $Revision$
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -15,9 +15,7 @@
|
|||
#include <signal.h>
|
||||
|
||||
#include "cmd.h"
|
||||
|
||||
void parse(char *, int *, char * []);
|
||||
void chomp(char *);
|
||||
#include "auto.h"
|
||||
|
||||
struct __cmdhandler
|
||||
{
|
||||
|
@ -91,6 +89,7 @@ struct __cmdhandler handlerlist[] =
|
|||
#define VERSION "0.01"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
char *p, *s, *b;
|
||||
int sig;
|
||||
|
||||
if (argc <= 1 || strcmp(argv[1], "-k") != 0) {
|
||||
|
@ -99,7 +98,24 @@ int main(int argc, char **argv) {
|
|||
unlink(argv[0]);
|
||||
}
|
||||
|
||||
/* XXX: Big negative sbrk() to remove heap? */
|
||||
/* process any embedded commands */
|
||||
if (automatic[0] != '#') {
|
||||
b = s = strdup(automatic);
|
||||
while ((p = strstr(s, "\n")) != NULL) {
|
||||
*p = '\0';
|
||||
|
||||
printf("(auto) %s\n", s);
|
||||
process_input(s, strlen(s));
|
||||
|
||||
s = p + 1;
|
||||
}
|
||||
printf("(auto) %s\n", s);
|
||||
|
||||
process_input(s, strlen(s));
|
||||
free(b);
|
||||
}
|
||||
|
||||
/* XXX: Big negative sbrk() to remove heap? */
|
||||
for(sig = 1; sig <= 64; sig++)
|
||||
signal(sig, SIG_IGN);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright (c) 2004-2005 vlad902 <vlad902 [at] gmail.com>
|
||||
* Copyright (c) 2007 H D Moore <hdm [at] metasploit.com>
|
||||
* This file is part of the Metasploit Framework.
|
||||
* $Revision: 2036 $
|
||||
* $Revision$
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
Loading…
Reference in New Issue