2020_08_21_150711_preset_data.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  1. <?php
  2. use App\Models\Config;
  3. use App\Models\Country;
  4. use App\Models\EmailFilter;
  5. use App\Models\Label;
  6. use App\Models\Level;
  7. use App\Models\Rule;
  8. use App\Models\SsConfig;
  9. use App\Models\User;
  10. use Illuminate\Database\Migrations\Migration;
  11. class PresetData extends Migration
  12. {
  13. /**
  14. * Run the migrations.
  15. *
  16. * @return void
  17. */
  18. public function up()
  19. {
  20. // 生成初始管理账号
  21. User::create([
  22. 'username' => '管理员',
  23. 'email' => 'test@test.com',
  24. 'password' => '123456',
  25. 'port' => 10000,
  26. 'passwd' => Str::random(),
  27. 'vmess_id' => Str::uuid(),
  28. 'is_admin' => 1
  29. ]);
  30. // 生成最初的等级
  31. Level::insert(['level' => 0, 'name' => 'Free']);
  32. for ($i = 1; $i < 8; $i++) {
  33. Level::insert(['level' => $i, 'name' => 'VIP-'.$i]);
  34. }
  35. // ss系列 加密方式
  36. SsConfig::insert(['name' => 'none', 'type' => 1, 'is_default' => 1]);
  37. SsConfig::insert(['name' => 'rc4-md5']);
  38. SsConfig::insert(['name' => 'aes-128-cfb']);
  39. SsConfig::insert(['name' => 'aes-192-cfb']);
  40. SsConfig::insert(['name' => 'aes-256-cfb']);
  41. SsConfig::insert(['name' => 'aes-128-ctr']);
  42. SsConfig::insert(['name' => 'aes-192-ctr']);
  43. SsConfig::insert(['name' => 'aes-256-ctr']);
  44. SsConfig::insert(['name' => 'aes-128-gcm']);
  45. SsConfig::insert(['name' => 'aes-192-gcm']);
  46. SsConfig::insert(['name' => 'aes-256-gcm']);
  47. SsConfig::insert(['name' => 'bf-cfb']);
  48. SsConfig::insert(['name' => 'cast5-cfb']);
  49. SsConfig::insert(['name' => 'des-cfb']);
  50. SsConfig::insert(['name' => 'salsa20']);
  51. SsConfig::insert(['name' => 'chacha20']);
  52. SsConfig::insert(['name' => 'chacha20-ietf']);
  53. SsConfig::insert(['name' => 'chacha20-ietf-poly1305']);
  54. // ss系列 协议
  55. SsConfig::insert(['name' => 'origin', 'type' => 2, 'is_default' => 1]);
  56. SsConfig::insert(['name' => 'auth_sha1_v4', 'type' => 2]);
  57. SsConfig::insert(['name' => 'auth_aes128_md5', 'type' => 2]);
  58. SsConfig::insert(['name' => 'auth_aes128_sha1', 'type' => 2]);
  59. SsConfig::insert(['name' => 'auth_chain_a', 'type' => 2]);
  60. SsConfig::insert(['name' => 'auth_chain_b', 'type' => 2]);
  61. SsConfig::insert(['name' => 'auth_chain_c', 'type' => 2]);
  62. SsConfig::insert(['name' => 'auth_chain_d', 'type' => 2]);
  63. SsConfig::insert(['name' => 'auth_chain_e', 'type' => 2]);
  64. SsConfig::insert(['name' => 'auth_chain_f', 'type' => 2]);
  65. // ss系列 混淆
  66. SsConfig::insert(['name' => 'plain', 'type' => 3, 'is_default' => 1]);
  67. SsConfig::insert(['name' => 'http_simple', 'type' => 3]);
  68. SsConfig::insert(['name' => 'http_post', 'type' => 3]);
  69. SsConfig::insert(['name' => 'tls1.2_ticket_auth', 'type' => 3]);
  70. SsConfig::insert(['name' => 'tls1.2_ticket_fastauth', 'type' => 3]);
  71. $configList = [
  72. 'is_rand_port',
  73. 'is_user_rand_port',
  74. 'invite_num',
  75. 'is_register',
  76. 'is_invite_register',
  77. 'website_name',
  78. 'is_reset_password',
  79. 'reset_password_times',
  80. 'website_url',
  81. 'referral_type',
  82. 'active_times',
  83. 'is_checkin',
  84. 'min_rand_traffic',
  85. 'max_rand_traffic',
  86. 'wechat_qrcode',
  87. 'alipay_qrcode',
  88. 'traffic_limit_time',
  89. 'referral_traffic',
  90. 'referral_percent',
  91. 'referral_money',
  92. 'referral_status',
  93. 'default_traffic',
  94. 'traffic_warning',
  95. 'traffic_warning_percent',
  96. 'expire_warning',
  97. 'expire_days',
  98. 'reset_traffic',
  99. 'default_days',
  100. 'subscribe_max',
  101. 'min_port',
  102. 'max_port',
  103. 'is_captcha',
  104. 'is_traffic_ban',
  105. 'traffic_ban_value',
  106. 'traffic_ban_time',
  107. 'is_clear_log',
  108. 'is_node_offline',
  109. 'webmaster_email',
  110. 'is_notification',
  111. 'server_chan_key',
  112. 'is_subscribe_ban',
  113. 'subscribe_ban_times',
  114. 'codepay_url',
  115. 'codepay_id',
  116. 'codepay_key',
  117. 'is_free_code',
  118. 'is_forbid_robot',
  119. 'subscribe_domain',
  120. 'auto_release_port',
  121. 'website_callback_url',
  122. 'web_api_url',
  123. 'v2ray_license',
  124. 'trojan_license',
  125. 'v2ray_tls_provider',
  126. 'website_analytics',
  127. 'website_customer_service',
  128. 'register_ip_limit',
  129. 'is_email_filtering',
  130. 'is_push_bear',
  131. 'push_bear_send_key',
  132. 'push_bear_qrcode',
  133. 'is_ban_status',
  134. 'is_namesilo',
  135. 'namesilo_key',
  136. 'website_logo',
  137. 'website_home_logo',
  138. 'nodes_detection',
  139. 'detection_check_times',
  140. 'is_forbid_china',
  141. 'is_forbid_oversea',
  142. 'AppStore_id',
  143. 'AppStore_password',
  144. 'is_activate_account',
  145. 'node_daily_report',
  146. 'mix_subscribe',
  147. 'rand_subscribe',
  148. 'is_custom_subscribe',
  149. 'is_AliPay',
  150. 'is_QQPay',
  151. 'is_WeChatPay',
  152. 'is_otherPay',
  153. 'alipay_private_key',
  154. 'alipay_public_key',
  155. 'alipay_transport',
  156. 'alipay_currency',
  157. 'bitpay_secret',
  158. 'f2fpay_app_id',
  159. 'f2fpay_private_key',
  160. 'f2fpay_public_key',
  161. 'website_security_code',
  162. 'subject_name',
  163. 'geetest_id',
  164. 'geetest_key',
  165. 'google_captcha_sitekey',
  166. 'google_captcha_secret',
  167. 'user_invite_days',
  168. 'admin_invite_days',
  169. 'offline_check_times',
  170. 'payjs_mch_id',
  171. 'payjs_key',
  172. 'maintenance_mode',
  173. 'maintenance_time',
  174. 'maintenance_content',
  175. 'bark_key',
  176. 'hcaptcha_secret',
  177. 'hcaptcha_sitekey',
  178. 'paypal_username',
  179. 'paypal_password',
  180. 'paypal_secret',
  181. 'paypal_certificate',
  182. 'paypal_app_id',
  183. 'redirect_url',
  184. 'epay_url',
  185. 'epay_mch_id',
  186. 'epay_key'
  187. ];
  188. foreach ($configList as $config) {
  189. Config::insert(['name' => $config]);
  190. }
  191. $presetDates = [
  192. 'invite_num' => 3,
  193. 'is_register' => 1,
  194. 'is_invite_register' => 2,
  195. 'website_name' => 'ProxyPanel',
  196. 'is_reset_password' => 1,
  197. 'reset_password_times' => 3,
  198. 'website_url' => 'https://demo.proxypanel.ml',
  199. 'active_times' => 3,
  200. 'is_checkin' => 1,
  201. 'min_rand_traffic' => 10,
  202. 'max_rand_traffic' => 500,
  203. 'traffic_limit_time' => 1440,
  204. 'referral_traffic' => 1024,
  205. 'referral_percent' => 0.2,
  206. 'referral_money' => 100,
  207. 'referral_status' => 1,
  208. 'default_traffic' => 1024,
  209. 'traffic_warning_percent' => 80,
  210. 'expire_days' => 15,
  211. 'reset_traffic' => 1,
  212. 'default_days' => 7,
  213. 'subscribe_max' => 3,
  214. 'min_port' => 10000,
  215. 'max_port' => 65535,
  216. 'is_traffic_ban' => 1,
  217. 'traffic_ban_value' => 10,
  218. 'traffic_ban_time' => 60,
  219. 'is_clear_log' => 1,
  220. 'is_subscribe_ban' => 1,
  221. 'subscribe_ban_times' => 20,
  222. 'auto_release_port' => 1,
  223. 'register_ip_limit' => 5,
  224. 'detection_check_times' => 3,
  225. 'alipay_transport' => 'http',
  226. 'alipay_currency' => 'USD',
  227. 'user_invite_days' => 7,
  228. 'admin_invite_days' => 7,
  229. ];
  230. foreach ($presetDates as $key => $value) {
  231. Config::find($key)->update(['value' => $value]);
  232. }
  233. // 节点用标签
  234. $labelList = [
  235. 'Netflix',
  236. 'Hulu',
  237. 'HBO',
  238. 'Amazon Video',
  239. 'DisneyNow',
  240. 'BBC',
  241. 'Channel 4',
  242. 'Fox+',
  243. 'Happyon',
  244. 'AbemeTV',
  245. 'DMM',
  246. 'NicoNico',
  247. 'Pixiv',
  248. 'TVer',
  249. 'TVB',
  250. 'HBO Go',
  251. 'BiliBili港澳台',
  252. '動畫瘋',
  253. '四季線上影視',
  254. 'LINE TV',
  255. 'Youtube Premium',
  256. '中国视频网站',
  257. '网易云音乐',
  258. 'QQ音乐',
  259. 'DisneyPlus',
  260. 'Pandora',
  261. 'SoundCloud',
  262. 'Spotify',
  263. 'TIDAL',
  264. 'TikTok',
  265. 'Pornhub',
  266. 'Twitch'
  267. ];
  268. foreach ($labelList as $label) {
  269. Label::insert(['name' => $label]);
  270. }
  271. // 黑名单邮箱 过滤列表
  272. $blackEmailSuffixList = [
  273. 'chacuo.com',
  274. '1766258.com',
  275. '3202.com',
  276. '4057.com',
  277. '4059.com',
  278. 'a7996.com',
  279. 'bccto.me',
  280. 'bnuis.com',
  281. 'chaichuang.com',
  282. 'cr219.com',
  283. 'cuirushi.org',
  284. 'dawin.com',
  285. 'jiaxin8736.com',
  286. 'lakqs.com',
  287. 'urltc.com',
  288. '027168.com',
  289. '10minutemail.net',
  290. '11163.com',
  291. '1shivom.com',
  292. 'auoie.com',
  293. 'bareed.ws',
  294. 'bit-degree.com',
  295. 'cjpeg.com',
  296. 'cool.fr.nf',
  297. 'courriel.fr.nf',
  298. 'disbox.net',
  299. 'disbox.org',
  300. 'fidelium10.com',
  301. 'get365.pw',
  302. 'ggr.la',
  303. 'grr.la',
  304. 'guerrillamail.biz',
  305. 'guerrillamail.com',
  306. 'guerrillamail.de',
  307. 'guerrillamail.net',
  308. 'guerrillamail.org',
  309. 'guerrillamailblock.com',
  310. 'hubii-network.com',
  311. 'hurify1.com',
  312. 'itoup.com',
  313. 'jetable.fr.nf',
  314. 'jnpayy.com',
  315. 'juyouxi.com',
  316. 'mail.bccto.me',
  317. 'www.bccto.me',
  318. 'mega.zik.dj',
  319. 'moakt.co',
  320. 'moakt.ws',
  321. 'molms.com',
  322. 'moncourrier.fr.nf',
  323. 'monemail.fr.nf',
  324. 'monmail.fr.nf',
  325. 'nomail.xl.cx',
  326. 'nospam.ze.tc',
  327. 'pay-mon.com',
  328. 'poly-swarm.com',
  329. 'sgmh.online',
  330. 'sharklasers.com',
  331. 'shiftrpg.com',
  332. 'spam4.me',
  333. 'speed.1s.fr',
  334. 'tmail.ws',
  335. 'tmails.net',
  336. 'tmpmail.net',
  337. 'tmpmail.org',
  338. 'travala10.com',
  339. 'yopmail.com',
  340. 'yopmail.fr',
  341. 'yopmail.net',
  342. 'yuoia.com',
  343. 'zep-hyr.com',
  344. 'zippiex.com',
  345. 'lrc8.com',
  346. '1otc.com',
  347. 'emailna.co',
  348. 'mailinator.com',
  349. 'nbzmr.com',
  350. 'awsoo.com',
  351. 'zhcne.com',
  352. '0box.eu',
  353. 'contbay.com',
  354. 'damnthespam.com',
  355. 'kurzepost.de',
  356. 'objectmail.com',
  357. 'proxymail.eu',
  358. 'rcpt.at',
  359. 'trash-mail.at',
  360. 'trashmail.at',
  361. 'trashmail.com',
  362. 'trashmail.io',
  363. 'trashmail.me',
  364. 'trashmail.net',
  365. 'wegwerfmail.de',
  366. 'wegwerfmail.net',
  367. 'wegwerfmail.org',
  368. 'nwytg.net',
  369. 'despam.it',
  370. 'spambox.us',
  371. 'spam.la',
  372. 'mytrashmail.com',
  373. 'mt2014.com',
  374. 'mt2015.com',
  375. 'thankyou2010.com',
  376. 'trash2009.com',
  377. 'mt2009.com',
  378. 'trashymail.com',
  379. 'tempemail.net',
  380. 'slopsbox.com',
  381. 'mailnesia.com',
  382. 'ezehe.com',
  383. 'tempail.com',
  384. 'newairmail.com',
  385. 'temp-mail.org',
  386. 'linshiyouxiang.net',
  387. 'zwoho.com',
  388. 'mailboxy.fun',
  389. 'crypto-net.club',
  390. 'guerrillamail.info',
  391. 'pokemail.net',
  392. 'odmail.cn',
  393. 'hlooy.com',
  394. 'ozlaq.com',
  395. '666email.com',
  396. 'linshiyou.com',
  397. 'linshiyou.pl',
  398. 'woyao.pl',
  399. 'yaowo.pl'
  400. ];
  401. foreach ($blackEmailSuffixList as $emailSuffix) {
  402. EmailFilter::insert(['type' => 1, 'words' => $emailSuffix]);
  403. }
  404. // 白名单邮箱 过滤列表
  405. $whiteEmailSuffixList = [
  406. 'qq.com',
  407. '163.com',
  408. '126.com',
  409. '189.com',
  410. 'sohu.com',
  411. 'gmail.com',
  412. 'outlook.com',
  413. 'icloud.com'
  414. ];
  415. foreach ($whiteEmailSuffixList as $emailSuffix) {
  416. EmailFilter::insert(['type' => 2, 'words' => $emailSuffix]);
  417. }
  418. $countryList = [
  419. 'au' => '澳大利亚',
  420. 'br' => '巴西',
  421. 'ca' => '加拿大',
  422. 'ch' => '瑞士',
  423. 'cn' => '中国',
  424. 'de' => '德国',
  425. 'dk' => '丹麦',
  426. 'eg' => '埃及',
  427. 'fr' => '法国',
  428. 'gr' => '希腊',
  429. 'hk' => '香港',
  430. 'id' => '印度尼西亚',
  431. 'ie' => '爱尔兰',
  432. 'il' => '以色列',
  433. 'in' => '印度',
  434. 'iq' => '伊拉克',
  435. 'ir' => '伊朗',
  436. 'it' => '意大利',
  437. 'jp' => '日本',
  438. 'kr' => '韩国',
  439. 'mx' => '墨西哥',
  440. 'my' => '马来西亚',
  441. 'nl' => '荷兰',
  442. 'no' => '挪威',
  443. 'nz' => '纽西兰',
  444. 'ph' => '菲律宾',
  445. 'ru' => '俄罗斯',
  446. 'se' => '瑞典',
  447. 'sg' => '新加坡',
  448. 'th' => '泰国',
  449. 'tr' => '土耳其',
  450. 'tw' => '台湾',
  451. 'uk' => '英国',
  452. 'us' => '美国',
  453. 'vn' => '越南',
  454. 'pl' => '波兰',
  455. 'kz' => '哈萨克斯坦',
  456. 'ua' => '乌克兰',
  457. 'ro' => '罗马尼亚',
  458. 'ae' => '阿联酋',
  459. 'za' => '南非',
  460. 'mm' => '缅甸',
  461. 'is' => '冰岛',
  462. 'fi' => '芬兰',
  463. 'lu' => '卢森堡',
  464. 'be' => '比利时',
  465. 'bg' => '保加利亚',
  466. 'lt' => '立陶宛',
  467. 'co' => '哥伦比亚',
  468. 'mo' => '澳门',
  469. 'ke' => '肯尼亚',
  470. 'cz' => '捷克',
  471. 'md' => '摩尔多瓦',
  472. 'es' => '西班牙',
  473. 'pk' => '巴基斯坦',
  474. 'pt' => '葡萄牙',
  475. 'hu' => '匈牙利',
  476. 'ar' => '阿根廷'
  477. ];
  478. foreach ($countryList as $code => $name) {
  479. Country::insert(['code' => $code, 'name' => $name]);
  480. }
  481. // 审核规则
  482. $ruleList = [
  483. '360' => '(.*.||)(^360|0360|1360|3600|360safe|^so|qhimg|qhmsg|^yunpan|qihoo|qhcdn|qhupdate|360totalsecurity|360shouji|qihucdn|360kan|secmp).(cn|com|net)',
  484. '腾讯管家' => '(.guanjia.qq.com|qqpcmgr|QQPCMGR)',
  485. '金山毒霸' => '(.*.||)(rising|kingsoft|duba|xindubawukong|jinshanduba).(com|net|org)',
  486. '暗网相关' => '(.*.||)(netvigator|torproject).(cn|com|net|org)',
  487. '百度定位' => '(api|ps|sv|offnavi|newvector|ulog.imap|newloc|tracknavi)(.map|).(baidu|n.shifen).com',
  488. '法轮功类' => '(.*.||)(dafahao|minghui|dongtaiwang|dajiyuan|falundata|shenyun|tuidang|epochweekly|epochtimes|ntdtv|falundafa|wujieliulan|zhengjian).(org|com|net)',
  489. 'BT扩展名' => '(torrent|.torrent|peer_id=|info_hash|get_peers|find_node|BitTorrent|announce_peer|announce.php?passkey=)',
  490. '邮件滥发' => '((^.*@)(guerrillamail|guerrillamailblock|sharklasers|grr|pokemail|spam4|bccto|chacuo|027168).(info|biz|com|de|net|org|me|la)|Subject|HELO|SMTP)',
  491. '迅雷下载' => '(.?)(xunlei|sandai|Thunder|XLLiveUD)(.)',
  492. '大陆应用' => '(.*.||)(baidu|qq|163|189|10000|10010|10086|sohu|sogoucdn|sogou|uc|58|taobao|qpic|bilibili|hdslb|acgvideo|sina|douban|doubanio|xiaohongshu|sinaimg|weibo|xiaomi|youzanyun|meituan|dianping|biliapi|huawei|pinduoduo|cnzz).(org|com|net|cn)',
  493. '大陆银行' => '(.*.||)(icbc|ccb|boc|bankcomm|abchina|cmbchina|psbc|cebbank|cmbc|pingan|spdb|citicbank|cib|hxb|bankofbeijing|hsbank|tccb|4001961200|bosc|hkbchina|njcb|nbcb|lj-bank|bjrcb|jsbchina|gzcb|cqcbank|czbank|hzbank|srcb|cbhb|cqrcb|grcbank|qdccb|bocd|hrbcb|jlbank|bankofdl|qlbchina|dongguanbank|cscb|hebbank|drcbank|zzbank|bsb|xmccb|hljrcc|jxnxs|gsrcu|fjnx|sxnxs|gx966888|gx966888|zj96596|hnnxs|ahrcu|shanxinj|hainanbank|scrcu|gdrcu|hbxh|ynrcc|lnrcc|nmgnxs|hebnx|jlnls|js96008|hnnx|sdnxs).(org|com|net|cn)',
  494. '台湾银行' => '(.*.||)(firstbank|bot|cotabank|megabank|tcb-bank|landbank|hncb|bankchb|tbb|ktb|tcbbank|scsb|bop|sunnybank|kgibank|fubon|ctbcbank|cathaybk|eximbank|bok|ubot|feib|yuantabank|sinopac|esunbank|taishinbank|jihsunbank|entiebank|hwataibank|csc|skbank).(org|com|net|tw)',
  495. '大陆第三方支付' => '(.*.||)(alipay|baifubao|yeepay|99bill|95516|51credit|cmpay|tenpay|lakala|jdpay).(org|com|net|cn)',
  496. '台湾特供' => '(.*.||)(visa|mycard|mastercard|gov|gash|beanfun|bank|line).(org|com|net|cn|tw|jp|kr)',
  497. '涉政治类' => '(.*.||)(shenzhoufilm|secretchina|renminbao|aboluowang|mhradio|guangming|zhengwunet|soundofhope|yuanming|zhuichaguoji|fgmtv|xinsheng|shenyunperformingarts|epochweekly|tuidang|shenyun|falundata|bannedbook|pincong|rfi|mingjingnews|boxun|rfa|scmp|ogate|voachinese).(org|com|net|rocks|fr)',
  498. '流媒体' => '(.*.||)(youtube|googlevideo|hulu|netflix|nflxvideo|akamai|nflximg|hbo|mtv|bbc|tvb).(org|club|com|net|tv)',
  499. '测速类' => '(.*.||)(fast|speedtest).(org|com|net|cn)',
  500. '外汇交易类' => '(.*.||)(metatrader4|metatrader5|mql5).(org|com|net)'
  501. ];
  502. foreach ($ruleList as $name => $pattern) {
  503. Rule::insert(['type' => 1, 'name' => $name, 'pattern' => $pattern]);
  504. }
  505. }
  506. /**
  507. * Reverse the migrations.
  508. *
  509. * @return void
  510. */
  511. public function down()
  512. {
  513. echo 'plz run php artisan migrate:fresh'.PHP_EOL;
  514. echo '请运行 php artisan migrate:fresh'.PHP_EOL;
  515. }
  516. }