简体   繁体   English

使用Webbrowser从C#向套接字发送命令

[英]Sending commands to socket from C# with webbrowser

I'm creating a bot, where i would load this site and open the browser game i the webbrowser in C# to load the page, and then it loads the java applet. 我正在创建一个机器人,在该机器人中我将加载该站点并在C#中打开Web浏览器中的浏览器游戏以加载页面,然后加载Java小程序。 Since the game is partwise based on this java applet and is (through java applet) connected to a socket where it sends the commands. 由于游戏部分基于此Java小程序,并且(通过Java小程序)已连接到套接字,该套接字在其中发送命令。 My question is then, how do i "hook" this socket and send commands ? 我的问题是,我如何“钩住”此套接字并发送命令? - I know the commands cause i decompiled the java applet, i just don't know the approach of "hooking" the socket -我知道命令会导致我反编译Java小程序,我只是不知道“钩住”套接字的方法

If I'm understanding your question right, it sounds like you have a java applet that is connecting to an IP address somewhere on the Internet and communicating with a server at that IP address through a socket. 如果我正确理解您的问题,听起来您有一个Java小程序,该小程序正在连接到Internet上某个IP地址,并通过套接字与该IP地址处的服务器通信。

If this is the case, you can't hook into the socket per se. 在这种情况下,您本身就无法插入插槽。 What you can do is use a network sniffer such as Wireshark to find out what the IP Address or server name is that its communicating with. 您可以做的是使用网络嗅探器(例如Wireshark)来查找与其通信的IP地址或服务器名称。 Then you can edit your Hosts file and point the IP Address that the applet is using to point to 127.0.0.1, which is your local machine. 然后,您可以编辑您的Hosts文件,并指向该applet用来指向本地计算机127.0.0.1的IP地址。

After doing that, you can make a TCP/IP Server that runs on your local machine and you can have it do whatever you need. 完成此操作后,您可以使TCP / IP服务器在本地计算机上运行,​​并且可以执行所需的任何操作。 Look here for an example on how to make a TCP/IP server in C#. 在此处查看有关如何使用C#制作TCP / IP服务器的示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM