├── LICENSE ├── README.md ├── config.php ├── functions.php ├── gateways ├── blockchain.config.php ├── blockchain.functions.php └── blockchain.php ├── get_address.php ├── get_status.php ├── import.sql ├── index.php └── static └── css └── narrow.css /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Jebwiz Oscar 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # bitsocks 2 | #### A lightweight Bitcoin-accepting Front-End for mengskysama/shadowsocks 3 | 4 | Donations Welcomed: 18dgui9RA4964MGQuGgm4BqPdrxRXJAUc8 5 | 6 | Using Blockchain.info API, so we don't need to run bitcoind on server. 7 | 8 | ### Install: 9 | Make sure to change config.php and import import.sql 10 | 11 | Upd: Also gateways/[gateway_name].config.php 12 | 13 | Run shadowsocks-manyuser, then just upload the script to your web server, and import the database :) 14 | 15 | Account Details will be sent via E-Mail when a deposit is done. 16 | ### Sample Outgoing Mail: 17 | ``` 18 | Hi [e-mail address], 19 | You deposited 0.008 for (1,038.254 MiB @ 0.00789017/GiB) 20 | Transaction ID: 98315e8ce09dba3a249f4ec97addac3465fec9c7bb6721c13ce26936cba0460d 21 | Blockchain: https://blockchain.info/tx/98315e8ce09dba3a249f4ec97addac3465fec9c7bb6721c13ce26936cba0460d 22 | =============== 23 | Shadowsocks Server: [server address hidden] 24 | Encryption: aes-256-cfb 25 | Port: 13337 26 | Password: 93673369 27 | =============== 28 | Total: 1,039.254 MiB 29 | Uploaded: 0.249 MiB 30 | Downloaded: 0.833 MiB 31 | Remaining: 1,038.173 MiB 32 | =============== 33 | You can always reuse your deposit address. 34 | ``` 35 | 36 | -------------------------------------------------------------------------------- /config.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /functions.php: -------------------------------------------------------------------------------- 1 | SENDGRID_USERNAME, 18 | 'api_key' => SENDGRID_PASSWORD, 19 | 'to' => $email, 20 | 'fromname' => MAILER_NAME, 21 | 'from' => SENDGRID_ADDRESS, 22 | 'subject' => $subject, 23 | 'text' => $text 24 | ); 25 | 26 | // use key 'http' even if you send the request to https://... 27 | $options = array( 28 | 'http' => array( 29 | 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 30 | 'method' => 'POST', 31 | 'content' => http_build_query($data), 32 | ), 33 | ); 34 | $context = stream_context_create($options); 35 | $result = file_get_contents($request_uri, false, $context); 36 | } 37 | ?> -------------------------------------------------------------------------------- /gateways/blockchain.config.php: -------------------------------------------------------------------------------- 1 | 2015.01.29 7 | */ 8 | 9 | /* Config Begin */ 10 | 11 | // Your receive address 12 | define('BITCOIN_ADDRESS', '18dgui9RA4964MGQuGgm4BqPdrxRXJAUc8'); 13 | // Better change it to a more random string 14 | define('SECRET_KEY', 'itisarandomstring'); 15 | 16 | define('FIAT', 'USD'); 17 | define('CRYPTO', 'BTC'); 18 | 19 | // true: Price in Fiat false: Price in Crypto 20 | define('IN_FIAT', true); 21 | define('IN_CRYPTO', !IN_FIAT); 22 | 23 | if (IN_FIAT) 24 | define('FIAT_PER_GB', 1.6); 25 | if (IN_CRYPTO) 26 | define('CRYPTO_PER_GB', 0.01); // only valid when IN_FIAT == FALSE 27 | 28 | /* Config End */ 29 | include 'gateways/blockchain.functions.php'; 30 | ?> -------------------------------------------------------------------------------- /gateways/blockchain.functions.php: -------------------------------------------------------------------------------- 1 | input_address; 6 | } 7 | function Get_Fiat_Equalvent($value=1,$currency="USD"){ 8 | $request_uri = "https://blockchain.info/tobtc?currency=$currency&value=$value"; 9 | $response = file_get_contents($request_uri); 10 | return $response; 11 | } 12 | 13 | define('CRYPTO_PER_FIAT', Get_Fiat_Equalvent(1,FIAT)); 14 | define('FIAT_PER_CRYPTO', 1.0/CRYPTO_PER_FIAT); 15 | if (IN_FIAT) define('CRYPTO_PER_GB',FIAT_PER_GB * CRYPTO_PER_FIAT); 16 | ?> -------------------------------------------------------------------------------- /gateways/blockchain.php: -------------------------------------------------------------------------------- 1 | id; 16 | $result = mysql_query($sql); 17 | $title = 'Your Bitsocks account is Funded!'; 18 | }else{ 19 | $sql = "SELECT `port` FROM `user` ORDER BY `port` DESC LIMIT 1"; 20 | $result = mysql_query($sql); 21 | $row = mysql_fetch_object($result); 22 | $port = $row->port + 1; 23 | $passwd = sprintf("%08d",(int)rand(0,99999999)); 24 | $sql = "INSERT INTO `user` (`email`, `pass`, `passwd`, `t`, `u`, `d`, `transfer_enable`, `port`, `switch`, `enable`, `type`) VALUES( '$EMail', '$Pass', '$passwd', 0, 0, 0, '$BW', $port, 1, 1, 1);"; 25 | $result = mysql_query($sql); 26 | $title = 'Your Bitsocks account is Ready!'; 27 | } 28 | 29 | $sql = "SELECT * FROM user WHERE `email`='$EMail' AND `pass`='$Pass'"; 30 | $result = mysql_query($sql); 31 | $row = mysql_fetch_object($result); 32 | $BW_MiB = number_format(($_GET['value'] / 100000000.0)/ CRYPTO_PER_GB * 1024.0,3); 33 | $u=number_format($row->u/ 1048576.0,3); 34 | $d=number_format($row->d/ 1048576.0,3); 35 | $t=number_format($row->transfer_enable/ 1048576.0,3); 36 | $r=number_format(($row->transfer_enable-$row->u-$row->d)/ 1048576.0,3); 37 | $sd=SHADOWSOCKS_DOMAIN; 38 | $ec=SHADOWSOCKS_ENCRYPTION; 39 | $cpg=CRYPTO_PER_GB; 40 | $content=<<port} 49 | Password: {$row->passwd} 50 | =============== 51 | Total: $t MiB 52 | Uploaded: $u MiB 53 | Downloaded: $d MiB 54 | Remaining: $r MiB 55 | =============== 56 | You can always reuse your deposit address. 57 | EOT; 58 | Send_Mail($EMail,$title,$content); 59 | echo "*ok*"; 60 | ?> -------------------------------------------------------------------------------- /get_address.php: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
Deposit Here:
You will receive an e-mail with your account-detail in it after confirmations.
This address can always be re-used.
-------------------------------------------------------------------------------- /get_status.php: -------------------------------------------------------------------------------- 1 | u/ 1048576.0,3); 9 | $d=number_format($row->d/ 1048576.0,3); 10 | $t=number_format($row->transfer_enable/ 1048576.0,3); 11 | $r=number_format(($row->transfer_enable-$row->u-$row->d)/ 1048576.0,3); 12 | $sd=SHADOWSOCKS_DOMAIN; 13 | $ec=SHADOWSOCKS_ENCRYPTION; 14 | echo << 16 | Shadowsocks Server: $sd 17 | Encryption: $ec 18 | Port: {$row->port} 19 | Password: {$row->passwd} 20 | =============== 21 | Total: $t MiB 22 | Uploaded: $u MiB 23 | Downloaded: $d MiB 24 | Remaining: $r MiB 25 | 26 | EOT; 27 | }else{ 28 | echo 'E-mail / Key Pair Not Found!'; 29 | } 30 | ?> -------------------------------------------------------------------------------- /import.sql: -------------------------------------------------------------------------------- 1 | SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; 2 | 3 | 4 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 5 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 6 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 7 | /*!40101 SET NAMES utf8 */; 8 | 9 | CREATE TABLE IF NOT EXISTS `user` ( 10 | `id` int(11) NOT NULL AUTO_INCREMENT, 11 | `email` varchar(32) NOT NULL, 12 | `pass` varchar(40) NOT NULL, 13 | `passwd` varchar(16) NOT NULL, 14 | `t` int(11) NOT NULL DEFAULT '0', 15 | `u` bigint(20) NOT NULL, 16 | `d` bigint(20) NOT NULL, 17 | `transfer_enable` bigint(20) NOT NULL, 18 | `port` int(11) NOT NULL, 19 | `switch` tinyint(4) NOT NULL DEFAULT '1', 20 | `enable` tinyint(4) NOT NULL DEFAULT '1', 21 | `type` tinyint(4) NOT NULL DEFAULT '1', 22 | PRIMARY KEY (`id`,`port`) 23 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ; 24 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | <?php echo SITE_NAME; ?> 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 27 | 28 | 29 | 30 | 31 |
32 | 33 |
34 | 37 |

38 |
39 |
40 |

41 |

A bitcoin-based Shadowsocks server

42 |

Current Price: / GiB

43 | 44 | 45 | 46 | 49 | 52 | 53 | 54 | 57 | 60 | 61 |
47 | E-mail 48 | 50 | 51 |
55 | Manage Key 56 | 58 | 59 |
62 |
63 |
64 |

65 | 66 | 67 |

68 |

69 |
70 |

Note:
71 | Manage Key isn't Shadowsocks Password.
72 | It's possible to have different Manage Keys under a same E-mail.
73 | Account Details will be sent via E-Mail when a deposit is done (have at least confirmations). 74 |

75 |
76 | 100 |
101 |

©  
Powered by bitsocks by Jebwiz Oscar, based on mengskysama/shadowsocks

102 |

Donation: 18dgui9RA4964MGQuGgm4BqPdrxRXJAUc8

103 |
104 |
105 | 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /static/css/narrow.css: -------------------------------------------------------------------------------- 1 | /* Space out content a bit */ 2 | body { 3 | padding-top: 20px; 4 | padding-bottom: 20px; 5 | } 6 | 7 | /* Everything but the jumbotron gets side spacing for mobile first views */ 8 | .header, 9 | .marketing, 10 | .footer { 11 | padding-right: 15px; 12 | padding-left: 15px; 13 | } 14 | 15 | /* Custom page header */ 16 | .header { 17 | border-bottom: 1px solid #e5e5e5; 18 | } 19 | /* Make the masthead heading the same height as the navigation */ 20 | .header h3 { 21 | padding-bottom: 19px; 22 | margin-top: 0; 23 | margin-bottom: 0; 24 | line-height: 40px; 25 | } 26 | 27 | /* Custom page footer */ 28 | .footer { 29 | padding-top: 19px; 30 | color: #777; 31 | border-top: 1px solid #e5e5e5; 32 | } 33 | 34 | /* Customize container */ 35 | @media (min-width: 768px) { 36 | .container { 37 | max-width: 730px; 38 | } 39 | } 40 | .container-narrow > hr { 41 | margin: 30px 0; 42 | } 43 | 44 | /* Main marketing message and sign up button */ 45 | .jumbotron { 46 | text-align: center; 47 | border-bottom: 1px solid #e5e5e5; 48 | } 49 | .jumbotron .btn { 50 | padding: 14px 24px; 51 | font-size: 21px; 52 | } 53 | 54 | /* Supporting marketing content */ 55 | .marketing { 56 | margin: 40px 0; 57 | } 58 | .marketing p + h4 { 59 | margin-top: 28px; 60 | } 61 | 62 | /* Responsive: Portrait tablets and up */ 63 | @media screen and (min-width: 768px) { 64 | /* Remove the padding we set earlier */ 65 | .header, 66 | .marketing, 67 | .footer { 68 | padding-right: 0; 69 | padding-left: 0; 70 | } 71 | /* Space out the masthead */ 72 | .header { 73 | margin-bottom: 30px; 74 | } 75 | /* Remove the bottom border on the jumbotron for visual effect */ 76 | .jumbotron { 77 | border-bottom: 0; 78 | } 79 | } --------------------------------------------------------------------------------