Jump to content
minamon

sendkeys shows after converting to exe telnet 192.168.1.1 -f 9.txt 'telnet' is not recognized as an internal or external command

Recommended Posts

minamon
Posted (edited)

i have converted a .au3 file to exe and i have a 64 bit windows when i chose compile for 64 bit system it works normally but when i un check  the  64 bit box .. it says telnet 192.168.1.1 -f 9.txt 'telnet' is not recognized as an internal or external command...

can i compile the .au3 to support 64 & 32 bit ...

 

errrror.PNG

Edited by minamon
improved it

Share this post


Link to post
Share on other sites
Subz
Posted (edited)

Try something like:

_RunCommand(@ComSpec & " /c telnet 192.168.1.1 -f 9.txt")

Func _RunCommand($_sCmdLine)
    If @OSArch = "x64" Then
        DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 1) ;~ Turns Off 64 Bit Redirection
            Run($_sCmdLine, "", @SW_HIDE)
        DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 0) ;~ Turns Off 64 Bit Redirection
    Else
        Run($_sCmdLine, "", @SW_HIDE)
    EndIf
EndFunc

 

Edited by Subz
  • Like 1

Share this post


Link to post
Share on other sites
minamon

Where can I add the other lines of my code like .  

Send.control.

And I run the file hidden

 

Share this post


Link to post
Share on other sites
Subz

Can you explain further?  This runs CMD with telnet command hidden, you can add other code after the command has been executed.

Share this post


Link to post
Share on other sites
minamon
Posted (edited)

here what i mean 

Run('cmd',"",@SW_HIDE)
Local $hWnd = WinWait("[CLASS:cmd]", "", 1)
ControlSend("C:\WINDOWS\SYSTEM32\cmd.exe","","","attrib {+}H {+}S   log.txt{ENTER}")

ControlSend("C:\WINDOWS\SYSTEM32\cmd.exe","","","telnet 192.168.1.1 -f 10.txt{ENTER}")

Sleep (2000)
ControlSend("Telnet 192.168.1.1","","","admin{ENTER}")
ControlSend("Telnet 192.168.1.1","","","rtwlan rtdisp{ENTER}")
Sleep (1350)
WinClose("Telnet 192.168.1.1")
Run('cmd',"",@SW_HIDE)
Local $hWnd = WinWait("[CLASS:cmd]", "", 1)
ControlSend("C:\WINDOWS\SYSTEM32\cmd.exe","","","cd folder{ENTER}")
ControlSend("C:\WINDOWS\SYSTEM32\cmd.exe","","","attrib {-}H {-}S 10.txt{ENTER}")

where can i add those in your code ...

i am new here ..  sorry for any mistake 

Edited by minamon

Share this post


Link to post
Share on other sites
Subz

Sorry having late dinner, bit confused, where are the Log.txt and 10.txt files suppose to be located?  If you can let me know that, I'll update the code as I'm a little confused as what the attribs are trying to achieve.

Share this post


Link to post
Share on other sites
PACaleala
7 hours ago, minamon said:

'telnet' is not recognized as an internal or external command...

This is an error message from Windows 10 trying to tell you that the (telnet) program cannot be loaded and run or it is not installed!

By default Windows 10 does not install the telnet client.

A quick check in the Win10 : Control Panels - Windows Features - "Turn windows features on or off" will prove it.

 

Share this post


Link to post
Share on other sites
Subz

@PACaleala  As the OP stated Telnet works if you run (compiled as 64 bit on a 64 bit system) but not when the script is compiled as 32 bit.  By using Wow64DisableWow64FsRedirection within 32 bit script you can run a 64 bit executable without having to compile as 64 bit.  For example if you have Telnet installed then use the following code without compiling as 64 bit you will get the error that Telnet is not recognized as an internal or external command.

Run(@ComSpec & " /k " & $sTelnetHost & " -f %Temp%\9.txt")

If you use the following code also without compiling as 64 bit you will be successful

DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 1) ;~ Turns Off 64 Bit Redirection
    Run(@ComSpec & " /k " & $sTelnetHost & " -f %Temp%\9.txt")
DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 0) ;~ Turns Off 64 Bit Redirection

Hope that makes sense.

  • Thanks 1

Share this post


Link to post
Share on other sites
minamon

thanks bro it did the work perfectly..

i just added your line 

DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 1)

to the start of my code and every thing  worked perfectly

Share this post


Link to post
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

×