#!/usr/bin/perl -w $| = 1; #a54b0: 8b 44 24 04 mov 0x4(%esp,1),%eax #a54b4: 83 f8 01 cmp $0x1,%eax #a54b7: 74 2e je a54e7 #a54b9: 83 f8 03 cmp $0x3,%eax #a54bc: 75 32 jne a54f0 #a54be: 8a 44 24 08 mov 0x8(%esp,1),%al # $pattern = pack(H32,"8b44240483f801742e83f80375328a44"); $pattern2 = pack(H32,"8b44240483f801eb2e83f80375328a44"); if (! $ARGV[0] || $ARGV[0] =~ "^--?h") { print < Usage: nowon.pl /home/blabla/hlds_l EOL exit; } sub dopatch ($) { $wpfile = shift; print "\nLooking for code...in $wpfile"; open(INPUT, "+<".$wpfile) || die print "\nError opening file: $wpfile\n"; $notfoundyet = 1; $count = 0; while (read(INPUT, $_, 16)and $notfoundyet){ if ($_ eq $pattern) { print "found..."; seek(INPUT, $count, 0); print INPUT $pattern2; print "patched\n\n"; $notfoundyet = 0; } $count++; seek (INPUT, $count, 0); } close(INPUT); if ($notfoundyet) { print "not found, patch failed.\n\n"; } } sub liblistpatch ($) { $wpfile = shift; $wpfilebak = $wpfile.".bak"; system("cp $wpfile $wpfilebak"); $inmaster = 0; open(INPUT,"<$wpfilebak"); open(OUTPUT,">$wpfile"); while($regel = ) { if ($regel =~ "secure") { print OUTPUT "secure \"0\"\n"; } else { print OUTPUT $regel; } } } sub wcpatch ($) { $wpfile = shift; $wpfilebak = $wpfile.".bak"; system("cp $wpfile $wpfilebak"); $inmaster = 0; open(INPUT,"<$wpfilebak"); open(OUTPUT,">$wpfile"); while($regel = ) { if ($inmaster) { if ($regel =~ "}") { $inmaster = 0; } else { print OUTPUT "//"; } print OUTPUT $regel; } else { if ($regel =~ "Master") { print OUTPUT $regel; $regel = ; print OUTPUT $regel; print OUTPUT < EOL