Difference between revisions of "Big-brother-is-watching"

From 24PinTech Wiki
Jump to navigation Jump to search
(Created page with "Mr.Chamberlain can remote into the CTE computers in the lab now, so I (Jeremiah) wrote a series of scripts that send a server message when he remotes in. They can be modified...")
 
Line 1: Line 1:
Mr.Chamberlain can remote into the CTE computers in the lab now, so I (Jeremiah) wrote a series of scripts that send a server message when he remotes in. They can be modified to close a game, or pretty much whatever upon an established connection. They probably work, I think.
Mr.Chamberlain can remote into the CTE computers in the lab now, so I (Jeremiah) wrote a series of scripts that send a server message when he remotes in. They can be modified to close a game, or pretty much whatever upon an established connection. They probably work, I think.


== Contents of the files ==
==Contents of the files==
funny.bat-
funny.bat-


''@ECHO-OFF''
@ECHO-OFF


''netstat |find "MHS118TW_MACPRO" |find "ESTABLISHED" > output.txt''
netstat |find "MHS118TW_MACPRO" |find "ESTABLISHED" > output.txt  


''set /p connection_status= < output.txt''
set /p connection_status= < output.txt  


''del output.txt''
del output.txt


''IF "%connection_status" == "" call no_connection.bat && EXIT /B''
IF "%connection_status" == "" ( call no_connection.bat && EXIT /b


''msg /server:127.0.0.1 <insert your student ID> "Eyes up, idiot!"''
) Else msg /server:127.0.0.1 34017912 "Eyes up, idiot!" && EXIT /b
 
''EXIT /B''


no_connection.bat-
no_connection.bat-
Line 24: Line 22:
''EXIT /B''
''EXIT /B''


== How they work ==
==How they work==
Upon running funny.bat, it runs a netstat and checks for an established connection from Chamberlains computer, and sends the output to a text file. The contents of the file are then set as variable %connection_status and it checks if the variable is empty. If it's empty, it will call the no_connection.bat script which just restarts funny.bat and kills the original itteration of funny.bat, thus not allowing the script to progress to the final two lines. If the variable is not empty, the second to last line will send a server message to the loopback address and the final line will close the script. The second to last line can be modified to kill a process by changing th command that is run. "Taskkill /F /IM chrome.exe /T" for example would kill chrome upon and active connection.
Upon running funny.bat, it runs a netstat and checks for an established connection from Chamberlains computer, and sends the output to a text file. The contents of the file are then set as variable %connection_status and it checks if the variable is empty. If it's empty, it will call the no_connection.bat script which just restarts funny.bat and kills the original itteration of funny.bat, thus not allowing the script to progress to the final line. If the variable is not empty, the last line will send a server message to the loopback address and the final line will close the script. The last line can be modified to kill a process by changing th command that is run. "Taskkill /F /IM chrome.exe /T" for example would kill chrome upon and active connection.


== Netstat ==
==Netstat==
Netstat explanation because Mr. Chamberlain said so: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/netstat
Netstat explanation because Mr. Chamberlain said so: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/netstat

Revision as of 15:31, 13 May 2021

Mr.Chamberlain can remote into the CTE computers in the lab now, so I (Jeremiah) wrote a series of scripts that send a server message when he remotes in. They can be modified to close a game, or pretty much whatever upon an established connection. They probably work, I think.

Contents of the files

funny.bat-

@ECHO-OFF

netstat |find "MHS118TW_MACPRO" |find "ESTABLISHED" > output.txt

set /p connection_status= < output.txt

del output.txt

IF "%connection_status" == "" ( call no_connection.bat && EXIT /b

) Else msg /server:127.0.0.1 34017912 "Eyes up, idiot!" && EXIT /b

no_connection.bat-

call funny.bat

EXIT /B

How they work

Upon running funny.bat, it runs a netstat and checks for an established connection from Chamberlains computer, and sends the output to a text file. The contents of the file are then set as variable %connection_status and it checks if the variable is empty. If it's empty, it will call the no_connection.bat script which just restarts funny.bat and kills the original itteration of funny.bat, thus not allowing the script to progress to the final line. If the variable is not empty, the last line will send a server message to the loopback address and the final line will close the script. The last line can be modified to kill a process by changing th command that is run. "Taskkill /F /IM chrome.exe /T" for example would kill chrome upon and active connection.

Netstat

Netstat explanation because Mr. Chamberlain said so: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/netstat