{"action":"created","issue":{"url":"https://api.github.com/repos/794959818/pubgradar/issues/3","repository_url":"https://api.github.com/repos/794959818/pubgradar","labels_url":"https://api.github.com/repos/794959818/pubgradar/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/794959818/pubgradar/issues/3/comments","events_url":"https://api.github.com/repos/794959818/pubgradar/issues/3/events","html_url":"https://github.com/794959818/pubgradar/issues/3","id":319618774,"number":3,"title":"can u make the bash scripts for Debien/Ubuntu?","user":{"login":"prprshooter","id":38919615,"avatar_url":"https://avatars0.githubusercontent.com/u/38919615?v=4","gravatar_id":"","url":"https://api.github.com/users/prprshooter","html_url":"https://github.com/prprshooter","followers_url":"https://api.github.com/users/prprshooter/followers","following_url":"https://api.github.com/users/prprshooter/following{/other_user}","gists_url":"https://api.github.com/users/prprshooter/gists{/gist_id}","starred_url":"https://api.github.com/users/prprshooter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prprshooter/subscriptions","organizations_url":"https://api.github.com/users/prprshooter/orgs","repos_url":"https://api.github.com/users/prprshooter/repos","events_url":"https://api.github.com/users/prprshooter/events{/privacy}","received_events_url":"https://api.github.com/users/prprshooter/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-02T16:12:54Z","updated_at":"2018-05-02T16:34:59Z","closed_at":null,"author_association":"NONE","body":""},"comment":{"url":"https://api.github.com/repos/794959818/pubgradar/issues/comments/386040493","html_url":"https://github.com/794959818/pubgradar/issues/3#issuecomment-386040493","issue_url":"https://api.github.com/repos/794959818/pubgradar/issues/3","id":386040493,"user":{"login":"AlphaBrock","id":13087700,"avatar_url":"https://avatars1.githubusercontent.com/u/13087700?v=4","gravatar_id":"","url":"https://api.github.com/users/AlphaBrock","html_url":"https://github.com/AlphaBrock","followers_url":"https://api.github.com/users/AlphaBrock/followers","following_url":"https://api.github.com/users/AlphaBrock/following{/other_user}","gists_url":"https://api.github.com/users/AlphaBrock/gists{/gist_id}","starred_url":"https://api.github.com/users/AlphaBrock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlphaBrock/subscriptions","organizations_url":"https://api.github.com/users/AlphaBrock/orgs","repos_url":"https://api.github.com/users/AlphaBrock/repos","events_url":"https://api.github.com/users/AlphaBrock/events{/privacy}","received_events_url":"https://api.github.com/users/AlphaBrock/received_events","type":"User","site_admin":false},"created_at":"2018-05-02T16:34:59Z","updated_at":"2018-05-02T16:34:59Z","author_association":"NONE","body":"here you are,it work for CentOS 7, Debian8/9, Ubuntu14.04+\r\n```shell\r\n#!/usr/bin/env bash\r\nPATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin\r\nexport PATH\r\n#=================================================================#\r\n#   System Required:  CentOS 7, Debian8/9, Ubuntu14.04 +                 #\r\n#   Description: One click Install PUBG-Radar                     #\r\n#   Author: AlphaBrock <linjcciam1314@gmail.com>                  #\r\n#   Thanks: @794959818 <https://github.com/794959818/pubgradar>   #\r\n#=================================================================#\r\n\r\nclear\r\n    echo \"#######################################################################\"\r\n    echo \"#                                                                     #\"\r\n    echo \"# One click Install PUBG-Radar                                        #\"\r\n    echo \"# Intro: https://github.com/794959818/pubgradar                       #\"\r\n    echo \"# Author: AlphaBrock <linjcciam1314@gmail.com>                        #\"\r\n    echo \"# Thanks: @794959818 <https://github.com/794959818/pubgradar>         #\"\r\n    echo \"#                                                                     #\"\r\n    echo \"#######################################################################\"\r\n    echo\r\n    read -p \"回车后开始安装：\"\r\n#Current folder\r\ncur_dir=`pwd`\r\n\r\n# Color\r\nred='\\033[0;31m'\r\ngreen='\\033[0;32m'\r\nyellow='\\033[0;33m'\r\nplain='\\033[0m'\r\n\r\n# Make sure only root can run our script\r\n[[ $EUID -ne 0 ]] && echo -e \"[${red}Error：${plain}] 必须以ROOT权限运行!\" && exit 1\r\n\r\n# Disable selinux\r\ndisable_selinux(){\r\n    if [ -s /etc/selinux/config ] && grep 'SELINUX=enforcing' /etc/selinux/config; then\r\n        sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config\r\n        setenforce 0\r\n    fi\r\n}\r\n\r\n#Check system\r\ncheck_sys(){\r\n    local checkType=$1\r\n    local value=$2\r\n\r\n    local release=''\r\n    local systemPackage=''\r\n\r\n    if [[ -f /etc/redhat-release ]]; then\r\n        release=\"centos\"\r\n        systemPackage=\"yum\"\r\n    elif cat /etc/issue | grep -Eqi \"debian\"; then\r\n        release=\"debian\"\r\n        systemPackage=\"apt\"\r\n    elif cat /etc/issue | grep -Eqi \"ubuntu\"; then\r\n        release=\"ubuntu\"\r\n        systemPackage=\"apt\"\r\n    elif cat /etc/issue | grep -Eqi \"centos|red hat|redhat\"; then\r\n        release=\"centos\"\r\n        systemPackage=\"yum\"\r\n    elif cat /proc/version | grep -Eqi \"debian\"; then\r\n        release=\"debian\"\r\n        systemPackage=\"apt\"\r\n    elif cat /proc/version | grep -Eqi \"ubuntu\"; then\r\n        release=\"ubuntu\"\r\n        systemPackage=\"apt\"\r\n    elif cat /proc/version | grep -Eqi \"centos|red hat|redhat\"; then\r\n        release=\"centos\"\r\n        systemPackage=\"yum\"\r\n    fi\r\n\r\n    if [[ ${checkType} == \"sysRelease\" ]]; then\r\n        if [ \"$value\" == \"$release\" ]; then\r\n            return 0\r\n        else\r\n            return 1\r\n        fi\r\n    elif [[ ${checkType} == \"packageManager\" ]]; then\r\n        if [ \"$value\" == \"$systemPackage\" ]; then\r\n            return 0\r\n        else\r\n            return 1\r\n        fi\r\n    fi\r\n}\r\n\r\n# Get version\r\ngetversion(){\r\n    if [[ -s /etc/redhat-release ]]; then\r\n        grep -oE  \"[0-9.]+\" /etc/redhat-release\r\n    else\r\n        grep -oE  \"[0-9.]+\" /etc/issue\r\n    fi\r\n}\r\n\r\n# CentOS version\r\ncentosversion(){\r\n    if check_sys sysRelease centos; then\r\n        local code=$1\r\n        local version=\"$(getversion)\"\r\n        local main_ver=${version%%.*}\r\n        if [ \"$main_ver\" == \"$code\" ]; then\r\n            return 0\r\n        else\r\n            return 1\r\n        fi\r\n    else\r\n        return 1\r\n    fi\r\n}\r\n\r\nget_char(){\r\n    SAVEDSTTY=`stty -g`\r\n    stty -echo\r\n    stty cbreak\r\n    dd if=/dev/tty bs=1 count=1 2> /dev/null\r\n    stty -raw\r\n    stty echo\r\n    stty $SAVEDSTTY\r\n}\r\n\r\ninstall_shadowsocksr(){\r\n    echo -e \"${green}是否需要安装ss/ssr？${plain}[y/N]\" && echo\r\n\tstty erase '^H' && read -p \"(默认: n):\" unyn\r\n\t[[ -z ${unyn} ]] && echo && echo -e \"${green}已取消...${plain}\"\r\n\tif [[ ${unyn} == [Yy] ]]; then\r\n    wget --no-check-certificate https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocksR.sh \r\n    chmod +x shadowsocksR.sh\r\n    ./shadowsocksR.sh 2>&1 | tee shadowsocksR.log\r\n\techo && echo -e \"${green}ss/ssr安装完成 !${plain}\" && echo\r\n    read -p \"回车后安装吃鸡雷达：\"\r\n\tfi\r\n}\r\n# Pre-installation settings\r\npre_install(){\r\n    if check_sys packageManager yum || check_sys packageManager apt; then\r\n        # Not support CentOS 5\r\n        if centosversion 5 || centosversion 6; then\r\n            echo -e \"$[{red}Error：${plain}] 脚本不支持 CentOS 5,请更换到 CentOS 7/Debian 8+/Ubuntu 14+ 再试一次.\"\r\n            exit 1\r\n        fi\r\n    else\r\n        echo -e \"[${red}Error：${plain}] 你的系统不被脚本支持. 请更换到 CentOS/Debian/Ubuntu 再试一次.\"\r\n        exit 1\r\n    fi\r\n    # Install necessary dependencies\r\n    if check_sys packageManager yum; then\r\n        yum -y update\r\n        yum -y groupinstall 'Development Tools'\r\n        yum install -y curl flex bison git net-tools\r\n        yum install -y libpcap-devel\r\n        curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -\r\n        yum install -y nodejs\r\n    elif check_sys packageManager apt; then\r\n        apt-get -y update\r\n        apt-get -y install build-essential\r\n        apt-get -y install libpcap-dev flex bison git sudo curl\r\n        curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -\r\n        apt-get install -y nodejs\r\n    fi\r\n    cd ${cur_dir}\r\n}\r\n\r\n# Firewall set\r\nfirewall_set(){\r\n    echo -e \"[${green}Info${plain}] firewall 开始设置...\"\r\n    if centosversion 6; then\r\n        /etc/init.d/iptables status > /dev/null 2>&1\r\n        if [ $? -eq 0 ]; then\r\n            iptables -L -n | grep -i 20086 > /dev/null 2>&1\r\n            if [ $? -ne 0 ]; then\r\n                iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 20086 -j ACCEPT\r\n                iptables -I INPUT -m state --state NEW -m udp -p udp --dport 20086 -j ACCEPT\r\n                /etc/init.d/iptables save\r\n                /etc/init.d/iptables restart\r\n            else\r\n                echo -e \"[${green}Info${plain}] 20086已放行.\"\r\n            fi\r\n        else\r\n            echo -e \"[${yellow}Warning${plain}] iptables 似乎已关闭或者未安装.\"\r\n        fi\r\n    elif centosversion 7; then\r\n        systemctl status firewalld > /dev/null 2>&1\r\n        if [ $? -eq 0 ]; then\r\n            firewall-cmd --permanent --zone=public --add-port=20086/tcp\r\n            firewall-cmd --permanent --zone=public --add-port=20086/udp\r\n            firewall-cmd --reload\r\n        else\r\n            echo -e \"[${yellow}Warning${plain}] firewalld 似乎未运行或未安装.\"\r\n        fi\r\n    fi\r\n    echo -e \"[${green}Info${plain}] firewall 设置完成...\"\r\n}\r\n\r\n# Install pubg radar\r\ninstall_radar(){\r\n    git clone https://github.com/794959818/pubgradar.git\r\n    cd pubgradar\r\n    npm i \r\n    # if check_sys packageManager yum; then\r\n    #     npm i -g pino\r\n    #     npm install -g forever\r\n    # elif check_sys packageManager apt; then\r\n        npm i -g pino\r\n        npm install -g forever\r\n    # fi\r\n}\r\n\r\n# start up pubg radar\r\nstart_radar(){\r\n    cd ${cur_dir} && cd pubgradar\r\n    ifconfig\r\n    IP=$(ifconfig -a | grep inet | grep -v 127.0.0.1 | grep -v inet6 | awk '{print $2}' | tr -d \"addrs:\")\r\n    read -p \"请输入网卡名称： \" eth\r\n    echo -e \"[${green}内网IP${plain}]：${IP}\"\r\n    read -p \"请输入内网ip： \" ip\r\n    forever start index.js sniff $eth $ip | pino\r\n    echo -e \"[${green}访问地址${plain}]：${IP}:20086\"\r\n}\r\n\r\n# Install pubg radar\r\ninstall_pubgradar(){\r\n    disable_selinux\r\n    install_shadowsocksr\r\n    pre_install\r\n    firewall_set\r\n    install_radar\r\n    start_radar\r\n}\r\n\r\n# Initialization step\r\naction=$1\r\n[ -z $1 ] && action=install\r\ncase \"$action\" in\r\n    install)\r\n        ${action}_pubgradar\r\n        ;;\r\n    *)\r\n        echo \"Arguments error! [${action}]\"\r\n        echo \"Usage: `basename $0` [install]\"\r\n        ;;\r\nesac\r\n```"}}
{"actor":{"display_login":"AlphaBrock"}}