#include "stdafx.h"
/*----------------------------------------------------------------------
* Purpose:
* Execute a process on the command line with elevated rights on Vista
*
* Copyright:
* Johannes Passing ([email protected])
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define BANNER L"(c) 2007 - Johannes Passing - http://int3.de/\n\n"
typedef struct _COMMAND_LINE_ARGS
{
BOOL ShowHelp;
BOOL Wait;
BOOL StartComspec;
PCWSTR ApplicationName;
PCWSTR CommandLine;
} COMMAND_LINE_ARGS, *PCOMMAND_LINE_ARGS;
INT Launch(
__in PCWSTR ApplicationName,
__in PCWSTR CommandLine,
__in BOOL Wait
)
{
SHELLEXECUTEINFO Shex;
ZeroMemory( &Shex, sizeof( SHELLEXECUTEINFO ) );
Shex.cbSize = sizeof( SHELLEXECUTEINFO );
Shex.fMask = SEE_MASK_FLAG_NO_UI | SEE_MASK_NOCLOSEPROCESS;
Shex.lpVerb = L"runas";
Shex.lpFile = ApplicationName;
Shex.lpParameters = CommandLine;
Shex.nShow = SW_HIDE;
if ( ! ShellExecuteEx( &Shex ) )
{
DWORD Err = GetLastError();
fwprintf(
stderr,
L"%s could not be launched: %d\n",
ApplicationName,
Err );
return EXIT_FAILURE;
}
_ASSERTE( Shex.hProcess );
if ( Wait )
{
WaitForSingleObject( Shex.hProcess, INFINITE );
}
CloseHandle( Shex.hProcess );
return EXIT_SUCCESS;
}
INT DispatchCommand(
__in PCOMMAND_LINE_ARGS Args
)
{
WCHAR AppNameBuffer[ MAX_PATH ];
WCHAR CmdLineBuffer[ MAX_PATH * 2 ];
if ( Args->ShowHelp )
{
wprintf(
BANNER
L"Execute a process on the command line with elevated rights\n"
L"\n"
L"Usage: Elevate [-?|-wait|-k] program [args]\n"
L"-? - Shows this help\n"
L"-wait - Waits until program terminates\n"
L"-k - Starts the the %%COMSPEC%% environment variable value and\n"
L" executes program in it (CMD.EXE, 4NT.EXE, etc.)\n"
L"prog - The program to execute\n"
L"args - Optional command line arguments to program\n" );
return EXIT_SUCCESS;
}
if ( Args->StartComspec )
{
//
// Resolve COMSPEC
//
if ( 0 == GetEnvironmentVariable( L"COMSPEC", AppNameBuffer, _countof( AppNameBuffer ) ) )
{
fwprintf( stderr, L"%%COMSPEC%% is not defined\n" );
return EXIT_FAILURE;
}
Args->ApplicationName = AppNameBuffer;
//
// Prepend /K and quote arguments
//
if ( FAILED( StringCchPrintf(
CmdLineBuffer,
_countof( CmdLineBuffer ),
L"/K \"%s\"",
Args->CommandLine ) ) )
{
fwprintf( stderr, L"Creating command line failed\n" );
return EXIT_FAILURE;
}
Args->CommandLine = CmdLineBuffer;
}
//wprintf( L"App: %s,\nCmd: %s\n", Args->ApplicationName, Args->CommandLine );
return Launch( Args->ApplicationName, Args->CommandLine, Args->Wait );
}
int __cdecl wmain(
__in int Argc,
__in WCHAR* Argv[]
)
{
OSVERSIONINFO OsVer;
COMMAND_LINE_ARGS Args;
INT Index;
BOOL FlagsRead = FALSE;
WCHAR CommandLineBuffer[ 260 ] = { 0 };
ZeroMemory( &OsVer, sizeof( OSVERSIONINFO ) );
OsVer.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
ZeroMemory( &Args, sizeof( COMMAND_LINE_ARGS ) );
Args.CommandLine = CommandLineBuffer;
//
// Check OS version
//
if ( GetVersionEx( &OsVer ) &&
OsVer.dwMajorVersion < 6 )
{
fwprintf( stderr, L"This tool is for Windows Vista and above only.\n" );
return EXIT_FAILURE;
}
//
// Parse command line
//
for ( Index = 1; Index < Argc; Index++ )
{
if ( ! FlagsRead &&
( Argv[ Index ][ 0 ] == L'-' || Argv[ Index ][ 0 ] == L'/' ) )
{
PCWSTR FlagName = &Argv[ Index ][ 1 ];
if ( 0 == _wcsicmp( FlagName, L"?" ) )
{
Args.ShowHelp = TRUE;
}
else if ( 0 == _wcsicmp( FlagName, L"wait" ) )
{
Args.Wait = TRUE;
}
else if ( 0 == _wcsicmp( FlagName, L"k" ) )
{
Args.StartComspec = TRUE;
}
else
{
fwprintf( stderr, L"Unrecognized Flag %s\n", FlagName );
return EXIT_FAILURE;
}
}
else
{
FlagsRead = TRUE;
if ( Args.ApplicationName == NULL && ! Args.StartComspec )
{
Args.ApplicationName = Argv[ Index ];
}
else
{
if ( FAILED( StringCchCat(
CommandLineBuffer,
_countof( CommandLineBuffer ),
Argv[ Index ] ) ) ||
FAILED( StringCchCat(
CommandLineBuffer,
_countof( CommandLineBuffer ),
L" " ) ) )
{
fwprintf( stderr, L"Command Line too long\n" );
return EXIT_FAILURE;
}
}
}
}
#ifdef _DEBUG
wprintf(
L"ShowHelp: %s\n"
L"Wait: %s\n"
L"StartComspec: %s\n"
L"ApplicationName: %s\n"
L"CommandLine: %s\n",
Args.ShowHelp ? L"Y" : L"N",
Args.Wait ? L"Y" : L"N",
Args.StartComspec ? L"Y" : L"N",
Args.ApplicationName,
Args.CommandLine );
#endif
//
// Validate args
//
if ( Argc <= 1 )
{
Args.ShowHelp = TRUE;
}
if ( ! Args.ShowHelp &&
( ( Args.StartComspec && 0 == wcslen( Args.CommandLine ) ) ||
( ! Args.StartComspec && Args.ApplicationName == NULL ) ) )
{
fwprintf( stderr, L"Invalid arguments\n" );
return EXIT_FAILURE;
}
return DispatchCommand( &Args );
}
没有合适的资源?快使用搜索试试~ 我知道了~
goby漏扫工具(红队版)
共1625个文件
json:1055个
go:258个
gif:75个
需积分: 5 5 下载量 190 浏览量
2023-12-25
16:27:13
上传
评论
收藏 115.12MB 7Z 举报
温馨提示
资源来源于网络,如有侵权联系速删(任何未经授权的网络渗透扫描行为均为违法行为,使用务必遵守相关网络安全法律法规)
资源推荐
资源详情
资源评论
收起资源包目录
goby漏扫工具(红队版) (1625个子文件)
libgksu2.so.0 68KB
libgksu2.so.0 68KB
libgksu2.so.0.0.2 68KB
libgksu2.so.0.0.2 68KB
applet 24KB
applet 24KB
app.asar 206.23MB
.babelrc 726B
v8_context_snapshot.bin 161KB
snapshot_blob.bin 48KB
main.c 6KB
layui.css 71KB
iconfont.css 47KB
layer.css 14KB
layui.mobile.css 10KB
laydate.css 7KB
base.css 4KB
code.css 1KB
icudtl.dat 9.74MB
rdp_user_pass.dict 18KB
snmp_pass.dict 825B
smb_user_pass.dict 390B
tomcat_user_pass.dict 169B
ftp_user_pass.dict 52B
mysql_user_pass.dict 42B
ssh_user_pass.dict 37B
postgres_user_pass.dict 17B
vnc_user_pass.dict 15B
mssql_user_pass.dict 13B
user_pass.dict 12B
libGLESv2.dll 7.65MB
d3dcompiler_47.dll 4.32MB
vk_swiftshader.dll 4.3MB
libGLESv2.dll 3MB
ffmpeg.dll 2.57MB
vulkan-1.dll 715KB
libEGL.dll 445KB
libEGL.dll 431KB
iconfont.eot 41KB
.eslintignore 14B
Goby.exe 133.14MB
goby-cmd.exe 55.15MB
elevate.exe 105KB
elevate.exe 105KB
Elevate.vcxproj.filters 1KB
59.gif 10KB
22.gif 10KB
24.gif 8KB
13.gif 7KB
16.gif 7KB
39.gif 6KB
64.gif 6KB
63.gif 6KB
50.gif 6KB
loading-0.gif 6KB
4.gif 6KB
1.gif 5KB
42.gif 5KB
71.gif 5KB
21.gif 5KB
20.gif 5KB
29.gif 5KB
70.gif 4KB
5.gif 4KB
17.gif 4KB
27.gif 4KB
9.gif 4KB
44.gif 4KB
11.gif 4KB
8.gif 4KB
3.gif 4KB
23.gif 4KB
34.gif 4KB
41.gif 4KB
38.gif 4KB
65.gif 3KB
32.gif 3KB
45.gif 3KB
7.gif 3KB
12.gif 3KB
26.gif 3KB
60.gif 3KB
2.gif 3KB
40.gif 3KB
25.gif 3KB
19.gif 3KB
66.gif 3KB
18.gif 3KB
46.gif 3KB
10.gif 3KB
28.gif 3KB
51.gif 3KB
57.gif 3KB
67.gif 3KB
0.gif 3KB
48.gif 3KB
43.gif 3KB
30.gif 2KB
61.gif 2KB
33.gif 2KB
共 1625 条
- 1
- 2
- 3
- 4
- 5
- 6
- 17
资源评论
汪汪家的碎冰冰
- 粉丝: 60
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功