判断程序的执行环境是VM

How to Install and Configure GitLab on Ubuntu 18.04 LTS GitLab is an open source GIT repository manager based on Rails and developed by GitLab Inc. It is a web-based GIT repository manager that allows your team to work on code, perform feature requests, track bugs, and test and implement applications. GitLab pr 阅读详情
来段老V的代码  很古老的
抗VM分析
  mov    ecx, 0Ah        ; CX=function# (0Ah=get_version)
      mov    eax, 'VMXh'  ; EAX=magic
      mov    dx, 'VX'          ; DX=magic
      in      eax, dx              ; specially processed io cmd
    ; output: EAX/EBX/ECX = data
      cmp    ebx, 'VMXh'  ; also eax/ecx modified (maybe vmw/os ver?)
      je      under_VMware

 

===

bool IsInsideVMWare()
{
  bool rc = true;

  __try
  {
    __asm
    {
      push  edx
      push  ecx
      push  ebx

      mov    eax, 'VMXh'
      mov    ebx, 0 // any value but not the MAGIC VALUE
      mov    ecx, 10 // get VMWare version
      mov    edx, 'VX' // port number

      in    eax, dx // read port
                    // on return EAX returns the VERSION
      cmp    ebx, 'VMXh' // is it a reply from VMWare?
      setz  [rc] // set return value

      pop    ebx
      pop    ecx
      pop    edx
    }
  }
  __except(EXCEPTION_EXECUTE_HANDLER)
  {
    rc = false;
  }

  return rc;
}


bool IsInsideVPC()
{
  bool rc = false;

  __try
  {
    _asm push ebx
    _asm mov  ebx, 0 // Flag
    _asm mov  eax, 1 // VPC function number

    // call VPC
    _asm __emit 0Fh
    _asm __emit 3Fh
    _asm __emit 07h
    _asm __emit 0Bh

    _asm test ebx, ebx
    _asm setz [rc]
    _asm pop ebx
  }
  // The except block shouldn't get triggered if VPC is running!!
  __except(IsInsideVPC_exceptionFilter(GetExceptionInformation()))
  {
  }

  return rc;
}

==============

给个通用判断的方法,不管VMWare或VirtuaPC都有效

int  DCVM ()
{
  unsigned char m[2+4], rpill[] = "/x0f/x01/x0d/x00/x00/x00/x00/xc3";
  *((unsigned*)&rpill[3]) = (unsigned)m;
  ((void(*)())&rpill)();

  printf ("idt base: %#x/n", *((unsigned*)&m[2]));
  if (m[5]>0xd0) printf ("虚拟机/r/n", m[5]);
  else printf ("真实机器/r/n");
  return 0;
}

#include <stdio.h>

int  LdtCheck()
{
    unsigned char m[2];
    __asm sldt m;  //L,not i
    printf("LDTR: %2.2x %2.2x/n", m[0], m[1]);
    return (m[0] != 0x00 && m[1] != 0x00) ? 1 : 0;
}

int main(int argc, char * argv[])
{

    if (LdtCheck())
        printf("Virtual Machine detected./n");
    else
        printf("Native machine detected./n");
   
    return 0;
}

#include <stdio.h>

inline int idtCheck ()
{
    unsigned char m[2];
    __asm sidt m;
    printf("IDTR: %2.2x %2.2x/n", m[0], m[1]);
    return (m[1]>0xd0) ? 1 : 0;
}

int gdtCheck()
{
    unsigned char m[2];
    __asm sgdt m;
    printf("GDTR: %2.2x %2.2x/n", m[0], m[1]);
    return (m[1]>0xd0) ? 1 : 0;
}

int ldtCheck()
{
    unsigned char m[2];
    __asm sldt m;
    printf("LDTR: %2.2x %2.2x/n", m[0], m[1]);
    return (m[0] != 0x00 && m[1] != 0x00) ? 1 : 0;
}

int main(int argc, char * argv[])
{
    idtCheck();
    gdtCheck();
   
    if (ldtCheck())
        printf("Virtual Machine detected./n");
    else
        printf("Native machine detected./n");
   
    return 0;
}
是能够测出来,但是编译时有下列警告信息,让人不爽。

C:/WINDDK/3790>cl test.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

test.c
test.c(7) : warning C4409: illegal instruction size
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

/out:test.exe
test.obj

*************************************************
' 检测程序是否运行于 VPC 虚拟机中
'
' 返回: 真表示运行在虚拟机中
' ------------------------------------------------
'   以下代码仅仅适用于在非标准模块中
'   这些代码根据BBS中bigwahaha提供的代码实现,本人未
'   进行测试检验, 有环境测试OK的用户请及时反馈
'*************************************************
Private Function IsInsideVPC() As Boolean
'_asm{overall}
'_asm{
'   push    ebp
'   mov     ebp,esp  ;esp,retAdr,this,retVal

'   assume  fs:nothing
'   
push    offset @F
'   
push    fs:[0]
'   
mov     fs:[0],esp

'   push    ebx
'   xor       ebx,ebx
'   dec      ebx         ; 初始 EBX = TRUE (VB)
'   mov     eax, 1      ; VPC function number
'   db      0Fh,3Fh,07h,0Bh
'
'   
;设定返回值
'   mov     eax,[ebp+3*4]
'   
mov     [eax],ebx
'
'   
pop     ebx
'   pop     fs:[0]
'   
add     esp,4
'   
leave
'   xor     eax,eax     ;返回 S_OK
'   ret     2*4
'
'   @@:
'   
mov     edx,dword ptr [esp+0CH]
'   
add     dword ptr ds:[edx+0B8h],4       ; regEip
'   xor      eax,eax
'   mov     dword ptr ds:[edx+0A4h],eax     ; regEbx,eax
'   mov     dword ptr ds:[edx],10007h       ; ContextFlags,CONTEXT_FULL
'   ret     4 * 4
'}
End Function

'*************************************************
' 检测程序是否运行于 VMWare 虚拟机中
'
' 返回: 真表示运行在虚拟机中
' ------------------------------------------------
'   以下代码仅仅适用于在非标准模块中
'   这些代码根据BBS中bigwahaha提供的代码实现,本人未
'   进行测试检验, 有环境测试OK的用户请及时反馈
'*************************************************

Private Function IsInsideVMWare() As Boolean
'_asm{overall}
'_asm{
'   
push    ebp
'   mov     ebp,esp  ;esp,retAdr,this,retVal
'
'   assume  
fs:nothing
'   
push    offset @IsInsideVMWare_error
'   
push    fs:[0]
'   
mov     fs:[0],esp
'
'   
push    ebx
'   mov     eax, 'VMXh'
'   
xor       ebx,ebx  ; any value but not the MAGIC VALUE
'   mov     ecx, 10  ; get VMWare version
'   mov     dx, 'VX' ; port number
'
'   
in        eax, dx  ; read port
'                    ; on return EAX returns the VERSION
'   xor     edx,edx
'   cmp   ebx, 'VMXh' ; is it a reply from VMWare?
'   jnz     @F
'   
dec     edx
'   @@:
'   
;设定返回值
'   mov     eax,[ebp+3*4]
'   
mov     [eax],edx
'
'   
pop     ebx
'   pop     fs:[0]
'   
add     esp,4
'   
leave
'   xor     eax,eax     ;返回 S_OK
'   ret     2*4
'
'   @IsInsideVMWare_error:
'   
mov     edx,dword ptr [esp+0CH]
'   
inc       dword ptr ds:[edx+0B8h]         ; regEip
'   xor       eax,eax
'   mov     dword ptr ds:[edx],10007h       ; ContextFlags,CONTEXT_FULL
'   ret     4 * 4
'}
End Function

 


 

H.264 入门篇 - 09 (帧间预测 - 参考帧列表) 短期和长期的关系和区别:在一个解码器中的 DPB(参考帧缓存)大小总是有限的,所以引入一个问题,什么样的参考帧会被保存到 DPB 中,什么样的参考帧会被移除出去,因此将分为长期和短期参考帧,所谓短期参考帧是这帧不会长期驻留在DPB中,如果参考帧缓存已满或者有其他特定的条件,那么短期参考帧就会被从DPB中移除;与之相对的长期参考帧,只要没有遇到某个指定的条件,遇到某个IDR帧, 遇到了清空整个DPB的指令等等,那么长期参考帧会长期在DPB中,不会因为有新的参考帧而被冲刷掉;(P帧是按照编码顺序) 阅读详情

相关推荐

告别瞎猜!用通达信L2资金流向函数,手把手教你识别主力动向(附实战公式)

本文详细解析通达信L2资金流向函数,手把手教你构建主力动向监控系统。通过分档数据解析、委买委卖攻防解读及实战公式应用,帮助投资者精准识别主力建仓与虚假拉升信号,提升股票交易决策效率。

weixin_26908317的博客 2088

test

#include stdio.h>__inline int idtCheck ()...{unsigned char m[6];__asm sidt m;printf("IDTR: %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x ", m[0], m[1], m[2], m[3], m[4], m[5]);return (m[5]>0xd0) ? 1 : 0;}int 

shnxl的专栏 333

小红书x-mini签名逆向实战:Frida动态Hook与算法还原

在移动App协议分析中,请求签名机制是保障接口安全的核心技术,其本质是客户端对请求参数、时间戳、设备指纹等要素进行加密认证的过程。理解签名原理需掌握Native层加密流程、JNI调用机制及密钥动态派生逻辑。Frida作为主流动态插桩工具,能绕过符号剥离、字符串加密和控制流混淆等反分析手段,在函数执行瞬间捕获寄存器状态、内存数据与调用上下文,实现签名算法的完整还原。该技术广泛应用于合规内容监测、API自动化调用与竞品协议研究等工程场景。本文聚焦小红书x-mini签名这一典型样本,详解从JNI_OnLoad定位

weixin_31264565的博客 457

在不同环境下,该如何判断服务器是虚拟机还是物理机呢?

判断系统是否为虚拟机的方法有很多,通过查看硬件信息、检查系统日志、使用特定命令、观察性能表现等方法,可以比较准确地做出判断。在实际操作中,可以结合多种方法进行验证,以确保判断的准确性。此外,使用研发项目管理系统PingCode和通用项目协作软件Worktile,可以提升团队的协作效率,更好地管理虚拟机和物理机。

星河梦瑾的博客 4824

【我的Android进阶之旅】解决android应用使用android:persistent属性带来的系统Launcher应用必须重启设备才生效的问题,大幅度提升开发效率

一、问题描述 我们在开发系统级别应用,比如Launcher桌面的时候,会发现有个问题:每次Launcher修改完代码,重新编译之后,安装到android设备上之后,必须重启才会生效。否则就是使用了之前的Launcher版本的内容。而每次重启设备得一分钟左右,太慢了,太影响效率了! 1.1 痛点 每次更新完代码,重新安装之后,必须重启设备才会生效。效率太TM低了! 二、分析问题 经过一轮代码排查,最终发现是因为src\main\AndroidManifest.xml文件中,定义application使用了an

字节卷动 1713

手把手教你学 NPU 驱动开发--第一部分:基础准备 开发环境搭建:Linux 内核编译与 NPU 仿真平台配置

摘要:本文详细介绍了搭建Linux内核编译与NPU仿真平台的完整流程。主要内容包括:1) 准备ARM64交叉编译工具链;2) 编译支持KGDB调试的Linux内核;3) 构建最小根文件系统;4) 使用QEMU模拟自定义NPU设备;5) 配置KGDB调试环境。文章重点讲解了如何通过修改设备树添加虚拟NPU设备,并提供了开源NPUIP Gemmini作为实验对象。最后展示了简单的"Hello NPU"驱动验证方法,为后续NPU驱动开发奠定了基础。文中还附有常用命令速查表,方便开发者快速搭建调

MHD0815的博客 384

VMWare Virtual PC 虚拟机 检测

Detect if your program is running inside a Virtual MachineBy lallous | 5 Apr 2005 An article showing how you can programmatically check if your code is running inside a virtual machine (such as VPC or VMWare).Download source and demo project - 6

lionzl的专栏 1817

pip install安装markitdown时出现ERROR: ‘packages/markitdown[all]‘ is not a valid editable requirement解决方案

本文主要介绍了pip install安装markitdown时出现ERROR: ‘packages/markitdown[all]’ is not a valid editable requirement解决方案,希望能对使用markitdown的同学们有所帮助。 文章目录 1. 问题描述 2. 解决方案

weixin_43178406的博客 2万+

检测当前环境是否是虚拟机

虚拟机检测技术--检测当前环境是否是虚拟机

sunjiaoya的博客 6645

Prometheus+Grafana+alertmanager+PrometheusAlert监控告警 实现飞书告警

以上 是以grafana做的邮件告警,但是感觉邮件很少人看。下面是以webhook 可以接入。启动alertmanager (设置 开机在启动)下载prometheusalter 配置文件。这里的告警是基于grafana上搭建的。我们启动PrometheusAlert。写完之后进行重启Prometheus。prometheus 的告警规则。测试 基于我们生产环境做的文档。然后在grafana上导模板。上导入模板就可以 直接引用。访问 grafana页面。重启一下grafana。

墨痕诉清风的博客 859

基于matlab不变矩的数字验证码识别系统

随着互联网技术的快速发展和应用,网络给人们提供了丰富的资源和极大的便利,但随之而来的是互联网系统的安全性问题,而验证码正是加强 Web 系统安全性的产物。全自动区分计算机和人类的图灵测试(Completely Automated Public Turing test to tell Computers and Humans Apart,CAPTCHA)也是验证码的一个应用程序,可以区分用户是人类还是计算机智能单击对象。

在职AI算法工程师,擅长计算机视觉,YOLO目标检测、分割等,擅长web、pyqt界面可视化,好内容持续更新中,来这里跟大家一起学习,共同进步 917

检测程序是否在虚拟机运行的两种方法

最近在项目中遇到一个虚拟机检测的问题,需要检测当前程序是否在虚拟机中运行。 关于虚拟机的检测方法有很多,网上也能搜索到很多相关的 相信很多程序狗很可能也会遇到相同的问题

hnlwt的专栏 1万+

使用Python与OpenCV实现基于霍夫变换的圆形缺陷检测与定位详细教程

本文详细探讨了如何使用Python和OpenCV库,通过图像边缘检测和霍夫变换实现圆形对象的检测与缺陷定位。我们不仅介绍了算法的基本原理,还通过具体的代码示例展示了如何在实际应用中实现这些技术。对于工业检测和医学影像分析,本文的方法提供了高效且易于实现的解决方案。随着图像处理技术的不断发展,未来我们可以期待更多新算法和新技术的应用,如深度学习与传统方法的结合,以及多传感器融合技术的引入,这将进一步提升缺陷检测与定位的效率和准确性。

qq_38334677的博客 1295

how to install git on ubuntu

What the Red Means The lines that the user needs to enter or customize will be in red in this tutorial! The rest should mostly be copy-and-pastable. About Git Git is a distributed version control ...

Move Fast! 195

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

how to install git server on ubuntu

# How to install git server on ubuntu ## install git   sudo apt-get install git ## add git user    sudo useradd git       sudo passwd git    ## install postgres   sudo apt-get install postgresql...

qq_32641185的博客 288

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

How To Install Git on Ubuntu 14.04

Introduction An indispensable tool in modern software development is some kind of version control system. Version control systems allow you to keep track of your software at the source level. You c

嵌入式技术在路上 563

How to Install Git on Ubuntu 12.04

FROM: https://www.digitalocean.com/community/articles/how-to-install-git-on-ubuntu-12-04 How to Install Git on Ubuntu 12.04 About Git Git is a distributed version control system released to t

tangwing的专栏 2695

How to download and install git on Ubuntu/Linux

1) For the latest stable version for your release of Linux/Ubuntusudo apt-get install git2) For Ubuntu, this PPA provides the latest stable upstream Git versionsudo add-apt-repository ppa:git-core/ppa...

程序员备忘录 362

git linux apt get,How to install GIT on Linux (Ubuntu & CentOS)

Installation on CentOS 7We can install git using 2 methods i.e. either using yum or installing from source. We will start by using yum for git installation,YUM methodJust like any other software, we c...

weixin_31794609的博客 217

How to install GIT on Linux (Ubuntu & CentOS)

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34194317的博客 283

How to Install HTTP Git Server With Nginx on Ubuntu 16.04

转自: https://www.howtoforge.com/tutorial/install-http-git-server-with-nginx-on-ubuntu-1604/ Git is a free and open-source version control system that can be used to track changes of code. Git

yuliying的专栏 1389

How to install Git on Ubuntu Lucid (10.04)

I'm sure there are tons of blogs out there on the same subject. This is just like a reference for me and others out there who might stumble upon this post. Note that what I have documented here is wha

anderberte 496

TWEET SHARE SHARE SHARE How To Install Git on Ubuntu 12.04

https://www.digitalocean.com/community/tutorials/how-to-install-git-on-ubuntu-12-04 纸上得来终觉浅,觉知此事要躬行。

zhiqicheng的专栏 201

How To Install Gitea Git Server On Ubuntu 16.04 / 18.04 / 18.10 With MariaDB

转载-适合菜鸟,网上的一些文章没有给出具体细节,这篇算是一个补充,细化了数据库(适用MYSQL)的操作过程。 Gitea is an open source version control platform similar to Gitbub… It’s probably the easiest, fastest, and most painless way of setting up a se...

mih2010的博客 453

install git lfs on ubuntu

sudo apt-get install software-properties-common sudo curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh > script.sh sudo bash script.sh sudo apt-get install git-lfs git lfs install 参考网页

qcxyliyong的博客 579

How to install paramiko/pexpect

sudo add-apt-repository universe sudo add-apt-repository multiverse sudo apt-get update sudo apt-get install python-pippip install pexpect # use dir(pexpect) to check sudo apt-get install p...

weixin_30745641的博客 77
上一篇: 内核钩子实例(稳定)
下一篇: how to detect VMM using (almost) one CPU instruction
iiprogram
博客等级 码龄25年 1068粉丝 1515原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值