1 |
#include <stdlib.h> |
2 |
#include <unistd.h> |
3 |
#include <stdio.h> |
4 |
|
5 |
void error(const char* str) |
6 |
{ |
7 |
printf("could not %s\n", str); |
8 |
exit(1); |
9 |
} |
10 |
|
11 |
int main(int argc, char *argv[] ) |
12 |
{ |
13 |
if (setuid(0) == -1) { |
14 |
error( "setuid(0)" ); |
15 |
} |
16 |
if (seteuid(0) == -1) { |
17 |
error( "seteuid(0)" ); |
18 |
} |
19 |
|
20 |
if (setgid(0) == -1) { |
21 |
error( "setgid(0)" ); |
22 |
} |
23 |
if (setegid(0) == -1) { |
24 |
error( "setegid(0)" ); |
25 |
} |
26 |
if (setenv("PATH", "/sbin:/usr/sbin:/bin:/usr/bin",1) == -1) { |
27 |
error("setenv"); |
28 |
} |
29 |
system( "apt-get update" ); |
30 |
system( "apt-get upgrade" ); |
31 |
|
32 |
return 0; |
33 |
} |