new program for running command prompt commands

This commit is contained in:
Miroslav Stampar 2010-02-21 08:52:54 +00:00
parent 9c014c0fd0
commit 60366f7168
8 changed files with 79 additions and 0 deletions

7
extra/runcmd/README.txt Normal file
View File

@ -0,0 +1,7 @@
Files in this folder can be used to compile auxiliary program that can
be used for running command prompt commands skipping standard "cmd /c" way.
They are licensed under the terms of the GNU Lesser General Public License
and it's compiled version is available on the official sqlmap subversion
repository[1].
[1] https://svn.sqlmap.org/sqlmap/trunk/sqlmap/shell/runcmd.exe_

View File

@ -0,0 +1 @@
Compile only the Release version because the Runtime library option (Project Properties -> Configuration Properties -> C/C++ -> Code Generation) is set to "Multi-threaded (/MT)", which statically links everything into executable and doesn't compile Debug version at all.

Binary file not shown.

View File

@ -0,0 +1,46 @@
/*
runcmd - a program for running command prompt commands
Copyright (C) 2010 Miroslav Stampar
email: miroslav.stampar@gmail.com
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdio.h>
#include <windows.h>
#include <use_ansi.h>
#include "stdafx.h"
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
FILE *fp;
string cmd;
for( int count = 1; count < argc; count++ )
cmd += " " + string(argv[count]);
fp = _popen(cmd.c_str(), "r");
if (fp != NULL) {
char buffer[BUFSIZ];
while (fgets(buffer, sizeof buffer, fp) != NULL)
fputs(buffer, stdout);
}
return 0;
}

Binary file not shown.

View File

@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// runcmd.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

View File

@ -0,0 +1,17 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
#include <stdio.h>
#include <tchar.h>
// TODO: reference additional headers your program requires here

BIN
shell/runcmd.exe_ Normal file

Binary file not shown.