Skip to content

Instantly share code, notes, and snippets.

@XMPPwocky
Created October 2, 2015 01:40
Show Gist options
  • Save XMPPwocky/9a818404a782592fb443 to your computer and use it in GitHub Desktop.
Save XMPPwocky/9a818404a782592fb443 to your computer and use it in GitHub Desktop.
import os
import random
import struct
while True:
src = open("source.vtf", "rb")
f = open("test.vtf", "wb")
word = src.read(4)
while len(word) == 4:
word = struct.unpack("I", word)[0]
if random.randint(0, 20) < 3:
bit = random.randint(0, 31)
word = word ^ (1 << bit)
word = struct.pack("I", word)
f.write(word)
word = src.read(4)
os.system("\"C:/Program Files (x86)/Steam/steamapps/common/Team Fortress 2/bin/vtf2tga.exe\" -i test.vtf")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment