mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-06-29 21:47:50 +08:00
Compare commits
5 Commits
76f030987f
...
a425c9f0bc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a425c9f0bc | ||
|
|
a9ad7cf5a8 | ||
|
|
b760458e4e | ||
|
|
fd3dc4dada | ||
|
|
c011389c3f |
@ -95,43 +95,52 @@ public class SSRCFactory {
|
||||
}
|
||||
|
||||
void rebuild() {
|
||||
List<MediaServer> servers = mediaServerService.getAll();
|
||||
for (MediaServer server : servers) {
|
||||
if (server.isRtpEnable() && userSetting.getSsrcRandom()) {
|
||||
continue;
|
||||
}
|
||||
synchronized (lockMap.computeIfAbsent(server.getId(), k -> new Object())) {
|
||||
BitSet bits = new BitSet(10000);
|
||||
int count = 0;
|
||||
try {
|
||||
List<MediaServer> servers = mediaServerService.getAll();
|
||||
for (MediaServer server : servers) {
|
||||
try {
|
||||
ZLMResult<?> result = zlmresTfulUtils.getMediaList(server, null, null, "rtsp", null);
|
||||
if (result != null && result.getCode() == 0 && result.getData() != null) {
|
||||
List<JSONObject> list = (List<JSONObject>) result.getData();
|
||||
for (JSONObject obj : list) {
|
||||
if (obj.getIntValue("originType") != 3) continue;
|
||||
String originUrl = obj.getString("originUrl");
|
||||
if (originUrl == null) continue;
|
||||
int idx = originUrl.lastIndexOf("/rtp/");
|
||||
if (idx == -1) continue;
|
||||
try {
|
||||
int suffix = (int) (Long.parseLong(originUrl.substring(idx + 5), 16) % 10000);
|
||||
bits.set(suffix);
|
||||
count++;
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
}
|
||||
if (server.isRtpEnable() && userSetting.getSsrcRandom()) {
|
||||
continue;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("[SSRC重建] 查询媒体节点 {} 失败: {}", server.getId(), e.getMessage());
|
||||
}
|
||||
usedMap.put(server.getId(), bits);
|
||||
if (count > 8000) {
|
||||
log.info("[SSRC重建] 媒体节点 {} 的SSRC使用率已超过80%,请注意扩展服务提升性能", server.getId());
|
||||
}
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("[SSRC重建] 节点 {} 已占用 {} 个SSRC", server.getId(), count);
|
||||
synchronized (lockMap.computeIfAbsent(server.getId(), k -> new Object())) {
|
||||
BitSet bits = new BitSet(10000);
|
||||
int count = 0;
|
||||
try {
|
||||
ZLMResult<?> result = zlmresTfulUtils.getMediaList(server, null, null, "rtsp", null);
|
||||
if (result != null && result.getCode() == 0 && result.getData() != null) {
|
||||
List<JSONObject> list = (List<JSONObject>) result.getData();
|
||||
for (JSONObject obj : list) {
|
||||
if (obj.getIntValue("originType") != 3) continue;
|
||||
String originUrl = obj.getString("originUrl");
|
||||
if (originUrl == null) continue;
|
||||
int idx = originUrl.lastIndexOf("/rtp/");
|
||||
if (idx == -1) continue;
|
||||
try {
|
||||
int suffix = (int) (Long.parseLong(originUrl.substring(idx + 5), 16) % 10000);
|
||||
bits.set(suffix);
|
||||
count++;
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
}
|
||||
usedMap.put(server.getId(), bits);
|
||||
if (count > 8000) {
|
||||
log.info("[SSRC重建] 媒体节点 {} 的SSRC使用率已超过80%,请注意扩展服务提升性能", server.getId());
|
||||
}
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("[SSRC重建] 节点 {} 已占用 {} 个SSRC", server.getId(), count);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("[SSRC重建] 查询媒体节点 {} 失败: {}", server.getId(), e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}catch (Exception e) {
|
||||
log.warn("[SSRC重建] 处理媒体节点 {} 失败: {}", server.getId(), e.getMessage());
|
||||
}
|
||||
}
|
||||
}catch (Exception e) {
|
||||
log.error("[SSRC] 重建SSRC失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,6 +206,21 @@ public class SipUtils {
|
||||
|
||||
public static Gb28181Sdp parseSDP(String sdpStr) throws SdpParseException {
|
||||
|
||||
// 校验:拦截空内容与注入攻击特征
|
||||
if (sdpStr == null || sdpStr.trim().isEmpty()) {
|
||||
throw new SdpParseException(0, 0, "SDP内容为空");
|
||||
}
|
||||
// 标准SDP每行格式固定为 "x=value",不存在SQL关键字;出现则视为注入攻击
|
||||
String sdpUpper = sdpStr.toUpperCase();
|
||||
if (sdpUpper.contains("' OR '") || sdpUpper.contains("' OR 1") || sdpUpper.contains(" OR 1=1")
|
||||
|| sdpUpper.contains("--") || sdpUpper.contains("/*") || sdpUpper.contains("*/")
|
||||
|| sdpUpper.contains("DROP ") || sdpUpper.contains("INSERT ") || sdpUpper.contains("UPDATE ")
|
||||
|| sdpUpper.contains("DELETE ") || sdpUpper.contains("UNION ") || sdpUpper.contains("SELECT ")) {
|
||||
log.error("[SDP注入攻击] 检测到非法SDP内容,已拒绝解析,内容长度: {}", sdpStr.length());
|
||||
throw new SdpParseException(0, 0, "非法SDP内容");
|
||||
}
|
||||
//校验结束
|
||||
|
||||
// jainSip不支持y= f=字段, 移除以解析。
|
||||
int ssrcIndex = sdpStr.indexOf("y=");
|
||||
int mediaDescriptionIndex = sdpStr.indexOf("f=");
|
||||
|
||||
@ -148,10 +148,17 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
planArray: function(array) {
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
this.weekData[i].data = array[i].data
|
||||
}
|
||||
planArray: {
|
||||
handler(array) {
|
||||
if (!array || !array.length) {
|
||||
return
|
||||
}
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
this.weekData[i].data = array[i].data
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user