Advertisement
idxvr

EchoND

Jun 13th, 2024 (edited)
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 15.02 KB | Source Code | 0 0
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. set "log_file=ping_log.txt"
  4. set "temp_file=temp.txt"
  5. title Echo Network Diagnostics
  6. color 0C
  7.  
  8. echo Echo Network Diagnostics Tool v2.4
  9. echo.
  10. echo Continue to Menu
  11. pause
  12.  
  13. :main
  14.  
  15. :: Main menu
  16. :main
  17. cls
  18. echo.                                                                                                  
  19. ::: _______   ________  ___  ___  ________    
  20. :::|\  ___ \ |\   ____\|\  \|\  \|\   __  \    
  21. :::\ \   __/|\ \  \___|\ \  \\\  \ \  \|\  \  
  22. ::: \ \  \_|/_\ \  \    \ \   __  \ \  \\\  \  
  23. :::  \ \  \_|\ \ \  \____\ \  \ \  \ \  \\\  \
  24. :::   \ \_______\ \_______\ \__\ \__\ \_______\
  25. :::    \|_______|\|_______|\|__|\|__|\|_______|
  26. for /f "delims=: tokens=*" %%A in ('findstr /b ::: "%~f0"') do @echo(%%A
  27. echo.
  28. echo.
  29. color %textcolor%
  30. echo Welcome, %username%!
  31. echo.
  32. echo Current Time: %time:~0,2%:%time:~3,2%:%time:~6,2%
  33. echo.
  34. echo 1. Create a new file
  35. echo 2. Delete a file
  36. echo 3. List files
  37. echo 4. Rename a file
  38. echo 5. Copy a file
  39. echo 6. Move a file
  40. echo 7. Create a new directory
  41. echo 8. Delete a directory
  42. echo 9. List directories
  43. echo 10. Change directory
  44. echo 11. System information
  45. echo 12. Change text color
  46. echo 13. SMTP Mail Sender
  47. echo 14. Shutdown
  48. echo ------------------------------ NETWORK OPTIONS
  49. echo 15. Network devices
  50. echo 16. Spoof MAC (Windows Registry)
  51. echo 17. Display IP pings
  52. echo 18. Network Speed Diagnostic
  53. echo 19. Traceroute
  54. echo 20. Port Scanner
  55. echo.
  56. set /p choice=Choose an option:
  57.  
  58. :: Process user choice
  59. if %choice%==1 goto createfile
  60. if %choice%==2 goto deletefile
  61. if %choice%==3 goto listfiles
  62. if %choice%==4 goto renamefile
  63. if %choice%==5 goto copyfile
  64. if %choice%==6 goto movefile
  65. if %choice%==7 goto createdirectory
  66. if %choice%==8 goto deletedirectory
  67. if %choice%==9 goto listdirectories
  68. if %choice%==10 goto changedirectory
  69. if %choice%==11 goto systeminfo
  70. if %choice%==12 goto changetextcolor
  71. if %choice%==13 goto mailclient
  72. if %choice%==14 goto shutdown
  73. if %choice%==15 goto networkdevices
  74. if %choice%==16 goto spoofmac
  75. if %choice%==17 goto displayippings
  76. if %choice%==18 goto speed
  77. if %choice%==19 goto traceroute
  78. if %choice%==20 goto portscanner
  79. goto main
  80.  
  81. :createfile
  82. cls
  83. type echo.txt
  84. echo.
  85. echo.
  86. set /p filename=Enter a filename:
  87. echo. > %filename%.txt
  88. echo File created successfully!
  89. pause
  90. goto main
  91.  
  92. :deletefile
  93. cls
  94. type echo.txt
  95. echo.
  96. echo.
  97. set /p filename=Enter a filename:
  98. if exist %filename%.txt del %filename%.txt
  99. echo File deleted successfully!
  100. pause
  101. goto main
  102.  
  103. :listfiles
  104. cls
  105. type echo.txt
  106. echo.
  107. echo.
  108. dir /b *.txt
  109. pause
  110. goto main
  111.  
  112. :renamefile
  113. cls
  114. type echo.txt
  115. echo.
  116. echo.
  117. set /p oldfilename=Enter the old filename:
  118. set /p newfilename=Enter the new filename:
  119. if exist %oldfilename%.txt ren %oldfilename%.txt %newfilename%.txt
  120. echo File renamed successfully!
  121. pause
  122. goto main
  123.  
  124. :: Copy a file
  125. :copyfile
  126. cls
  127. type echo.txt
  128. echo.
  129. echo.
  130. set /p sourcefilename=Enter the source filename:
  131. set /p targetfilename=Enter the target filename:
  132. if exist %sourcefilename%.txt copy %sourcefilename%.txt %targetfilename%.txt
  133. echo File copied successfully!
  134. pause
  135. goto main
  136.  
  137. :movefile
  138. cls
  139. type echo.txt
  140. echo.
  141. echo.
  142. set /p sourcefilename=Enter the source filename:
  143. set /p targetfilename=Enter the target filename:
  144. if exist %sourcefilename%.txt move %sourcefilename%.txt %targetfilename%.txt
  145. echo File moved successfully!
  146. pause
  147. goto main
  148.  
  149. :createdirectory
  150. cls
  151. type echo.txt
  152. echo.
  153. echo.
  154. set /p directoryname=Enter a directory name:
  155. mkdir %directoryname%
  156. echo Directory created successfully!
  157. pause
  158. goto main
  159.  
  160. :deletedirectory
  161. cls
  162. type echo.txt
  163. echo.
  164. echo.
  165. set /p directoryname=Enter a directory name:
  166. rmdir /s /q %directoryname%
  167. echo Directory deleted successfully!
  168. pause
  169. goto main
  170.  
  171. :listdirectories
  172. cls
  173. type echo.txt
  174. echo.
  175. echo.
  176. dir /b /ad
  177. pause
  178. goto main
  179.  
  180. :changedirectory
  181. cls
  182. type echo.txt
  183. echo.
  184. echo.
  185. set /p directoryname=Enter a directory name:
  186. cd %directoryname%
  187. echo Directory changed successfully!
  188. pause
  189. goto main
  190.  
  191. :systeminfo
  192. cls
  193. type echo.txt
  194. echo.
  195. echo.
  196. echo System Information:
  197. echo.
  198. systeminfo | findstr /c:"Host Name"
  199. systeminfo | findstr /c:"Domain"
  200. systeminfo | findstr /c:"OS Name"
  201. systeminfo | findstr /c:"OS Version"
  202. systeminfo | findstr /c:"System Manufacturer"
  203. systeminfo | findstr /c:"System Model"
  204. systeminfo | findstr /c:"System type"
  205. systeminfo | findstr /c:"Total Physical Memory"
  206. ipconfig | findstr IPv4
  207. echo.
  208. echo Hard Drive Space:
  209. wmic diskdrive get size
  210. echo.
  211. echo Service Tag:
  212. wmic bios get serialnumber
  213. echo.
  214. echo CPU:
  215. wmic cpu get name
  216. echo GPU:
  217. wmic path win32_VideoController get name
  218. echo RAM:
  219. wmic memorychip get capacity
  220. echo HDD:
  221. wmic diskdrive get model
  222. pause
  223. goto main
  224.  
  225. :changetextcolor
  226. cls
  227. type echo.txt
  228. echo.
  229. echo.
  230. echo Choose a text color:
  231. echo 0 = Black
  232. echo 1 = Blue
  233. echo 2 = Green
  234. echo 3 = Cyan
  235. echo 4 = Red
  236. echo 5 = Magenta
  237. echo 6 = Brown
  238. echo 7 = White
  239. echo 8 = Gray
  240. echo 9 = Bright Blue
  241. echo A = Green
  242. echo B = Cyan
  243. echo C = Coral
  244. echo D = Magenta
  245. echo E = Pale Yellow
  246. echo F = Bright White
  247. set /p textcolorchoice=Enter a text color choice (0-F):
  248.  
  249. if %textcolorchoice%==0 set textcolor=0
  250. if %textcolorchoice%==1 set textcolor=1
  251. if %textcolorchoice%==2 set textcolor=2
  252. if %textcolorchoice%==3 set textcolor=3
  253. if %textcolorchoice%==4 set textcolor=4
  254. if %textcolorchoice%==5 set textcolor=5
  255. if %textcolorchoice%==6 set textcolor=6
  256. if %textcolorchoice%==7 set textcolor=7
  257. if %textcolorchoice%==8 set textcolor=8
  258. if %textcolorchoice%==9 set textcolor=9
  259. if /i %textcolorchoice%==A set textcolor=A
  260. if /i %textcolorchoice%==B set textcolor=B
  261. if /i %textcolorchoice%==C set textcolor=C
  262. if /i %textcolorchoice%==D set textcolor=D
  263. if /i %textcolorchoice%==E set textcolor=E
  264. if /i %textcolorchoice%==F set textcolor=F
  265.  
  266. color %textcolor%
  267. goto main
  268.  
  269. :networkdevices
  270. cls
  271. type echo.txt
  272. echo.
  273. echo.
  274. echo Network Devices:
  275. echo.
  276. arp -a
  277. echo.
  278. echo Available devices on the network:
  279. echo.
  280. for /f "tokens=2 delims=: " %%a in ('arp -a ^| findstr "dynamic" ^| findstr /v "Interface"') do (
  281.     ping -n 1 %%a | findstr "bytes" > nul
  282.     if %errorlevel%==0 (
  283.         echo %%a online
  284.     ) else (
  285.         echo %%a offline
  286.     )
  287. )
  288. echo.
  289. set /p devicename=Enter a device name or IP address:
  290. cls
  291. echo Device Specifications:
  292. echo.
  293. echo Device Name: %devicename%
  294. echo.
  295. echo Device Type:
  296. if %devicename%==%computername% echo This device
  297. if %devicename%==%computername% goto localdevice
  298. ping -n 1 %devicename% | findstr "bytes" > nul
  299. if %errorlevel%==0 (
  300.     echo Desktop
  301. ) else (
  302.     ping -n 1 %devicename% | findstr "bytes" > nul
  303.     if %errorlevel%==0 (
  304.         echo Laptop
  305.     ) else (
  306.         ping -n 1 %devicename% | findstr "bytes" > nul
  307.         if %errorlevel%==0 (
  308.             echo Phone
  309.         ) else (
  310.             echo Other
  311.         )
  312.     )
  313. )
  314. echo.
  315. ping -n 1 %devicename% | findstr "bytes" > nul
  316. if %errorlevel%==0 (
  317.     echo Status: Online - You have access to this device.
  318. ) else (
  319.     echo Status: Offline - You do not have access to this device.
  320. )
  321. echo.
  322. echo Operating System:
  323. wmic /node:%devicename% os get caption > nul 2>&1
  324. if %errorlevel%==0 (
  325.     echo OS:
  326.     wmic /node:%devicename% os get caption
  327. ) else (
  328.     echo Unable to retrieve OS information.
  329. )
  330. echo.
  331. echo CPU:
  332. wmic /node:%devicename% cpu get name > nul 2>&1
  333. if %errorlevel%==0 (
  334.     echo CPU:
  335.     wmic /node:%devicename% cpu get name
  336. ) else (
  337.     echo Unable to retrieve CPU information.
  338. )
  339. echo.
  340. echo RAM:
  341. wmic /node:%devicename% memorychip get capacity > nul 2>&1
  342. if %errorlevel%==0 (
  343.     echo RAM:
  344.     wmic /node:%devicename% memorychip get capacity
  345. ) else (
  346.     echo Unable to retrieve RAM information.
  347. )
  348. echo.
  349. echo HDD:
  350. wmic /node:%devicename% diskdrive get model > nul 2>&1
  351. if %errorlevel%==0 (
  352.     echo HDD:
  353.     wmic /node:%devicename% diskdrive get model
  354. ) else (
  355.     echo Unable to retrieve HDD information.
  356. )
  357. pause
  358. goto main
  359.  
  360. :spoofmac
  361. cls
  362. type echo.txt
  363. echo.
  364. echo.
  365. echo MAC Address Spoofer:
  366. echo.
  367. echo Current MAC Address:
  368. for /f "tokens=2 delims==" %%a in ('wmic nicconfig get macaddress /value') do (
  369.     set macaddress=%%a
  370. )
  371. echo %macaddress%
  372. echo.
  373. echo 1. Enter a new MAC address manually (Currently not working)
  374. echo 2. Generate a random MAC address
  375. set /p choice=Enter your choice:
  376. if %choice%==1 set /p newmacaddress=Enter a new MAC address (format: XX-XX-XX-XX-XX-XX):
  377. pause
  378. goto menu
  379. if %choice%==2 goto :randmac
  380.  
  381. :randmac
  382. set /a rand1=%random%%%256
  383. set /a rand2=%random%%%256
  384. set /a rand3=%random%%%256
  385. set /a rand4=%random%%%256
  386. set /a rand5=%random%%%256
  387. set /a rand6=%random%%%256
  388. set newmacaddress=00-%rand1:~-2%-%rand2:~-2%-%rand3:~-2%-%rand4:~-2%-%rand5:~-2%-%rand6:~-2%
  389. cls
  390. type echo.txt
  391. echo.
  392. echo.
  393. echo Changing MAC Address...
  394. wmic nicconfig where "index=1" call setmacaddress %newmacaddress%
  395. echo MAC Address changed to %newmacaddress%.
  396. pause
  397. goto main
  398.  
  399. :displayippings
  400. cls
  401. type echo.txt
  402. echo.
  403. echo.
  404. echo Displaying all server IPs that are pinging your machine...
  405. echo.
  406. echo Press Ctrl+C to stop
  407. echo.
  408.  
  409. :loop
  410. netstat -an | findstr ESTABLISHED | findstr /v "127.0.0.1" | findstr /v "::1" > temp.txt
  411. for /f "tokens=2 delims= " %%a in (temp.txt) do (
  412.     echo %%a
  413. )
  414. del temp.txt
  415. timeout /t 10 > nul
  416. if errorlevel 1 goto main
  417. goto loop
  418.  
  419. :speed
  420. cls
  421. type echo.txt
  422. echo.
  423. echo.
  424. echo Network Connection Speed
  425. echo.
  426. echo Please note that this method may not be accurate and is only an estimate.
  427. echo.
  428.  
  429. wmic nic get speed /value
  430.  
  431. echo.
  432. echo Measurements in Bits per Second.
  433. echo.
  434. echo Press any key to return to the main menu...
  435. pause > nul
  436. goto main
  437. :traceroute
  438. cls
  439. type echo.txt
  440. echo.
  441. echo.
  442. echo Traceroute
  443. echo.
  444. echo Enter the hostname or IP address to trace:
  445. set /p target=
  446.  
  447. tracert %target%
  448.  
  449. echo.
  450. echo Press any key to return to the main menu...
  451. pause > nul
  452. goto main
  453.  
  454. :portscanner
  455. cls
  456. type echo.txt
  457. echo.
  458. echo.
  459. echo Port Scanner:
  460. echo.
  461. set /p target=Enter the target IP address or hostname:
  462.  
  463. echo %target% | findstr "[a-zA-Z]" > nul
  464. if %errorlevel% equ 0 (
  465.     echo Error: Invalid IP address.
  466.     echo Please enter a valid IP address or hostname without letters.
  467.     pause
  468.     goto main
  469. )
  470.  
  471. set /p startport=Enter the starting port number:
  472. set /p endport=Enter the ending port number:
  473.  
  474. telnet > nul
  475. if %errorlevel%==9009 (
  476.     echo Error: Telnet client is not enabled.
  477.     echo Please enable Telnet client in Windows Features.
  478.     echo.
  479.     echo Opening "Turn Windows features on or off"...
  480.     start optionalfeatures
  481.     echo Please enable Telnet Client and then run this script again.
  482.     pause
  483.     goto main
  484. )
  485.  
  486. set temp_file=%temp%\telnet_tmp.txt
  487. for /l %%p in (%startport%,1,%endport%) do (
  488.     echo Scanning port %%p...
  489.     (echo quit >> %temp_file%) & (telnet /a %%p %target% < %temp_file% > nul)
  490.     if %errorlevel%==0 (
  491.         echo Port %%p is open
  492.     ) else (
  493.         echo Port %%p is closed
  494.     )
  495.     del %temp_file%
  496. )
  497. pause
  498. goto main
  499.  
  500. where blat > nul 2>&1
  501. if %errorlevel% neq 0 (
  502.     echo Error: Blat is not installed.
  503.     echo Please download and install blat from https://www.blat.net/
  504.     pause
  505.     goto menu
  506. )
  507.  
  508. :: Set SMTP server settings
  509. set "smtp_server=smtp.gmail.com"
  510. set "smtp_port=587"
  511.  
  512.  
  513. if exist email_settings.txt (
  514.    :: Load email settings from file
  515.     for /f "tokens=1,2 delims==" %%a in (email_settings.txt) do (
  516.         if "%%a"=="from_email" set "from_email=%%b"
  517.         if "%%a"=="password" set "password=%%b"
  518.     )
  519. ) else (
  520.  
  521.     set /p from_email=Enter your email address:
  522.     set /p password=Enter your email password:
  523.     echo from_email=%from_email% > email_settings.txt
  524.     echo password=%password% >> email_settings.txt
  525. )
  526.  
  527. :mailclient
  528. cls
  529. type echo.txt
  530. echo.
  531. echo.
  532. :: Check if stunnel is installed
  533. where stunnel > nul 2>&1
  534. if %errorlevel% neq 0 (
  535.     echo Error: Stunnel is not installed.
  536.     echo Please download and install stunnel from https://www.stunnel.org/downloads.html
  537.     pause
  538.     exit /b 1
  539. )
  540.  
  541. :: Check if blat is installed
  542. where blat > nul 2>&1
  543. if %errorlevel% neq 0 (
  544.     echo Error: Blat is not installed.
  545.     echo Please download and install blat from https://www.blat.net/
  546.     pause
  547.     exit /b 1
  548. )
  549.  
  550. :: Set SMTP server settings
  551. set "smtp_server=smtp.gmail.com"
  552. set "smtp_port=587"
  553.  
  554. :: Create stunnel.conf file
  555. echo [smtp-tls] > stunnel.conf
  556. echo client = yes >> stunnel.conf
  557. echo accept = 127.0.0.1:7825 >> stunnel.conf
  558. echo connect = %smtp_server%:%smtp_port% >> stunnel.conf
  559.  
  560. :: Check if email settings are stored
  561. if exist email_settings.txt (
  562.    :: Load email settings from file
  563.     for /f "tokens=1,2 delims==" %%a in (email_settings.txt) do (
  564.         if "%%a"=="from_email" set "from_email=%%b"
  565.         if "%%a"=="password" set "password=%%b"
  566.     )
  567. ) else (
  568.    :: Prompt user for email settings
  569.     set /p from_email=Enter your email address:
  570.     set /p password=Enter your email password:
  571.    :: Store email settings to file
  572.     echo from_email=%from_email% > email_settings.txt
  573.     echo password=%password% >> email_settings.txt
  574. )
  575.  
  576. :menu
  577. :: Ask user if they want to send a single email or a mass email
  578. echo Choose an option:
  579. echo 1. Send a single email
  580. echo 2. Send a mass email
  581. echo 3. Exit
  582. set /p choice=Enter your choice (1/2/3):
  583.  
  584. if %choice% equ 1 (
  585.    :: Send a single email
  586.     set /p to_email=Enter the recipient's email address:
  587.     set /p subject=Enter the email subject:
  588.     set /p body=Enter the email body:
  589.     echo Sending email...
  590.    :: Start stunnel to encrypt the email
  591.     start /wait /b stunnel -config stunnel.conf
  592.     blat -server 127.0.0.1 -port 7825 -u %from_email% -pw %password% -f %from_email% -t %to_email% -s %subject% -body %body% > nul 2>&1
  593.     if %errorlevel% neq 0 (
  594.         echo Error: Failed to send email.
  595.         echo Please check your email settings and try again.
  596.         pause
  597.     ) else (
  598.         echo Email sent successfully!
  599.         pause
  600.     )
  601.    :: Stop stunnel
  602.     taskkill /im stunnel.exe /f
  603.     goto menu
  604. ) else if %choice% equ 2 (
  605.    :: Send a mass email
  606.     set /p to_email=Enter the recipient's email address:
  607.     set /p num_emails=Enter the number of emails to send:
  608.  
  609.     for /l %%i in (1,1,%num_emails%) do (
  610.         set "subject=Mass Email %%i of %num_emails%"
  611.         set "body=This is a mass email sent using a the Echo Network Diagnostic Tool."
  612.         echo Sending email %%i of %num_emails%...
  613.        :: Start stunnel to encrypt the email
  614.         start /wait /b stunnel -config stunnel.conf
  615.         blat -server 127.0.0.1 -port 7825 -u %from_email% -pw %password% -f %from_email% -t %to_email% -s "!subject!" -body "!body!" > nul 2>&1
  616.         if!errorlevel! neq 0 (
  617.             echo Error: Failed to send email %%i.
  618.         ) else (
  619.             echo Email %%i sent successfully!
  620.         )
  621.        :: Stop stunnel
  622.         taskkill /im stunnel.exe /f
  623.     )
  624.     pause
  625.     goto menu
  626. ) else if %choice% equ 3 (
  627.     exit /b 0
  628. ) else (
  629.     echo Invalid choice. Please try again.
  630.     pause
  631.     goto menu
  632. )
  633.  
  634. :shutdown
  635. cls
  636. type echo.txt
  637. echo.
  638. echo.
  639. echo Shutting down...
  640. pause
  641. exit
Tags: batch
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement