Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I add a new way to move? Like kmbox net? #267

Open
Livia-Aic opened this issue Jan 29, 2025 · 1 comment
Open

How do I add a new way to move? Like kmbox net? #267

Livia-Aic opened this issue Jan 29, 2025 · 1 comment

Comments

@Livia-Aic
Copy link

Its API is here.
https://www.kmbox.top/wiki_doc/kmboxNet/site/python/#move-enc_move

init initialization
The init function requires three string parameters, in order:
ip: the IP address of the box (it will be displayed on the display, for example: 192.168.2.88) port: the communication port number (it will be displayed on the display, for example: 6234) mac: The MAC address of the box (it will be displayed on the display screen, for example: 12345) Return value: 0 is normal, non-zero value, please see the error code

The function must be called once. Otherwise, it is not possible to communicate with the box. Before calling, please ensure that the box network is unobstructed. And can ping through the box.

Mouse class control functions
move | enc_move control mouse movements
Mouse movement x,y units. One-time move. Trajectory-free simulation for the fastest speed. Use this function when writing your own trajectory movements. Return value: 0 is executed normally, other values are abnormal

enc_move usage is the same as move. You cannot use the packet capture tool to reverse characteristic packets. Safer.

left | enc_left controls the left mouse button
Left mouse button control isdown: 0 release, 1 press return value: 0 is executed normally, other values are abnormal.

kmNet.left(1)#鼠标左键按下
kmNet.left(0)#鼠标左键松开
enc_left usage differs from left. in that packets are encrypted. You cannot use the packet capture tool to reverse characteristic packets. Safer.

right | enc_right control the right mouse button
The right mouse button controls isdown: 0 to release, 1 press to return value: 0 is executed normally, and other values are abnormal.

kmNet.right(1)#鼠标右键按下
kmNet.right(0)#鼠标右键松开
enc_right usage is the same as right. The difference is that the packets are encrypted. You cannot use the packet capture tool to reverse characteristic packets. Safer.

middle | enc_middle controls the middle mouse button
The middle mouse button controls isdown: 0 to release, 1 press to return value: 0 is executed normally, and other values are abnormal.

kmNet.middle(1)#鼠标中键按下
kmNet.middle(0)#鼠标中键松开
enc_middle usage is the same as middle. You cannot use the packet capture tool to reverse characteristic packets. Safer.

wheel | enc_wheel control the mouse wheel
Mouse wheel control, move down with greater than 0, move up with less than 0

kmNet.wheel(1) #鼠标滚轮下移
kmNet.wheel(-1)#鼠标滚轮上移
enc_wheel usage is the same as wheel. You cannot use the packet capture tool to reverse characteristic packets. Safer.

mouse | enc_mouse control all the parameters of the mouse
This function requires four parameters:

  1. Mouse button control. int type. Each bit represents a keystroke.

  2. Mouse x parameter, int type. Value range: [-32768,32768]

  3. Mouse y parameter, int type. Value range: [-32768,32768]

  4. Mouse wheel parameters, int type. Value range: -128,128

kmNet.mouse(1,10,20,3) #鼠标左键按下,x=10,y=20,wheel=3
kmNet.mouse(0,-10,-20,-3) #鼠标左键松开,x=-10,y=-20,wheel=-3
move_auto | enc_move_auto simulates movement
Mouse movement x,y units. Simulate artificial movement of x,y units. This function is recommended for those who do not write a movement curve. This function does not jump and approaches the target point in the smallest steps. It takes more time than move. ms is how many milliseconds it takes to set the move. Note that the value given by ms should not be too small, and if it is too small, it will be recognized as a machine mouse. Try to operate like a human. The actual time will be less than ms.

#移动到100, 200 coordinates, specifying the time taken 300ms
kmNet.move_auto(100,200,300)
move_beizer | enc_move_beizer second-order Bezier curves
Second-order Bezier curve control, this function requires 7 parameters. In order: x,y: target point coordinates ms: time taken to fit this process (unit: ms) x1, y1: control point P1 point coordinates x2, Y2 : control point P2 point coordinates

#移动到100,200 coordinates, 300 ms time to specify, control point 1 coordinates (-50, -60), control point 2 coordinates (70, 80)
kmNet.move_beizer(100,200,300,-50,-60,70,80)
Keyboard class control functions
keydown | enc_keydown controls keyboard key presses
Used to control keyboard key presses. Usually used in conjunction with keyup, the input parameter is the keyboard key value. Please refer to the appendix for all key values

Keyboard class control functions
keydown | enc_keydown controls keyboard key presses
Used to control keyboard key presses. Usually used in conjunction with keyup, the input parameter is the keyboard key value. Please refer to the appendix for all key values

For example, to keep the keyboard A key pressed:

kmNet.keydown(4) #保持键盘a键按下
keyup | enc_keyup control keyboard keys to release
Used to control the release of keyboard keys. It is usually used in conjunction with keydown, and the input parameter is the keyboard key value. Please refer to the appendix for all key values

For example, to pop up the A key on the keyboard:

kmNet.keyup(4) #键盘a键松开
Monitoring class functions
kmbox Net supports monitoring the keyboard and mouse status on the box. It can be used to understand the real state of the physical keyboard and mouse.

monitor enables or disables physical keyboard and mouse monitoring
Before you can use the monitoring function, you need to call the monitor function once. Turn on the monitoring feature. The parameter is the monitored port number.

If you don't need a monitoring feature. You can turn off the parameter 0. The port number can range from 1024 to 49151. Be careful not to conflict with the port number of the system.

kmNet.monitor(8888) #开启物理键鼠监控功能. Use port number 8888 to receive physical keyboard and mouse data
kmNet.monitor(0) #关闭物理键鼠监控功能
isdown_left check whether the left mouse button is pressed
After the monitoring function is enabled, you can use this function to obtain the status of the physical left mouse button on the receiving box.

Return value:

0: Physical mouse release

1: Physical mouse press

import time
kmNet.monitor(8888) # Enable physical keyboard and mouse monitoring. Use port number 8888 to receive physical keyboard and mouse data
while 1:
print('mouse left ',kmNet.isdown_left())
time.sleep(0.5)
The output is as follows: Left press is 1, release is 0

mouse left 0 mouse left 0 mouse left 1 mouse left 1 mouse left 1

isdown_middle check whether the middle mouse button is pressed
After the monitoring function is enabled, you can use this function to obtain the status of the physical middle mouse button on the receiving box.

Return value:

0: Physical mouse release

1: Physical mouse press

import time
kmNet.monitor(8888) # Enable physical keyboard and mouse monitoring. Use port number 8888 to receive physical keyboard and mouse data
while 1:
print('mouse middle',kmNet.isdown_middle())
time.sleep(0.5)
The output is as follows: 1 for middle press and 0 for release

mouse middle 0 mouse middle 1

@NANOBYTECOMPUTERS
Copy link
Contributor

reverse engineer arduino method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants