├── Dockerfile ├── README.md ├── api.php ├── js └── app.js └── index.html /Dockerfile: -------------------------------------------------------------------------------- 1 | # 使用官方 PHP-Apache 镜像 2 | FROM php:5.6-apache 3 | 4 | # docker-php-ext-install 为官方 PHP 镜像内置命令,用于安装 PHP 扩展依赖 5 | # pdo_mysql 为 PHP 连接 MySQL 扩展 6 | RUN docker-php-ext-install pdo_mysql 7 | 8 | # /var/www/html/ 为 Apache 目录 9 | COPY . /var/www/html/ 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ssincurl 2 | 解析arukas容器的映射ip&端口 Daocloud部署 3 | 骄傲的使用`Vue.js` 4 | 5 | 6 | 2017-03-10 20:23:00 7 | 因Daocloud免费容器自动休眠,环境替换为Arukas容器 8 | 9 | 10 | 注意! 11 |
12 | 仅兼容类似下图 Image ,其他需求可 Fork 修改 js/app.js 13 | ![](https://ws1.sinaimg.cn/large/005HABCygy1fdl17ghpecj30os0ibdgb) 14 | -------------------------------------------------------------------------------- /api.php: -------------------------------------------------------------------------------- 1 | isset($_GET['email']) ? $_GET['email'] : null, 20 | 'password' => isset($_GET['password']) ? $_GET['password'] : null 21 | ); 22 | $loginUrl = "https://app.arukas.io/api/login"; 23 | $ch_login = curl_init(); 24 | curl_setopt($ch_login, CURLOPT_URL, $loginUrl); 25 | curl_setopt($ch_login, CURLOPT_POST, 1); 26 | curl_setopt($ch_login, CURLOPT_POSTFIELDS, $data); 27 | curl_setopt($ch_login, CURLOPT_RETURNTRANSFER, 1); 28 | curl_setopt($ch_login, CURLOPT_COOKIEJAR, $cookie); 29 | $result = curl_exec($ch_login); 30 | 31 | $content = json_decode($result); 32 | 33 | $status = $content->status; 34 | 35 | if ($status != "200") { 36 | echo $content->message; 37 | echo ' 登录失败!请检查帐号密码。'; 38 | exit; 39 | }; 40 | curl_close($ch_login); 41 | } 42 | 43 | 44 | //登录成功后获取数据 45 | function get_content($cookie) 46 | { 47 | //登录成功之后访问的页面 48 | $contextUrl = "https://app.arukas.io/api/containers"; 49 | $ch_content = curl_init(); 50 | curl_setopt($ch_content, CURLOPT_URL, $contextUrl); 51 | //curl_setopt($ch, CURLOPT_HEADER, 0); 52 | //curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0); 53 | curl_setopt($ch_content, CURLOPT_COOKIEFILE, $cookie); //读取cookie 54 | $result = curl_exec($ch_content); 55 | 56 | $httpcode = curl_getinfo($ch_content, CURLINFO_HTTP_CODE); 57 | if ($httpcode != "200") { 58 | echo "Oops!"; 59 | exit; 60 | } 61 | 62 | return $result; 63 | curl_close($ch_content); 64 | } 65 | 66 | 67 | /* 68 | 69 | 70 | function curlPost($url, $data = array(), $timeout = 30, $CA = true){ 71 | 72 | $cacert = getcwd() . '/cacert.pem'; //CA根证书 73 | $SSL = substr($url, 0, 8) == "https://" ? true : false; 74 | 75 | $ch = curl_init(); 76 | curl_setopt($ch, CURLOPT_URL, $url); 77 | curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); 78 | curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout-2); 79 | if ($SSL && $CA) { 80 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); // 只信任CA颁布的证书 81 | curl_setopt($ch, CURLOPT_CAINFO, $cacert); // CA根证书(用来验证的网站证书是否是CA颁布) 82 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); // 检查证书中是否设置域名,并且是否与提供的主机名匹配 83 | } else if ($SSL && !$CA) { 84 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // 信任任何证书 85 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1); // 检查证书中是否设置域名 86 | } 87 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 88 | curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); //避免data数据过长问题 89 | curl_setopt($ch, CURLOPT_POST, true); 90 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 91 | //curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); //data with URLEncode 92 | 93 | $ret = curl_exec($ch); 94 | var_dump(curl_error($ch)); //查看报错信息 95 | 96 | curl_close($ch); 97 | return $ret; 98 | } 99 | 100 | 101 | 102 | curlPost($url,$data2);*/ 103 | 104 | 105 | //curl_setopt($ch, CURLOPT_HTTPHEADER, array()); 106 | //curl_setopt($ch, CURLOPT_USERAGENT, $UserAgent); 107 | #curl_setopt ($ch, CURLOPT_REFERER, "https://app.arukas.io"); 108 | //curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);//超时 109 | //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);//禁用ssl 110 | #curl_setopt($ch, CURLOPT_POSTFIELDS , http_build_query($data)); 111 | ?> -------------------------------------------------------------------------------- /js/app.js: -------------------------------------------------------------------------------- 1 | new Vue({ 2 | el: '#app', 3 | data: { 4 | email: '', 5 | password: '', 6 | configs: null, 7 | //configsCache:localStorage.configsCache 8 | }, 9 | methods: { 10 | newConfig: function () { 11 | layer.msg('解析中', { 12 | time: 0, //不自动关闭 13 | shadeClose: false, 14 | shade: 0.3 15 | }); 16 | 17 | this.$http.get('api.php?email=' + this.email + '&password=' + this.password, {emulateJSON: true}).then( 18 | function (response) { 19 | if (response.body.indexOf('Failed') != -1) { 20 | layer.msg(response.body, {icon: 2}); 21 | return 22 | } 23 | var result = JSON.parse(response.body) 24 | if (result.data.length<1) { 25 | layer.msg('你没有创建任何容器实例', {icon: 5}); 26 | return 27 | } 28 | this.configs = [] 29 | for (var i = 0; i < result.data.length; i++) { 30 | var mappingsObj = result.data[i].attributes.port_mappings 31 | var cmd = result.data[i].attributes.cmd 32 | var pwd = this.rePwd(cmd) 33 | var lock = this.reLock(cmd) 34 | var image_name = result.data[i].attributes.image_name 35 | if (image_name.indexOf("ss-with-net-speeder") ==-1) { 36 | continue 37 | } 38 | var mappingText = JSON.stringify(mappingsObj) 39 | var mappingJson = eval('(' + mappingText + ')') 40 | var ssHead = 'ss://' 41 | if (mappingJson) { 42 | for (var j = 0; j < mappingJson.length; j++) { 43 | for (var k = 0; k < mappingJson[j].length; k++) { 44 | var mappingResult = {} 45 | mappingResult.service_port = mappingJson[j][k].service_port 46 | mappingResult.container_port = mappingJson[j][k].container_port 47 | mappingResult.host = this.reHost(mappingJson[j][k].host) 48 | mappingResult.cmd = cmd 49 | mappingResult.pwd = pwd 50 | mappingResult.lock = lock 51 | ssUrl = lock+':'+pwd+'@'+this.reHost(mappingJson[j][k].host)+':'+mappingJson[j][k].service_port 52 | mappingResult.ss_url = ssHead+this.base64DeCode(ssUrl) 53 | this.configs.push(mappingResult) 54 | } 55 | } 56 | } 57 | } 58 | layer.msg('解析成功!', {icon: 6}) 59 | //localStorage.configsCache = this.configs 60 | } 61 | ) 62 | }, 63 | clearForm: function () { 64 | this.configs = null 65 | }, 66 | reHost: function (oldhost) { 67 | host = oldhost.match(/seaof-(\S*).jp/)[1] 68 | host = host.replace(/-/g, ".") 69 | return host 70 | }, 71 | rePwd: function (oldpwd) { 72 | if(oldpwd == null) return 73 | pwd = oldpwd.substring(oldpwd.indexOf("k ") + 2,oldpwd.indexOf(" -m")) 74 | return pwd 75 | }, 76 | reLock: function (oldLock) { 77 | if(oldLock == null) return 78 | lock = oldLock.substring(oldLock.indexOf("m ")+2) 79 | return lock 80 | }, 81 | base64DeCode: function (str) { 82 | var rawStr = str 83 | var wordArray = CryptoJS.enc.Utf8.parse(rawStr) 84 | var base64 = CryptoJS.enc.Base64.stringify(wordArray) 85 | return base64 86 | }, 87 | showQrCode: function (url,port) { 88 | $("canvas").remove() 89 | $("#"+port).qrcode(url) 90 | }, 91 | lmsg: function () { 92 | layer.msg('Everything is Nothing', {icon: 6}) 93 | } 94 | } 95 | }) 96 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Arukas Analysis 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
32 | 53 |
54 |
55 |
56 |
57 | 58 | 59 |
60 |
61 | 62 | 63 |
64 | 65 | 66 |
67 | 68 | 初衷 69 |

IP||Port天天变,好烦啊

70 | 支持的功能 71 |

根据你自己的帐号密码,直接获取arukasr容器的格式化IP与端口

72 |
73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 98 | 99 |
容器IP{{conf.host}}
映射端口{{conf.service_port}}
实际端口{{conf.container_port}}
CMD{{conf.cmd}}
Result 93 |
94 | 95 | 96 |
97 |
100 | 101 |
102 |
103 | 104 | 105 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | --------------------------------------------------------------------------------