Answer the question
In order to leave comments, you need to log in
Can cmd send the result of a command to the internet?
We have a service that needs to receive the output of the traceroute command from the user, or tracert in Windows, for some analysis. tracert must be executed from the user to us. In this case, the user needs to perform as few actions as possible. Telling how to run cmd, then tracert and then copy the results is not our way.
There was such a thought. Make a bash batch script. The user runs a script that opens cmd.exe and runs the tracert command, after which its results are sent to a special URL. On bash Is it possible to do this in a batch script?
I'll ask again, just in case. There is no way to make a tracert from the user to us directly in the browser? There is something like this and I don't know.
Answer the question
In order to leave comments, you need to log in
If we are talking about Windows, then not "bash" but "batch".
Here is a script that will do everything. You don't need to run cmd.exe to run it - you just need to save it somewhere and run it from Explorer. On your side, you will need an ftp server. Keep in mind that ftp.exe does not support passive mode. No additional software is required - ftp.exe is included with Windows. With different personal firewalls, etc., if the user has them, you will have to fight anyway. So consider using TeamViewer for remote access anyway.
@echo off
rem Переходим во временный каталог Windows
cd %temp%
rem Запускаем трассировку (адрес сайта - поменять) и сохраняем в файл trace.dat (можно назвать уникальным именем, чтобы потом отличить от других пользователей)
tracert SiteToTrace.com > trace.dat
rem начинаем формировать файл команд для работы с FTP, см. синтаксис тут http://ss64.com/nt/ftp.html
echo open ftp.SiteToUploadTo.com >commands.ftp
echo FTPUserName >>commands.ftp
echo FTPPassword >>commands.ftp
echo cd FTPFolderToUpload/ >>commands.ftp
echo binary >>commands.ftp
echo put trace.dat >>commands.ftp
echo disconnect >>commands.ftp
echo quit >>commands.ftp
rem Вызываем ftp.exe, передаем созданный список команд
ftp -i -s:commands.ftp
rem Подчищаем за собой
del /Q commands.ftp
del /Q trace.dat
the question arises - where will the user take this script?
running from bash cmd.exe - what a mess in your head. For Windows, write the script as a cmd-file, it will run itself in the cmd.exe shell. For Linux - on the tower. in both cases, it would be better to transfer it with some kind of ftp - fortunately, it is in the database for both systems. Mail what is there, what is there by default is not configured.
> There is no way to make a tracert from the user to us directly in the browser? You can use the www.codefromthe70s.org/traceroute_explained.aspx
java applet to
send a POST request to your server through it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question