zhaodice / proxmox-ve-anti-detection

A patch to hide PVE itself
263 stars 38 forks source link

New instruction for pve-qemu 8.1.5-3 #21

Open Artipep opened 8 months ago

Artipep commented 8 months ago

New instructions with which I was able to build a patch for pve-qemu 8.1.5-3

Written on the basis of the instructions from here: https://github.com/zhaodice/proxmox-ve-anti-detection/issues/11 (many thanks to all for the instructions and hints and to the author for the original instructions and patch).

Immediately wanted to apologize if there are any errors in the instructions, I am a beginner.

!!! Create Proxmox VE Virtual Machine as compile enviromnet. !!!

!!! If you have an error while installing mk-build-deps

mk-build-deps: Unable to install pve-qemu-kvm-build-deps at /usr/bin/mk-build-deps line 459. mk-build-deps: Unable to install all build-dep packages

add a link to your /etc/apt/sources.list or uncomment the following

deb https://mirrors.ustc.edu.cn/proxmox/debian/ceph-quincy bookworm main

!!!

!!! If you have a build error

fatal: clone of 'git://git.proxmox.com/git/mirror_qemu' into submodule path '/root/pve-qemu/qemu' failed Failed to clone 'qemu' a second time, aborting make: *** [Makefile:21: submodule] Error 1

run in the pve-qemu folder

rm qemu -r git submodule update

and continue from step 7

!!!

1.Login System

2.Remove the old one:

mv /etc/apt/sources.list /etc/apt/sources.list.deleted mv /etc/apt/sources.list.d/pve-enterprise.list /etc/apt/sources.list.d/pve-enterprise.list.deleted

3.1.nano /etc/apt/sources.list

deb https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware deb https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware deb https://mirrors.ustc.edu.cn/debian/ bookworm-backports main contrib non-free non-free non-free-firmware deb https://mirrors.ustc.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware

pve源

deb https://mirrors.ustc.edu.cn/proxmox/debian bookworm pve-no-subscription

ceph源

deb https://mirrors.ustc.edu.cn/proxmox/debian/ceph-quincy bookworm main

开发源,必须

deb https://mirrors.ustc.edu.cn/proxmox/debian/devel bookworm main

3.2 nano /etc/apt/sources.list.d/pve-enterprise.list

deb https://enterprise.proxmox.com/debian/pve bookworm pve-enterprise

3.3 nano /etc/apt/sources.list.d/ceph.list

deb https://enterprise.proxmox.com/debian/ceph-quincy bookworm enterprise

deb http://download.proxmox.com/debian/ceph-quincy bookworm no-subscription

3.4 nano /etc/apt/sources.list.d/pve-no-subscription.list deb https://mirrors.ustc.edu.cn/proxmox/debian/pve bookworm pve-no-subscription

3.5 update & upgrade your systtem apt update -y && apt dist-upgrade -y

  1. Go to https://git.proxmox.com/?p=pve-qemu.git;a=summary and search for the pve-qemu release you need. (let's take 8.1.5-3 as an example). Open the releases and copy the commit tree (for 8.1.5-3 - d70533ff83b5298fe86733dd6f9341e6e20c01c0) (This patch is made at commit d70533ff83b5298fe86733dd6f9341e6e20c01c0) apt install git git clone git://git.proxmox.com/git/pve-qemu.git cd pve-qemu git reset --hard d70533ff83b5298fe86733dd6f9341e6e20c01c0 apt install devscripts mk-build-deps --install git submodule update --init

5.nano debian/rules FIND LINE:

# guest-agent is only required for guest systems

Inject a line :

# [Inject]Surprised Detector's Mother Fucker !!!
patch -p1 < 001-anti-detection.patch

# guest-agent is only required for guest systems
...

6.nano debian/rules FIND LINE:

# guest-agent is only required for guest systems
./configure \
        --disable-download \
    --with-git-submodules=ignore \
    --docdir=/usr/share/doc/pve-qemu-kvm\
    --localstatedir=/var \
    --prefix=/usr \
....

Delete the --disable-download \ line.

7.Open your webbrowser, visit https://github.com/zhaodice/qemu-anti-detection/ and find the patch version you need. (for 8.1.5-3 - https://github.com/zhaodice/qemu-anti-detection/blob/main/qemu-8.1.0.patch ), download raw file, rename the file to 001-anti-detection.patch, connect to your server via SFTP, go to root/pve-qemu/qemu and copy the file.

8.Current folder is git's root path and make it make clean make

9.install deb apt install librbd-dev dpkg -i --force-all pve-qemu-kvm_X.X.X.X_amd64.deb (for 8.1.5-3 - dpkg -i --force-all pve-qemu-kvm_8.1.5-3_amd64.deb)

(if you need to move the file to another server, connect to your server via SFTP, go to root/pve-qemu and download your pve-qemu-kvm_X.X.X.X_amd64.deb and on the other server put the file into root/pve-qemu and run the above command)

zhaodice commented 8 months ago

sounds good, did you test it?

Artipep commented 8 months ago

Yes, I'm testing it right now. Everything seems to be working.

zhaodice commented 8 months ago

Well, I have added your instructions on my project: https://github.com/zhaodice/proxmox-ve-anti-detection/blob/main/readme-8.1.5-3.md Thanks your contribution!

Chocrates commented 8 months ago

I've been fighting with this for days as well. I have automated the build for 8.1.5 here https://github.com/Chocrates/qemu-build/releases/tag/v0.1

There is a Dockerfile as well as an action that builds and patches it. As of this morning the one EAC game that refused to boot because I was in a VM, boots with this patch. I haven't started a match yet to see if I get kicked out mid match though.

I have some code that took @zhaodice's patch and converts it to a JSON object that I am hoping I can use to make it relatively version independent, but I haven't checked that in or tested it yet, and very likely it is going to be as fragile as a patch file.

Artipep commented 8 months ago

Made minor edits to the manual, slightly corrected points 4 and 6.

Chocrates commented 8 months ago

Do you know why we need to add sources from UTSC? Unless you have latency issues that may not be necessary.

Artipep commented 8 months ago

I did it on the basis of the instruction from here: https://github.com/zhaodice/proxmox-ve-anti-detection/issues/11 , so I used everything that is described in it.

zhaodice commented 8 months ago

Do you know why we need to add sources from UTSC? Unless you have latency issues that may not be necessary.

I come from China so I chose UTSC, you can change the source server to help your download speed.

Chocrates commented 8 months ago

Do you know why we need to add sources from UTSC? Unless you have latency issues that may not be necessary.

I come from China so I chose UTSC, you can change the source server to help your download speed.

Of course, that makes sense. My apologies I am over here in North America and forget that latency exists sometimes. Anyhow thank you for the patch. I will ping you if I come up with a more automated solution to get the patch applied across versions. I was able to play a game that uses EAC last night!

botagas commented 2 months ago

Does this work on Proxmox VE 8.2.4? Willing to give it a go, but not sure if it will net any results.

EDIT: Sadly, it doesn't. Trying to patch QEMU 9.0.2-2 for Proxmox VE 8.2.4, you get the following:

# [Inject]Surprised Detector's Mother Fucker !!!
patch -p1 < 001-anti-detection.patch
patching file block/vhdx.c
Hunk #1 succeeded at 2020 (offset 11 lines).
patching file block/vvfat.c
Hunk #1 succeeded at 1177 (offset 1 line).
patching file chardev/msmouse.c
patching file chardev/wctablet.c
patching file contrib/vhost-user-gpu/vhost-user-gpu.c
Hunk #1 succeeded at 1254 (offset 3 lines).
patching file docs/specs/fw_cfg.rst
patching file hw/acpi/aml-build.c
patching file hw/arm/nseries.c
patching file hw/arm/sbsa-ref.c
Hunk #1 succeeded at 874 with fuzz 2 (offset -23 lines).
patching file hw/arm/virt-acpi-build.c
Hunk #1 FAILED at 97.
1 out of 1 hunk FAILED -- saving rejects to file hw/arm/virt-acpi-build.c.rej
patching file hw/arm/virt.c
Hunk #1 succeeded at 108 with fuzz 2 (offset 21 lines).
Hunk #2 FAILED at 1619.
1 out of 2 hunks FAILED -- saving rejects to file hw/arm/virt.c.rej
patching file hw/audio/hda-codec.c
Hunk #1 succeeded at 118 (offset 1 line).
patching file hw/char/escc.c
patching file hw/display/edid-generate.c
patching file hw/i386/acpi-build.c
Hunk #1 succeeded at 2657 (offset 15 lines).
patching file hw/i386/fw_cfg.c
Hunk #1 succeeded at 218 (offset 13 lines).
patching file hw/i386/pc.c
Hunk #1 succeeded at 74 with fuzz 2.
patching file hw/i386/pc_piix.c
Hunk #1 FAILED at 237.
1 out of 1 hunk FAILED -- saving rejects to file hw/i386/pc_piix.c.rej
patching file hw/i386/pc_q35.c
Hunk #1 FAILED at 199.
1 out of 1 hunk FAILED -- saving rejects to file hw/i386/pc_q35.c.rej
patching file hw/ide/atapi.c
patching file hw/ide/core.c
Hunk #1 FAILED at 2618.
1 out of 1 hunk FAILED -- saving rejects to file hw/ide/core.c.rej
patching file hw/input/adb-kbd.c
patching file hw/input/adb-mouse.c
patching file hw/input/ads7846.c
patching file hw/input/hid.c
patching file hw/input/ps2.c
patching file hw/input/tsc2005.c
patching file hw/input/tsc210x.c
patching file hw/input/virtio-input-hid.c
patching file hw/loongarch/virt.c
Hunk #1 FAILED at 311.
1 out of 1 hunk FAILED -- saving rejects to file hw/loongarch/virt.c.rej
patching file hw/m68k/virt.c
Hunk #1 succeeded at 312 (offset 10 lines).
Hunk #2 succeeded at 341 (offset 10 lines).
patching file hw/nvme/ctrl.c
Hunk #1 succeeded at 8195 (offset 24 lines).
patching file hw/nvram/fw_cfg.c
Hunk #1 succeeded at 57 (offset 1 line).
patching file hw/pci-host/gpex.c
Hunk #1 succeeded at 219 (offset 12 lines).
patching file hw/ppc/e500plat.c
patching file hw/riscv/virt-acpi-build.c
Hunk #1 FAILED at 100.
1 out of 1 hunk FAILED -- saving rejects to file hw/riscv/virt-acpi-build.c.rej
patching file hw/scsi/mptconfig.c
patching file hw/scsi/scsi-bus.c
Hunk #1 succeeded at 652 (offset 71 lines).
patching file hw/scsi/scsi-disk.c
Hunk #1 succeeded at 2499 (offset -5 lines).
Hunk #2 succeeded at 2552 with fuzz 1 (offset -7 lines).
Hunk #3 succeeded at 2579 with fuzz 1 (offset -14 lines).
patching file hw/scsi/spapr_vscsi.c
patching file hw/smbios/smbios.c
Hunk #1 FAILED at 615.
1 out of 1 hunk FAILED -- saving rejects to file hw/smbios/smbios.c.rej
patching file hw/usb/dev-audio.c
Hunk #2 succeeded at 1006 (offset 1 line).
patching file hw/usb/dev-hid.c
patching file hw/usb/dev-hub.c
patching file hw/usb/dev-mtp.c
patching file hw/usb/dev-network.c
Hunk #3 succeeded at 1426 (offset 1 line).
patching file hw/usb/dev-serial.c
patching file hw/usb/dev-smartcard-reader.c
patching file hw/usb/dev-storage.c
patching file hw/usb/dev-uas.c
patching file hw/usb/dev-wacom.c
patching file hw/usb/u2f-emulated.c
patching file hw/usb/u2f-passthru.c
patching file hw/usb/u2f.c
patching file include/hw/acpi/aml-build.h
patching file include/hw/input/ps2.h
patching file include/hw/pci/pci.h
patching file include/standard-headers/linux/qemu_fw_cfg.h
patching file migration/rdma.c
Hunk #1 succeeded at 220 (offset -30 lines).
patching file pc-bios/optionrom/optionrom.h
patching file pc-bios/s390-ccw/scsi.h
patching file pc-bios/s390-ccw/virtio-scsi.h
patching file qapi/ui.json
Hunk #1 FAILED at 836.
1 out of 1 hunk FAILED -- saving rejects to file qapi/ui.json.rej
patching file qga/vss-win32/vss-handles.h
patching file target/i386/kvm/kvm.c
Hunk #1 succeeded at 1862 (offset -39 lines).
patching file target/s390x/tcg/misc_helper.c
Hunk #1 succeeded at 325 (offset -3 lines).
Hunk #2 succeeded at 351 (offset -3 lines).
Hunk #3 succeeded at 360 (offset -3 lines).
Hunk #4 succeeded at 376 (offset -3 lines).
patching file ui/spice-core.c
Hunk #1 succeeded at 815 (offset 6 lines).
patching file ui/spice-input.c
make[1]: *** [debian/rules:34: build/config.status] Error 1
make[1]: Leaving directory '/root/pve-qemu/pve-qemu-kvm-9.0.2'
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2
make: *** [Makefile:61: pve-qemu-kvm_9.0.2-2_amd64.deb] Error 2
botagas commented 2 months ago

Does this work on Proxmox VE 8.2.4? Willing to give it a go, but not sure if it will net any results.

EDIT: Sadly, it doesn't. Trying to patch QEMU 9.0.2-2 for Proxmox VE 8.2.4, you get the following:

# [Inject]Surprised Detector's Mother Fucker !!!
patch -p1 < 001-anti-detection.patch
patching file block/vhdx.c
Hunk #1 succeeded at 2020 (offset 11 lines).
patching file block/vvfat.c
Hunk #1 succeeded at 1177 (offset 1 line).
patching file chardev/msmouse.c
patching file chardev/wctablet.c
patching file contrib/vhost-user-gpu/vhost-user-gpu.c
Hunk #1 succeeded at 1254 (offset 3 lines).
patching file docs/specs/fw_cfg.rst
patching file hw/acpi/aml-build.c
patching file hw/arm/nseries.c
patching file hw/arm/sbsa-ref.c
Hunk #1 succeeded at 874 with fuzz 2 (offset -23 lines).
patching file hw/arm/virt-acpi-build.c
Hunk #1 FAILED at 97.
1 out of 1 hunk FAILED -- saving rejects to file hw/arm/virt-acpi-build.c.rej
patching file hw/arm/virt.c
Hunk #1 succeeded at 108 with fuzz 2 (offset 21 lines).
Hunk #2 FAILED at 1619.
1 out of 2 hunks FAILED -- saving rejects to file hw/arm/virt.c.rej
patching file hw/audio/hda-codec.c
Hunk #1 succeeded at 118 (offset 1 line).
patching file hw/char/escc.c
patching file hw/display/edid-generate.c
patching file hw/i386/acpi-build.c
Hunk #1 succeeded at 2657 (offset 15 lines).
patching file hw/i386/fw_cfg.c
Hunk #1 succeeded at 218 (offset 13 lines).
patching file hw/i386/pc.c
Hunk #1 succeeded at 74 with fuzz 2.
patching file hw/i386/pc_piix.c
Hunk #1 FAILED at 237.
1 out of 1 hunk FAILED -- saving rejects to file hw/i386/pc_piix.c.rej
patching file hw/i386/pc_q35.c
Hunk #1 FAILED at 199.
1 out of 1 hunk FAILED -- saving rejects to file hw/i386/pc_q35.c.rej
patching file hw/ide/atapi.c
patching file hw/ide/core.c
Hunk #1 FAILED at 2618.
1 out of 1 hunk FAILED -- saving rejects to file hw/ide/core.c.rej
patching file hw/input/adb-kbd.c
patching file hw/input/adb-mouse.c
patching file hw/input/ads7846.c
patching file hw/input/hid.c
patching file hw/input/ps2.c
patching file hw/input/tsc2005.c
patching file hw/input/tsc210x.c
patching file hw/input/virtio-input-hid.c
patching file hw/loongarch/virt.c
Hunk #1 FAILED at 311.
1 out of 1 hunk FAILED -- saving rejects to file hw/loongarch/virt.c.rej
patching file hw/m68k/virt.c
Hunk #1 succeeded at 312 (offset 10 lines).
Hunk #2 succeeded at 341 (offset 10 lines).
patching file hw/nvme/ctrl.c
Hunk #1 succeeded at 8195 (offset 24 lines).
patching file hw/nvram/fw_cfg.c
Hunk #1 succeeded at 57 (offset 1 line).
patching file hw/pci-host/gpex.c
Hunk #1 succeeded at 219 (offset 12 lines).
patching file hw/ppc/e500plat.c
patching file hw/riscv/virt-acpi-build.c
Hunk #1 FAILED at 100.
1 out of 1 hunk FAILED -- saving rejects to file hw/riscv/virt-acpi-build.c.rej
patching file hw/scsi/mptconfig.c
patching file hw/scsi/scsi-bus.c
Hunk #1 succeeded at 652 (offset 71 lines).
patching file hw/scsi/scsi-disk.c
Hunk #1 succeeded at 2499 (offset -5 lines).
Hunk #2 succeeded at 2552 with fuzz 1 (offset -7 lines).
Hunk #3 succeeded at 2579 with fuzz 1 (offset -14 lines).
patching file hw/scsi/spapr_vscsi.c
patching file hw/smbios/smbios.c
Hunk #1 FAILED at 615.
1 out of 1 hunk FAILED -- saving rejects to file hw/smbios/smbios.c.rej
patching file hw/usb/dev-audio.c
Hunk #2 succeeded at 1006 (offset 1 line).
patching file hw/usb/dev-hid.c
patching file hw/usb/dev-hub.c
patching file hw/usb/dev-mtp.c
patching file hw/usb/dev-network.c
Hunk #3 succeeded at 1426 (offset 1 line).
patching file hw/usb/dev-serial.c
patching file hw/usb/dev-smartcard-reader.c
patching file hw/usb/dev-storage.c
patching file hw/usb/dev-uas.c
patching file hw/usb/dev-wacom.c
patching file hw/usb/u2f-emulated.c
patching file hw/usb/u2f-passthru.c
patching file hw/usb/u2f.c
patching file include/hw/acpi/aml-build.h
patching file include/hw/input/ps2.h
patching file include/hw/pci/pci.h
patching file include/standard-headers/linux/qemu_fw_cfg.h
patching file migration/rdma.c
Hunk #1 succeeded at 220 (offset -30 lines).
patching file pc-bios/optionrom/optionrom.h
patching file pc-bios/s390-ccw/scsi.h
patching file pc-bios/s390-ccw/virtio-scsi.h
patching file qapi/ui.json
Hunk #1 FAILED at 836.
1 out of 1 hunk FAILED -- saving rejects to file qapi/ui.json.rej
patching file qga/vss-win32/vss-handles.h
patching file target/i386/kvm/kvm.c
Hunk #1 succeeded at 1862 (offset -39 lines).
patching file target/s390x/tcg/misc_helper.c
Hunk #1 succeeded at 325 (offset -3 lines).
Hunk #2 succeeded at 351 (offset -3 lines).
Hunk #3 succeeded at 360 (offset -3 lines).
Hunk #4 succeeded at 376 (offset -3 lines).
patching file ui/spice-core.c
Hunk #1 succeeded at 815 (offset 6 lines).
patching file ui/spice-input.c
make[1]: *** [debian/rules:34: build/config.status] Error 1
make[1]: Leaving directory '/root/pve-qemu/pve-qemu-kvm-9.0.2'
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2
make: *** [Makefile:61: pve-qemu-kvm_9.0.2-2_amd64.deb] Error 2

Update on the matter. Downgraded from 9.0.2-2 to 8.2.2 PVE-QEMU. Successfully patched it using QEMU patches by the author. Running pafish in Windows VM, still gets traced by rdtsc vm exit.

zhaodice commented 1 month ago

@botagas this patch cannot bypass RDTSC, it needs patch kvm kernel.