diff --git a/assets/script/http_server.py b/assets/script/http_server.py new file mode 100644 index 0000000..db6ae4f --- /dev/null +++ b/assets/script/http_server.py @@ -0,0 +1,97 @@ +from http.server import ThreadingHTTPServer, BaseHTTPRequestHandler +from urllib.parse import urlparse, parse_qs +from signal import signal, SIGINT +from sys import exit +from json import loads, dumps +from argparse import ArgumentParser + +class HttpHandler(BaseHTTPRequestHandler): + protocol_version = 'HTTP/1.1' + error_content_type = 'text/plain' + error_message_format = "Error %(code)d: %(message)s" + + def do_GET(self): + path, args = self.parse_url() + + if path == '/hello' and 'name' in args: + name = args['name'][0] + + self.write_response(200, "text/plain", f"Hello, {name}!") + else: + self.send_error(404, 'Not found') + + def do_POST(self): + path, _ = self.parse_url() + body = self.read_body() + + if path == '/echo' and body and self.headers['Content-Type'] == "application/json": + json_body = self.parse_json(body) + + if json_body: + self.write_response(202, "application/json", + dumps({"message": "Accepted", "request": json_body}, indent=2)) + else: + self.send_error(400, 'Invalid json received') + elif path == '/echo' and body: + self.write_response(202, "text/plain", f"Accepted: {body}") + else: + self.send_error(404, 'Not found') + + def parse_url(self): + url_components = urlparse(self.path) + return url_components.path, parse_qs(url_components.query) + + def parse_json(self, content): + try: + return loads(content) + except Exception: + return None + + def read_body(self): + try: + content_length = int(self.headers['Content-Length']) + return self.rfile.read(content_length).decode('utf-8') + except Exception: + return None + + def write_response(self, status_code, content_type, content): + response = content.encode('utf-8') + + self.send_response(status_code) + self.send_header("Content-Type", content_type) + self.send_header("Content-Length", str(len(response))) + self.end_headers() + self.wfile.write(response) + + def version_string(self): + return "Tiny Http Server" + + def log_error(self, format, *args): + pass + + +def start_server(host, port): + server_address = (host, port) + httpd = ThreadingHTTPServer(server_address, HttpHandler) + print(f"Server started on {host}:{port}") + httpd.serve_forever() + + +def shutdown_handler(signum, frame): + print('Shutting down server') + exit(0) + + +def main(): + signal(SIGINT, shutdown_handler) + parser = ArgumentParser(description='Start a tiny HTTP/1.1 server') + parser.add_argument('--host', type=str, action='store', + default='127.0.0.1', help='Server host (default: 127.0.0.1)') + parser.add_argument('--port', type=int, action='store', + default=8000, help='Server port (default: 8000)') + args = parser.parse_args() + start_server(args.host, args.port) + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/assets/script/tcp_client.py b/assets/script/tcp_client.py new file mode 100644 index 0000000..30ba957 --- /dev/null +++ b/assets/script/tcp_client.py @@ -0,0 +1,19 @@ +#coding:utf-8 +import sys +from socket import * +serverHost = 'localhost' +serverPort = 6000 +#发送至服务端的默认文本 +message = ['Hello network world'] +#建立一个tcp/ip套接字对象 +sockobj = socket(AF_INET, SOCK_STREAM) +#连接至服务器及端口 +sockobj.connect((serverHost, serverPort)) +for line in message: + #经过套按字发送line至服务端 + sockobj.send(line.encode()) + #从服务端接收到的数据,上限为1k + data = sockobj.recv(1024) + print('Client received:', repr(data)) +#关闭套接字 +sockobj.close( ) \ No newline at end of file diff --git a/assets/script/tcp_server.py b/assets/script/tcp_server.py new file mode 100644 index 0000000..dc24671 --- /dev/null +++ b/assets/script/tcp_server.py @@ -0,0 +1,27 @@ +#coding:utf-8 +from socket import * +#''代表服务器为 localhost +myHost = '' +#在一个非保留端口号上进行监听 +myPort = 6000 +#设置一个TCP socket对象 +sockobj = socket(AF_INET, SOCK_STREAM) +#绑定端口号 +sockobj.bind((myHost, myPort)) +#监听,允许5个连结 +sockobj.listen(5) +#直到进程结束时才结束循环 +while True: + #等待客户端连接 + connection, address = sockobj.accept( ) + #连接是一个新的socket + print('Server connected by', address) + while True: + #读取客户端套接字的下一行 + data = connection.recv(1024) + #如果没有数量的话,那么跳出循环 + if not data: break + #发送一个回复至客户端 + connection.send('Echo from server => '.encode() + data) + #当socket关闭时eof + connection.close( ) \ No newline at end of file diff --git a/assets/script/udp_client.py b/assets/script/udp_client.py new file mode 100644 index 0000000..22dd9e5 --- /dev/null +++ b/assets/script/udp_client.py @@ -0,0 +1,16 @@ +import socket + +s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) +addr = ("127.0.0.1", 6000) + + +s.sendto('hello server!'.encode(), addr) + +while True: + response, addr = s.recvfrom(1024) + print(response.decode()) + if response.decode() == "exit": + print("Session is over from the server %s:%s\n" % addr) + break + +s.close() \ No newline at end of file diff --git a/assets/script/udp_send.py b/assets/script/udp_send.py new file mode 100644 index 0000000..f405a2e --- /dev/null +++ b/assets/script/udp_send.py @@ -0,0 +1,13 @@ +import socket +import time + +s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) +addr = ("127.0.0.1", 6000) + + + +while True: + s.sendto('hello server!'.encode(), addr) + time.sleep(1) + +s.close() \ No newline at end of file diff --git a/assets/script/udp_server.py b/assets/script/udp_server.py new file mode 100644 index 0000000..2765bb9 --- /dev/null +++ b/assets/script/udp_server.py @@ -0,0 +1,13 @@ +import socket + +s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) +s.bind(("127.0.0.1", 6001)) +print("UDP bound on port 6001...") + +while True: + data, addr = s.recvfrom(1024) + print("Receive from ", addr, data) + if data == b"exit": + s.sendto(b"Good bye!\n", addr) + continue + s.sendto(b"Hello client, i'm a boy!" , addr) diff --git a/keyboard/ListenKeyboard.simple b/keyboard/ListenKeyboard.simple index 318812d..e6e0285 100644 Binary files a/keyboard/ListenKeyboard.simple and b/keyboard/ListenKeyboard.simple differ diff --git a/media/CaptureActiveWindow.simple b/media/CaptureActiveWindow.simple new file mode 100644 index 0000000..e6fbe81 Binary files /dev/null and b/media/CaptureActiveWindow.simple differ diff --git a/media/CaptureFullScreen.simple b/media/CaptureFullScreen.simple index 37e0698..f3ea551 100644 Binary files a/media/CaptureFullScreen.simple and b/media/CaptureFullScreen.simple differ diff --git a/media/CaptureWindow.simple b/media/CaptureWindow.simple index 4ab4ace..b57a2e2 100644 Binary files a/media/CaptureWindow.simple and b/media/CaptureWindow.simple differ diff --git a/media/MediaPlay.simple b/media/MediaPlay.simple index 6d68a3c..69b8b3c 100644 Binary files a/media/MediaPlay.simple and b/media/MediaPlay.simple differ diff --git a/media/PixelPoint.simple b/media/PixelPoint.simple new file mode 100644 index 0000000..3837f22 Binary files /dev/null and b/media/PixelPoint.simple differ diff --git a/media/PlayRecord.simple b/media/PlayRecord.simple index 84e900d..9d55cd0 100644 Binary files a/media/PlayRecord.simple and b/media/PlayRecord.simple differ diff --git a/media/VideoFrame.simple b/media/VideoFrame.simple index 711d808..3901dfa 100644 Binary files a/media/VideoFrame.simple and b/media/VideoFrame.simple differ diff --git a/network/HttpDownload.simple b/network/HttpDownload.simple index 6a6644e..d43ef98 100644 Binary files a/network/HttpDownload.simple and b/network/HttpDownload.simple differ diff --git a/network/HttpGet.simple b/network/HttpGet.simple index e556b8f..beee440 100644 Binary files a/network/HttpGet.simple and b/network/HttpGet.simple differ diff --git a/network/HttpHead.simple b/network/HttpHead.simple index d0edbd5..2879372 100644 Binary files a/network/HttpHead.simple and b/network/HttpHead.simple differ diff --git a/network/HttpPost.simple b/network/HttpPost.simple index 80387c3..341ddad 100644 Binary files a/network/HttpPost.simple and b/network/HttpPost.simple differ diff --git a/network/Tcp.simple b/network/Tcp.simple index cbd54c2..93c9733 100644 Binary files a/network/Tcp.simple and b/network/Tcp.simple differ diff --git a/network/Udp.simple b/network/Udp.simple index 52ebbd2..92a7239 100644 Binary files a/network/Udp.simple and b/network/Udp.simple differ diff --git a/network/YoutubeDownload.simple b/network/YoutubeDownload.simple index c9b4738..6e16c53 100644 Binary files a/network/YoutubeDownload.simple and b/network/YoutubeDownload.simple differ diff --git a/pandas/IndexLoc.simple b/pandas/IndexLoc.simple new file mode 100644 index 0000000..c81dbd6 Binary files /dev/null and b/pandas/IndexLoc.simple differ diff --git a/pandas/IterRow.simple b/pandas/IterRow.simple new file mode 100644 index 0000000..ef54702 Binary files /dev/null and b/pandas/IterRow.simple differ diff --git a/pandas/LoadDocument.simple b/pandas/LoadDocument.simple new file mode 100644 index 0000000..eb6391a Binary files /dev/null and b/pandas/LoadDocument.simple differ diff --git a/pandas/NameLoc.simple b/pandas/NameLoc.simple new file mode 100644 index 0000000..5f39b68 Binary files /dev/null and b/pandas/NameLoc.simple differ diff --git a/web/action.simple b/web/action.simple new file mode 100644 index 0000000..e1c5101 Binary files /dev/null and b/web/action.simple differ diff --git a/web/action_click_release.simple b/web/action_click_release.simple new file mode 100644 index 0000000..106b514 Binary files /dev/null and b/web/action_click_release.simple differ diff --git a/web/action_clickhold.simple b/web/action_clickhold.simple new file mode 100644 index 0000000..5767c14 Binary files /dev/null and b/web/action_clickhold.simple differ diff --git a/web/action_doubleclick.simple b/web/action_doubleclick.simple new file mode 100644 index 0000000..8b206b0 Binary files /dev/null and b/web/action_doubleclick.simple differ diff --git a/web/action_drag.simple b/web/action_drag.simple new file mode 100644 index 0000000..0b717fb Binary files /dev/null and b/web/action_drag.simple differ diff --git a/web/action_press.simple b/web/action_press.simple new file mode 100644 index 0000000..4129e04 Binary files /dev/null and b/web/action_press.simple differ diff --git a/web/action_sendtxt.simple b/web/action_sendtxt.simple new file mode 100644 index 0000000..a7234a0 Binary files /dev/null and b/web/action_sendtxt.simple differ diff --git a/web/attr.simple b/web/attr.simple new file mode 100644 index 0000000..06c9fd5 Binary files /dev/null and b/web/attr.simple differ diff --git a/web/clear.simple b/web/clear.simple new file mode 100644 index 0000000..4dcbe05 Binary files /dev/null and b/web/clear.simple differ diff --git a/web/click.simple b/web/click.simple index 8749914..a249fdd 100644 Binary files a/web/click.simple and b/web/click.simple differ diff --git a/web/cookies.simple b/web/cookies.simple new file mode 100644 index 0000000..870be50 Binary files /dev/null and b/web/cookies.simple differ diff --git a/web/download.simple b/web/download.simple index e9916a1..eb86920 100644 Binary files a/web/download.simple and b/web/download.simple differ diff --git a/web/input.simple b/web/input.simple deleted file mode 100644 index 6e6ce7b..0000000 Binary files a/web/input.simple and /dev/null differ diff --git a/web/interact_element.simple b/web/interact_element.simple deleted file mode 100644 index 938cd38..0000000 Binary files a/web/interact_element.simple and /dev/null differ diff --git a/web/is_selected.simple b/web/is_selected.simple new file mode 100644 index 0000000..b33472e Binary files /dev/null and b/web/is_selected.simple differ diff --git a/web/open_chrome.simple b/web/open_chrome.simple deleted file mode 100644 index d70d150..0000000 Binary files a/web/open_chrome.simple and /dev/null differ diff --git a/web/openurl.simple b/web/openurl.simple index 1bb8c5b..6ae5d11 100644 Binary files a/web/openurl.simple and b/web/openurl.simple differ diff --git a/web/presence.simple b/web/presence.simple new file mode 100644 index 0000000..76561d3 Binary files /dev/null and b/web/presence.simple differ diff --git a/web/screenshot.simple b/web/screenshot.simple new file mode 100644 index 0000000..247f4a0 Binary files /dev/null and b/web/screenshot.simple differ diff --git a/web/sendkey.simple b/web/sendkey.simple new file mode 100644 index 0000000..05c6419 Binary files /dev/null and b/web/sendkey.simple differ diff --git a/web/submit.simple b/web/submit.simple new file mode 100644 index 0000000..5063201 Binary files /dev/null and b/web/submit.simple differ diff --git a/web/switch_frame.simple b/web/switch_frame.simple new file mode 100644 index 0000000..55bb903 Binary files /dev/null and b/web/switch_frame.simple differ diff --git a/web/waiit_alert.simple b/web/waiit_alert.simple new file mode 100644 index 0000000..d37fcc6 Binary files /dev/null and b/web/waiit_alert.simple differ diff --git a/web/waiit_clickable.simple b/web/waiit_clickable.simple new file mode 100644 index 0000000..94e1e08 Binary files /dev/null and b/web/waiit_clickable.simple differ diff --git a/web/waiit_iframe.simple b/web/waiit_iframe.simple new file mode 100644 index 0000000..bfecfa4 Binary files /dev/null and b/web/waiit_iframe.simple differ diff --git a/web/wait_title.simple b/web/wait_title.simple new file mode 100644 index 0000000..ec65ac7 Binary files /dev/null and b/web/wait_title.simple differ diff --git a/web/wait_visible.simple b/web/wait_visible.simple new file mode 100644 index 0000000..0ccf366 Binary files /dev/null and b/web/wait_visible.simple differ diff --git a/web/wait_visible_loc.simple b/web/wait_visible_loc.simple new file mode 100644 index 0000000..209eeb5 Binary files /dev/null and b/web/wait_visible_loc.simple differ diff --git a/window/EnumWindows.simple b/window/EnumWindows.simple index 7a2faf3..ef946cd 100644 Binary files a/window/EnumWindows.simple and b/window/EnumWindows.simple differ