|
Answer» Hey all, ive recently coded a batch script to use on my school's network...just decided to share it lol It works by editing/printing a chat log stored in a .dll file (sneaky haha) It also checks a pre-defined list of users and if the user is not pre-listed then it send a message saying "This is a test message" This is incase a teacher remotely runs the chat There are LOTS of other features i added like banning users, clearing the screen and many more...anyway, heres the script: echo off CLS COLOR f2 SET scount=0 SET oldmessage=origin123 SET user=%username% SET message= SET pat=C:\"Program Files"\"Common Files"\"Microsoft Shared"\OFFICE12 IF /I %user%==Josh SET cuser=Miltzi & GOTO :admin IF /I %user%==Jay SET cuser=PlayaJay & GOTO :admin IF /I %user%==miltzj SET cuser=Miltzi & GOTO :admin IF /I %user%==steinj SET cuser=Jarod & SET unum=11 & GOTO :first IF /I %user%==steinda SET cuser=Daniel & SET unum=22 & GOTO :first IF /I %user%==rubine SET cuser=Evan & SET unum=33 & GOTO :first IF /I %user%==sklairn SET cuser=Nathan & SET unum=44 & GOTO :first IF /I %user%==portnoyc SET cuser=Craig & SET unum=55 & GOTO :first IF /I %user%==polakowa SET cuser=Polly & SET unum=66 & GOTO :first IF /I %user%==selbya SET cuser=Alex & SET unum=77 & GOTO :first IF /I %user%==vanderwesthuizenl SET cuser=Lance & SET unum=88 & GOTO :first msg * This is a test message! exit REM echo HI >> C:\"Documents and Settings"\miltzj\desktop\1.dll REM type C:\"Documents and Settings"\miltzj\desktop\1.dll REM pause REM C:\Program Files\Common Files\Microsoft Shared\OFFICE12
:CHAT IF EXIST %pat%\%unum%.dll GOTO :BANNED SET pat=C:\"Program Files"\"Common Files"\"Microsoft Shared"\OFFICE12 TITLE Grade 11 IT chat IF EXIST %pat%\checkstats.dll GOTO :BUSY IF NOT EXIST %pat%\1.dll echo Chat cleared by admin. >> %pat%\1.dll CLS type %pat%\1.dll
SET message= SET /P message=Type message and PRESS enter (Type "help" to view options): IF ERRORLEVEL 1 GOTO :BACKTOCHAT IF /I "%message%"=="exit" GOTO :exit IF /I "%message%"=="help" GOTO :help IF /I "%message%"=="*censored*" SET message=f**k IF /I "%message%"=="big *censored*" GOTO :BAN IF /I "%message%"=="%oldmessage%" GOTO :SPAM SET oldmessage=%message% echo %user%: %message% >> %pat%\1.dll GOTO :CHAT :exit CLS echo %user% left the chat. >> %pat%\1.dll exit :help CLS echo Welcome to the help section echo To exit the chat, PLEASE type exit as a message into the chat rather than closing the cmd box manually. echo To refresh the chats messages, just press enter without writing any text. echo **NB** If you use any inverted COMMAS (") in the chat, make sure u dont only use one as the chat will crash! echo Please press enter to go back to the chat pause GOTO :CHAT :ACHAT SET pat=C:\"Program Files"\"Common Files"\"Microsoft Shared"\OFFICE12 TITLE Grade 11 IT chat IF NOT EXIST %pat%\1.dll echo Chat cleared by admin. >> %pat%\1.dll CLS type %pat%\1.dll SET message= SET /P message=Type message and press enter (Type "help" to view options): IF ERRORLEVEL 1 GOTO :BACKTOACHAT IF /I "%message%"=="exit" GOTO :exit IF /I "%message%"=="help" GOTO :help IF /I "%message%"=="cls" GOTO :CLS IF /I "%message%"=="amsg" GOTO :AMSG IF /I "%message%"=="disable chat" GOTO :disable IF /I "%message%"=="enable chat" GOTO :enable IF /I "%message%"=="ban user" GOTO :ABAN IF /I "%message%"=="unban user" GOTO :UNBAN echo %user%: %message% >> %pat%\1.dll GOTO :ACHAT :exit CLS echo %user% left the chat. >> %pat%\1.dll exit :help CLS echo Welcome to the admin help section echo - echo To exit the chat, please type exit as a message into the chat rather than closing the cmd box manually. echo - echo To refresh the chats messages, just press enter without writing any text. echo - echo To clear the screen, type "cls" echo - echo To send an admin message, type "amsg" echo - echo To disable the chat, type "disable chat" echo - echo To enable the chat, type "enable chat" echo - echo To ban a user, type "ban user" echo - echo To unban a user, type "unban user" echo - echo **NB** If you use any inverted commas (") in the chat, make sure u dont only use one as the chat will crash! echo - echo Please press enter to go back to the chat pause GOTO :ACHAT :CLS del %pat%\1.dll GOTO :ACHAT :admin echo %user% joined the chat. >> %pat%\1.dll GOTO :ACHAT :first echo %user% joined the chat. >> %pat%\1.dll GOTO :CHAT exit :BAN echo Auto-generated stub code >> %pat%\%unum%.dll exit :BACKTOCHAT GOTO :CHAT exit :BACKTOACHAT GOTO :ACHAT exit :AMSG CLS SET /P adminmessage=Please type your admin message and press enter: echo ** Message from admin: %adminmessage% ** >> %pat%\1.dll CLS GOTO :ACHAT exit :SPAM msg * Please dont spam! GOTO :CHAT exit :exit exit :BUSY msg * Chat temporarily disabled by admin! exit :disable echo This is a statistical reviewer created by Office >> %pat%\checkstats.dll msg * Chat disabled! GOTO :ACHAT :enable del %pat%\checkstats.dll /Q msg * Chat enabled! GOTO :ACHAT exit :ABAN CLS SET /P bname=Please type the exact username of the user you wish to ban: IF /I %bname%==steinj echo Auto-generated stub code >> %pat%\11.dll IF /I %bname%==steinda echo Auto-generated stub code >> %pat%\22.dll IF /I %bname%==rubine echo Auto-generated stub code >> %pat%\33.dll IF /I %bname%==sklairn echo Auto-generated stub code >> %pat%\44.dll IF /I %bname%==portnoyc echo Auto-generated stub code >> %pat%\55.dll IF /I %bname%==polakowa echo Auto-generated stub code >> %pat%\66.dll IF /I %bname%==selbya echo Auto-generated stub code >> %pat%\77.dll IF /I %bname%==vanderwesthuizenl echo Auto-generated stub code >> %pat%\88.dll CLS GOTO :ACHAT exit :UNBAN CLS SET /P uban=Please type the exact username of the user you wish to unban: IF /I %uban%==steinj del %pat%\11.dll /Q IF /I %uban%==steinda del %pat%\22.dll /Q IF /I %uban%==rubine del %pat%\33.dll /Q IF /I %uban%==sklairn del %pat%\44.dll /Q IF /I %uban%==portnoyc del %pat%\55.dll /Q IF /I %uban%==polakowa del %pat%\66.dll /Q IF /I %uban%==selbya del %pat%\77.dll /Q IF /I %uban%==vanderwesthuizenl del %pat%\88.dll /Q IF /I %uban%==all del %pat%\11.dll /Q IF /I %uban%==all del %pat%\22.dll /Q IF /I %uban%==all del %pat%\33.dll /Q IF /I %uban%==all del %pat%\44.dll /Q IF /I %uban%==all del %pat%\55.dll /Q IF /I %uban%==all del %pat%\66.dll /Q IF /I %uban%==all del %pat%\77.dll /Q IF /I %uban%==all del %pat%\88.dll /Q CLS GOTO :ACHAT :BANNED msg * You have been banned! exit
|