随记

......

  1. request /actuator/bus-refresh

  2. BusRefreshEndpoint received request

  3. ApplicationEventPublisher.publish(RemoteApplicationEvent)

  4. BusAutoConfiguration#

@EventListener(classes = RemoteApplicationEvent.class)
public void acceptLocal(RemoteApplicationEvent event) {
if (this.serviceMatcher.isFromSelf(event)
&& !(event instanceof AckRemoteApplicationEvent)) {
if (log.isDebugEnabled()) {
log.debug("Sending remote event on bus: " + event);
}
this.cloudBusOutboundChannel.send(MessageBuilder.withPayload(event).build());
}
}

$?表示上个命令执行的结果值,0表示上个命令执行成功,非0表示上个命令执行失败

$$当前shell的进程ID

$_ 上个命令的最后一个参数

$! 为最近一个后台执行的异步命令的进程 ID

$0 为当前 Shell 的名称(在命令行直接执行时)或者脚本名(在脚本中执行时)

$- 为当前 Shell 的启动参数。

$@$#表示脚本的参数数量

step 1

  1. 魔法上网

  2. 注册区域随便选择

  3. 过了谷歌验证

  4. 邮箱确认注册

step 2

  1. 魔法上网(节点是你想注册到哪个地区的节点(eg:russia)),需要全局proxy

  2. 输入用户名密码

  3. 提交

  4. 上述步骤没出现问题的话,应该注册成功且自动跳转到steam首页了。

  5. 点击右上角账户明细,网页加载成功后 国家/地区 应该就是魔法上网选择的节点区域

Lock

https://tool.4xseo.com/a/24067.html

锁分类:

对数据操作的粒度分

  1. 表锁:操作时,会锁定整个表
  2. 行锁:操作时,会锁定当前行
  3. 间隙锁:操作时,锁定范围条件内的记录

对数据的操作类型分

  1. 读锁(共享锁):针对同一份数据,多个读操作可以同时进行不会互相影响

  2. 写锁(排他锁,也叫独占锁):当前操作没有完成之前,会阻塞其他写锁或读锁

在开启事务的且自动提交为关闭的状态下`

select for updateupdate 会创建 排他锁,
如果带有索引查询,则会加行锁,如果查询整个表,则会加间隙锁

lock table

session 1

lock table my_table read;

select * from my_table;
unlock tables;

sessoin 2

select * from my_table;

update my_table set id = 1; -- will blocked until session 1 unlock tables

lock record

session 1

-- session  a
set autocommit = 0;
begin;
select TRX_ID from information_schema.INNODB_TRX where trx_mysql_thread_id = CONNECTION_ID();
select * from stu_teacher where teacher_id = 1 for update;
select TRX_ID from information_schema.INNODB_TRX where trx_mysql_thread_id = CONNECTION_ID();
COMMIT;

session 2

set @@autocommit=0; 
SHOW VARIABLES LIKE 'autocommit';
BEGIN;
select * from stu_teacher where teacher_id = 1 for update;
update stu_teacher set teacher_name = 'test112' where teacher_id = 1;
COMMIT;

session 1 先执行的话 session 2的查询for update 更新会被锁住

Tx

steps


set autocommit = 0;

start transaction -- or begin;

update something set id = 1;

commit;

ISOLATION

READ_UNCOMMITED

READ_COMMITED

REPEATABLE-READ 可重复读,但会幻读(读取到新加入的行)

READ_PHANTOM

serialization

LOCK

EntryPoint


HttpRequestHandler
|
/----------\
/ \
/ \
WebSocketHttpRequestHandler SockJsHttpRequestHandler(So,text message need json format,strictly is json array)
| |
SubProtocolWebSocketHandler SockJsWebSocketHandler
| |
| WebSocketServerSockJsSession -> handleMessage -> Jackson2SockJsMessageCodec -> decode
| |
StompSubProtocolHandler StompSubProtocolHandler

AliyunVodEncryption加密分析

阿里云点播API文档地址

GetVideoPlayAuth

GetPlayInfo

预定义伪代码

covert


/**
* @param hexStr 16进制字符串,长度为16
* 把16进制字符串利用base64编码,再解码,得到长度为16的字节数组
*
*/
function convert(hexStr){
return Base64.decode(Base64.encode(str));
}

AES

//AES加密,模式为CBC,填充方式:PKCS5Padding
function AES(){
this.encrypt(content,KEY,IV){
aes.encrypt(content,KEY,IV)
}
}

返回参数说明

PlayInfoList.PlayInfo[0]

{
"Status": "Normal",
"StreamType": "video",
"Rand": "NYspn8Qc220551gz62GCFGeOOU6WxF9nr9e8c64wDbE=", //存储第一段AES key
"Size": 1368828,
"Definition": "LD",
"Fps": "25",
"Duration": "10.0254",
"ModificationTime": "2021-05-11T08:04:11Z",
"Specification": "H264.SD",
"Bitrate": "1092.283",
"Encrypt": 1,//是否加密
"PreprocessStatus": "UnPreprocess",
"Format": "m3u8",
"EncryptType": "AliyunVoDEncryption",//阿里云的私有加密
"PlayURL": "https://vod.domain.com/play.m3u8",
"NarrowBandType": "0",
"Plaintext": "4pccpVV9LIjk9s0gZCFj4t6n85PPlwZuhrL2D4fbJJU=",//存储第二段AES key
"CreationTime": "2021-05-11T08:04:05Z",
"Height": 540,
"Width": 960,
"JobId": "a7a32209e6e3429f99128b25b34a8e40"
}

逻辑分析

假设视频文件的AES keyrealKey

浏览器生成一个随机串 r1 利用RSA公钥加密,结果为randStr

服务器接受到randStr,利用私钥解密出随机串 r1

r1利用MD5生成数字摘要,再截取(8,24)位的字符串 记为rs1

convert(rs1)得到第一段加密的IVKEY,记为KEY1,IV1

再生成一段随机字符串记为r2,利用AES.encrypt(r2,KEY1,IV1) 得到上面返回结果中的 Rand

拼接r1 + r2,利用MD5生成数字摘要,再截取(8,24)为的字符串,记为rs2

convert(rs2)得到第二段加密的KEY,记为KEY2

利用AES.encrypt(realKey,KEY2,IV1) 得到上面返回的结果Plaintext

至此,整个加密逻辑分析完毕

解密TS文件

MPEG-TS文件结构

用到的工具EasyICE,DVB Inspector,tsduck

ts-header(32byte)

字段名 位数 说明
sync_byte 4bit TS package 标识,固定值0x47
transport_error_indicator 1bit 传输错误标识
payload_unit_start_indicator 1bit PES包开始标识,可以用掩码0x40 判断
transport_priority 1bit 传输优先级
PID 13bit TS package identity 0x100:视频数据,0x101:音频数据, -1:id3Track,应该从PMT表中查找
transport_scrambling_control 2bit 是否有干扰码
adaptation_field_control 2bit 是否有扩展字段,0x01:payload only,0x02:adaptation field only,0x03:adaptation field follow payload
continuity_counter 4bit pack seq

var data = []
//当遇到`PUSI(Payload unit start indicator )`标识时,获取每个ts包的payload
data.push(payload)
//遇到下一个`pusi`标识时,
//合并data中的payload,作为一个PES单元
//解密PES数据段,再把解密后的payload回写到TSPacket

reference

AES五种加密模式

aliplayer-vod.js

aes-js

jsencrypt

https://gist.github.com/manyuanrong/39f151181a193b454c3b11dac1b60e15#file-jsencrypt-js

https://g.alicdn.com/de/prismplayer/2.9.0/hls/aliplayer-hls-min.js

https://stackoverflow.com/questions/28562894/how-to-loop-an-mpeg-ts-stream

https://github.com/fy-create/TSParser

只构建parent pom

cd your-project
mvn install -N

note:

-N,--non-recursive Do not recurse into sub-projects

构建多模块

     p
|
|
-----------
| |
a -----> b

````

mvn install -pl a -am -amd


note:

-pl, –projects
构建指定的模块,模块间用逗号分隔;适合无依赖的项目
-am, –also-make (常用)
同时构建所列模块的依赖模块,比如A依赖B,B依赖C,构建B,同时构建C
-amd, –also-make-dependents
同时构建依赖于所列模块的模块,比如A依赖B,B依赖C,构建B,同时构建A

```

reference

Maven 单独构建多模块项目中的子模块

Install parent POM without building Child modules

how it works

// create worker
new SharedWorkder("https://socialclub.rockstargames.com/Home/SocketWorker") //
// self.importScripts('https://s.rsg.sc/sc/js/20201212bfdb/build/socketWorker.js');

how to debug

  1. Type chrome://inspect/#workers in chrome location bar;

  2. You can find https://socialclub.rockstargames.com/Home/SocketWorker in the Shared workers

  3. Click inpect as you can debug like debug normal session;

conclusion

//https://www.right.com.cn/forum/thread-4052504-1-1.html
//https://www.jianshu.com/p/01262e314eab
//http://alisdk-api-doc.oss-cn-hangzhou.aliyuncs.com/player/5.1.6/android/index.html?com/aliyun/player/VidPlayerConfigGen.EncryptType.html

  1. hidden the network request detail;

  2. increase debugging difficulty;

0%