PresetSeeder.php 18 KB

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