Jump to content

ControlSend is messing up textual casing Aa _- "2 in a telnet window


Morthawt
 Share

Recommended Posts

DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1)
$hTelnet = Run('c:\windows\system32\telnet.exe 127.0.0.1 10011', '', @SW_SHOW)
DllCall("kernel32.dll", "int", "Wow64EnableWow64FsRedirection", "int", 1)
Sleep(2000)
ControlSend('Telnet 127.0.0.1', '', '', 'use port=9987' & @CRLF, 1)
Sleep(2000)
ControlSend('Telnet 127.0.0.1', '', '', 'clientupdate client_nickname="Tester' & Random(1, 1234567, 1) & '"' & @CRLF, 1)
Sleep(2000)
ControlSend('Telnet 127.0.0.1', '', '', 'whoami' & @CRLF, 1)
Sleep(3000)
ProcessClose($hTelnet)
Exit 

Updated at the bottom to reflect my more rounded down issue. It isn't that telnet is not sending more than 1 command it is sending all commands but messing up case, which is why the first command was fine because everything was lowercase.

Here is the background on what I am trying to do. If you download the free TeamSpeak 3  server and connect to it with a client you can make a bookmark to 127.0.0.1 and show query clients. Once connected  via the bookmark you can then telnet to port 10011 and type commands.

Once the initial telnet connection is established I set it to communicate with the correct virtualserver port which is 9987 by default. Then I try and do something simple such as change the name it appears as in the list when you are viewing query clients.

The problem? Running the compiled exe via a scheduled task, for some reason it only types the initial command to connect to the virtual server port running on 9987 but it will not type any further commands, as you would see if you did this test the username is your own local IP address rather than the name of "Tester 902"

The script works fine when executed manually yet only gets to perform 1 telnet command and then fails for all others?

Anyone have any ideas on this? I need it to be hidden yet still type the needed commands. I do not get into way over the top complicated things like manually doing network connections, sending and receiving network commands via autoit or convoluted winAPI things yet I don't want a simple "keep it on the screen, block inputs while I click and type" because then you have to stop what you are doing when it happens. Ideally I would like to use a tweaked/fixed version of this script. While I am open to other possibilities to perform these actions I only use something if I fully understand what ever it is in it's entirety. I never use external user defined functions if I do not understand parts of it because if it were to ever break down with a new version of autoit and the UDF was unsupported I couldn't fix it myself. So I am just trying to automate telnet since telnet does all the connection things that I need and so should be able to just automate that to get the job done via a scheduled task, hidden off screen. I tried to use STDIN for a command line alternative to telnet called Plink but I can never actually even manually type into the box once it connects, let alone automate typing in the box. So it seems standard Telnet is my best bet.

Additional information before submitting:

I have done some testing and updated the script. The issue is it seems focus of other windows while it is sending direct to the correct control is leading it to be missing the {SHIFT} aspects of the string to be sent to the control. I say "Tester" and it says 2tester2 or Something_Here and it sends instead something-here

Any ideas? I think this may be a legitimate bug since it is sending strings, it just many times due to lack of focus loses the uppercase characters and thus is sending lowercase whether letters or symbols. You know what I mean.

Edit:

I have tried compiling as both 86 and 64 format and it doesn't change the fact that running normally, manually and clicking off the window at varying levels of speed upon telnet loading causes the case to be lost, thus making incorrect symbols and text casing. Also the problem exists every time when running the compiled script as a scheduled task.

Edited by Morthawt
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...