parent
dc2acc7284
commit
5c9ec8a98b
|
|
@ -28,12 +28,10 @@ String makecode(String pstr, List pkey) {
|
|||
|
||||
// 解密
|
||||
String cutecode(List<int> pstr) {
|
||||
print(pstr);
|
||||
int len = pstr.length;
|
||||
for (int i = 0; i < len; i++) {
|
||||
pstr[i] = cutcodeChar(String.fromCharCode(pstr[i])
|
||||
, skey[i % 5], skey[(i + 18) % 5]).codeUnitAt(0);
|
||||
}
|
||||
print(pstr);
|
||||
return String.fromCharCodes(pstr);
|
||||
}
|
||||
|
|
@ -2,6 +2,8 @@ import 'dart:async';
|
|||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
import 'package:web_synchronization_tool/windows/synchronization_web_tool.dart';
|
||||
|
||||
import 'little_extension.dart';
|
||||
import 'code.dart';
|
||||
|
||||
|
|
@ -30,8 +32,7 @@ class Socket {
|
|||
int ic = 1;
|
||||
|
||||
connect() async {
|
||||
socket = await RawDatagramSocket.bind('127.0.0.3', 1);
|
||||
print('UDP Socket bound to ${socket?.address.address}:${socket?.port}');
|
||||
socket = await RawDatagramSocket.bind('127.0.0.1', 25501);
|
||||
|
||||
// 发送身份包
|
||||
Map data = {
|
||||
|
|
@ -44,11 +45,25 @@ class Socket {
|
|||
socket?.listen((RawSocketEvent e) {
|
||||
Datagram? d = socket?.receive();
|
||||
if (d == null) return;
|
||||
print(d.data.toList());
|
||||
// String message = String.fromCharCodes(d.data).trim();
|
||||
|
||||
Map data = dataCute(d.data);
|
||||
|
||||
// 收到消息
|
||||
if (data['op'] == 2){
|
||||
|
||||
print(data);
|
||||
|
||||
Map click = data['value']['click'];
|
||||
int x = click['x'] as int;
|
||||
int y = click['y'] as int;
|
||||
|
||||
SynchronizationWebTool.getInstance().clickSynchronization(x, y);
|
||||
|
||||
}
|
||||
// 心跳
|
||||
if (data['op'] == 11){
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
|
@ -103,10 +118,7 @@ class Socket {
|
|||
|
||||
Uint8List pData = data.sublist(4,data.length);
|
||||
|
||||
// String ps = String.fromCharCodes(pData);
|
||||
|
||||
String str = cutecode(pData);
|
||||
print(str);
|
||||
|
||||
Map map = json.decode(str);
|
||||
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@ class SynchronizationWebTool{
|
|||
|
||||
if (event['click'] != null) {
|
||||
Map click = event['click'];
|
||||
double x = (click['x'] as int).toDouble();
|
||||
double y = (click['y'] as int).toDouble();
|
||||
int x = click['x'] as int;
|
||||
int y = click['y'] as int;
|
||||
|
||||
clickSynchronization(x, y);
|
||||
SocketUtils.getInstance().sendMessage(event);
|
||||
|
|
@ -72,7 +72,7 @@ class SynchronizationWebTool{
|
|||
}
|
||||
|
||||
/// 点击同步
|
||||
clickSynchronization(double x,double y){
|
||||
clickSynchronization(int x,int y){
|
||||
for (var controller in childController) {
|
||||
controller.executeScript(WindowsJs.clickJs(x, y));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ document.addEventListener("click", function (event) {
|
|||
}
|
||||
|
||||
/// 模拟点击
|
||||
static String clickJs(double x, double y) {
|
||||
static String clickJs(int x, int y) {
|
||||
return 'document.elementFromPoint($x, $y).click();';
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue