/
githubmirror
/
XX-Net
Обзор
Документация
Войти
/
githubmirror
/
XX-Net
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
code/default/launcher/mac_helper.c
32 строки
2 KB
Michael.X
change structure for 3.x.x
16 апр 2016, 13:33
16 апр 2016, 13:33
bc14eb8
Код
Авторство
О чём код?
#include <stdio.h> #include <string.h> #include <unistd.h> int main(int argc, const char * argv[]) { if (geteuid() != 0) { fprintf(stderr, "Must be run as root!\n"); return 1; } if (argc == 4 && strcmp(argv[1], "enableauto") == 0) { execl("/usr/sbin/networksetup", "networksetup", "-setautoproxyurl", argv[2], argv[3], NULL); } else if (argc == 5 && strcmp(argv[1], "enablehttp") == 0) { execl("/usr/sbin/networksetup", "networksetup", "-setwebproxy", argv[2], argv[3], argv[4], NULL); } else if (argc == 5 && strcmp(argv[1], "enablehttps") == 0) { execl("/usr/sbin/networksetup", "networksetup", "-setsecurewebproxy", argv[2], argv[3], argv[4], NULL); } else if (argc == 3 && strcmp(argv[1], "disableauto") == 0) { execl("/usr/sbin/networksetup", "networksetup", "-setautoproxystate", argv[2], "off", NULL); } else if (argc == 3 && strcmp(argv[1], "disablehttp") == 0) { execl("/usr/sbin/networksetup", "networksetup", "-setwebproxystate", argv[2], "off", NULL); } else if (argc == 3 && strcmp(argv[1], "disablehttps") == 0) { execl("/usr/sbin/networksetup", "networksetup", "-setsecurewebproxystate", argv[2], "off", NULL); } else { fprintf(stderr, "Usage:\n"); fprintf(stderr, "%s enableauto <networkservice> <url>\n", argv[0]); fprintf(stderr, "%s enablehttp <networkservice> <domain> <port number>\n", argv[0]); fprintf(stderr, "%s enablehttps <networkservice> <domain> <port number>\n", argv[0]); fprintf(stderr, "%s disableauto <networkservice>\n", argv[0]); fprintf(stderr, "%s disablehttp <networkservice>\n", argv[0]); fprintf(stderr, "%s disablehttps <networkservice>\n", argv[0]); } return 0; }