Coder Social home page Coder Social logo

dollmachine's Introduction

基于 GoLang 编写的 IOT 物联网在线直播抓娃娃企业级项目

引言

前几年,娱乐物联网的热度很高。我当时所在的公司启动了一个将线下娃娃机的玩法,迁移到线上的项目,因此公司决定开发一个在线直播抓娃娃的项目。近来,娱乐物联网的领域已经进入资本的寒冬,很多相关的行业都已经濒临倒闭,我们之前的公司也不例外。目前公司大势已去,所以我将相关非关键的项目代码开源,仅供大家参考学习。

项目介绍

这是一个基于 GoLang 编写的 IOT 物联网企业级项目,主要提供的功能是:在线直播抓娃娃的一个娱乐型项目。

  • 用户端

用户基于微信公众号的 H5 页面进行游戏,功能包括:画面直播、弹幕评论、基于富友支付的微信充值功能。

  • 商家端

商家进行设备的管理、用户的管理、充值流水的查看、数据统计、游戏房间管理。

  • 平台端

平台主要是对商家的管理,例如:创建商家、编辑商家信息。

  • 设备端

一个基于安卓主板的娃娃机硬件设备,服务端通过 Mqtt 协议与安卓主板进行通信,进而控制娃娃机爪子的行为动作。

架构图

image

服务介绍

  • DollBarrage

通过 WebSocket 协议实现娃娃机弹幕服务,主要提供:游戏房间内评论弹幕的即时交互的功能。

  • DollMerchant

基于 Gin 框架提供娃娃机商户平台 Restful Api 服务,可支持自动生成 Swagger Api 文档。

  • DollMqtt

服务端通过 Mqtt 协议与娃娃机设备进行通信,从而控制娃娃机设备爪子的行为动作。

  • DollPlatform

基于 Gin 框架提供娃娃机运营平台 Restful Api 服务,可支持自动生成 Swagger Api 文档。

  • DollRpc

Rpc 服务,主要提供了富友支付(微信支付)的功能。

  • DollUnique

主要提供了生成唯一 ID 的功能。

  • DollUser

基于 Gin 框架提供微信用户端的 Restful Api 服务,可支持自动生成 Swagger Api 文档。

  • DollWechat

主要提供微信菜单配置、微信授权登录、微信扫码登录并关注公众的功能。

  • LiveServer

主要为娃娃机直播设备与微信用户端 H5 页面进行直播推流的一个中间服务。

结尾

本项目为企业级项目,仅供参考学习,目前数据库文件已经遗失。

dollmachine's People

Contributors

yxhsea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dollmachine's Issues

Potential ReDoS Vulnerability or Inefficient Regular Expression in Project: Need for Assessment and Mitigation

Hello,

I am writing to report a potential Regular Expression Denial of Service (ReDoS) vulnerability or Inefficient Regular Expression in the project. This issue arises when specially crafted input strings are used in the context of distributed, high-volume requests, potentially leading to a denial-of-service attack.

Location of Issue:

The vulnerability is related to a regular expression used in the following validation file, which may result in significantly prolonged execution times under certain conditions.

re := regexp.MustCompile(`(?s)<(?:style|script)[^<>]*>.*?</(?:style|script)>|</?[a-z][a-z0-9]*[^<>]*>|<!--.*?-->`)
re := regexp.MustCompile(`(?s)<(?:style|script)[^<>]*>.*?</(?:style|script)>|</?[a-z][a-z0-9]*[^<>]*>|<!--.*?-->`)
re := regexp.MustCompile(`(?s)<(?:style|script)[^<>]*>.*?</(?:style|script)>|</?[a-z][a-z0-9]*[^<>]*>|<!--.*?-->`)
re := regexp.MustCompile(`(?s)<(?:style|script)[^<>]*>.*?</(?:style|script)>|</?[a-z][a-z0-9]*[^<>]*>|<!--.*?-->`)

PoC Files and Comparisons:

// Proof of concept
filename := os.Args[1]
content, err := ioutil.ReadFile(filename)
re := regexp.MustCompile("(?s)<(?:style|script)[^<>]*>.*?</(?:style|script)>|</?[a-z][a-z0-9]*[^<>]*>|<!--.*?-->")
re.ReplaceAllString(string(content), "")

PoC Files Here:
poc.zip

To evaluate the performance of this inefficient regular expression matching with varying input contents, the following commands can be executed within the PoC folder:

time ./poc AttackString10MB.txt
# real    72m38.173s
# user    72m30.083s
# sys     0m5.653s
time ./poc RandomString10MB.txt
# real    0m0.029s
# user    0m0.016s
# sys     0m0.026s
time ./poc AttackString1MB.txt
# real    0m54.028s
# user    0m53.917s
# sys     0m0.088s
time ./poc RandomString1MB.txt
# real    0m0.011s
# user    0m0.007s
# sys     0m0.011s

The significant difference in processing time between random strings and malicious strings highlights the potential effectiveness of this regex for malicious exploitation. And as string length grows, the nonlinear increase in processing time reflects potentially greater risks.

Proposed Solution:

A possible mitigation strategy could include limiting the input length to prevent excessive processing times. If the corresponding function or feature is not in use, it is recommended to clean up risky third-party packages or code content to prevent malicious exploitation through methods such as code injection.

Additional Considerations:

Historically, it was believed that using regex engines with non-backtracking implementations (such as those in Rust or Go) would not lead to ReDoS vulnerabilities. However, recent studies have shown that this is not always the case. I recommend an assessment of how this issue might impact this project.

Thank you for your attention to this matter. Your evaluation and response to this potential security concern would be greatly appreciated.

Best regards,

想和你电话沟通一下

你好
我在网上看你挂出在线抓娃娃的源码,很感兴趣,想进行二开,可否合作?愿与你沟通一下.(我的电话13882202119微信号是zt13882202119,平时不常上网,为你注册该号,盼回复)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.