1 接收 点击事件

2 加密 和 解密
This commit is contained in:
WoNiu 2024-04-03 18:27:31 +08:00
parent dc2acc7284
commit 5c9ec8a98b
4 changed files with 23 additions and 13 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -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));
}

View File

@ -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();';
}