Author Topic: Boredom.  (Read 359 times)

Offline Sebastian

  • Regular Member
  • **
  • Posts: 115
  • Karma: +0/-6
    • View Profile
Boredom.
« on: December 31, 2009, 06:59:15 PM »
Code: [Select]
@echo off
rem Variables
set
echo.
echo Randlan #11
echo.
echo Coded by Sebastian
echo.
pause
cls
echo.
echo Randlan #11
echo.
echo Coded by Sebastian
echo.
set /p mapnetworkdrives=Would you like to map a network drive to the path to DC++? (Y/N)
if mapnetworkdrives==Y set /p dcplusplusdrive=What drive letter would you like to map DC++ to? (A-Z) Please remove the collon and bracket:
set /p

if mapnetworkdrives==Y net delete %dcplusplusdrive%
if mapnetworkdrives==Y net use %dcplusplusdrive% \\randlan\PATHTODC++

I did this in a minute or so. I'm bored. Continue? I was going to do it in perl or ruby but I would have to compile it and people wouldn't believe it wasn't infected blah blah blah. And if you don't understand MS-DOS/Batch. It basically asks hey guys want to do some LAN shit? It could also check for network connectivity using the following shit I digged up in by code folder:

Code: [Select]
@echo off
ECHO Checking connection, please wait...
PING -n 1 www.google.com|find "Reply from " >NUL
IF NOT ERRORLEVEL 1 goto :SUCCESS
IF     ERRORLEVEL 1 goto :TRYAGAIN

:TRYAGAIN
ECHO FAILURE!
ECHO Let me try a bit more, please wait...
@echo off
PING -n 3 www.google.com|find "Reply from " >NUL
IF NOT ERRORLEVEL 1 goto :SUCCESS2
IF     ERRORLEVEL 1 goto :TRYIP

:TRYIP
ECHO FAILURE!
ECHO Checking DNS...
ECHO Lets try by IP address...
@echo off
ping -n 1 216.239.37.99|find "Reply from " >NUL
IF NOT ERRORLEVEL 1 goto :SUCCESSDNS
IF     ERRORLEVEL 1 goto :TRYROUTER

:TRYROUTER
ECHO FAILURE!
ECHO Lets try pinging the router....
ping -n 2 192.168.1.1|find "Reply from " >NUL
IF NOT ERRORLEVEL 1 goto :ROUTERSUCCESS
IF     ERRORLEVEL 1 goto :NETDOWN

:ROUTERSUCCESS
ECHO It appears that you can reach the router, but internet is unreachable.
goto :FAILURE

:NETDOWN
ECHO FAILURE!
ECHO It appears that you having network issues, the router cannot be reached.
goto :FAILURE

:SUCCESSDNS
ECHO It appears that you are having DNS issues.
goto :FAILURE

:SUCCESS
ECHO You have an active Internet connection
pause
goto END

:SUCCESS2
ECHO You have an active internet connection but some packet loss was detected.
pause
goto :END

:FAILURE
ECHO You do not have an active Internet connection
pause
goto :END

:END
exit

I could just use the Find and Replace thing to change the IP and hostname/URL to the IP of the \\randlan server to check to see if you connected and then if your not it'll do a ipconfig /flush then /renew and then just disable network adapters and re-enable and shit like that.

Comments? Continue?

Offline Luke

  • Admin
  • Been Here too Long
  • *****
  • Posts: 991
  • Karma: +4/-1
    • View Profile
    • http://randlan.net
Re: Boredom.
« Reply #1 on: December 31, 2009, 08:06:05 PM »
I could just use the Find and Replace thing to change the IP and hostname/URL to the IP of the \\randlan server to check to see if you connected and then if your not it'll do a ipconfig /flush then /renew and then just disable network adapters and re-enable and shit like that.


Well a DNS check could be useful because there is always someone that can't connect to the DC++ hub because the DNS is not working

If you want here are the details of the main LAN server
DNS Hostname:randlan.lan
IP: 192.168.10.1
(I can't even remember what the netbios name for this one is I only ever connect to it with DNS or IP)

The old games server that is the only server that is a physical box (not a vmware machine)
DNS Hostname:games.lan
IP: 192.168.10.254(will need to check this one)
NETBIOS Hostname: randlan2



RandLAN Admin
Intel Core i7 @ 3.8
12Gb of ram
Many Hard drives
2 x 24" Samsung
2 x ATI 5870 1GB
Tell Everyone about RandLAN who likes Gaming NOW!!!!


Offline Sebastian

  • Regular Member
  • **
  • Posts: 115
  • Karma: +0/-6
    • View Profile
Re: Boredom.
« Reply #2 on: December 31, 2009, 08:07:35 PM »
I could just use the Find and Replace thing to change the IP and hostname/URL to the IP of the \\randlan server to check to see if you connected and then if your not it'll do a ipconfig /flush then /renew and then just disable network adapters and re-enable and shit like that.


Well a DNS check could be useful because there is always someone that can't connect to the DC++ hub because the DNS is not working

If you want here are the details of the main LAN server
DNS Hostname:randlan.lan
IP: 192.168.10.1
(I can't even remember what the netbios name for this one is I only ever connect to it with DNS or IP)

The old games server that is the only server that is a physical box (not a vmware machine)
DNS Hostname:games.lan
IP: 192.168.10.254(will need to check this one)
NETBIOS Hostname: randlan2


I'll have an extended version in the next 10-15 minutes. I just wanted the go ahead/permission from you.

Offline Sebastian

  • Regular Member
  • **
  • Posts: 115
  • Karma: +0/-6
    • View Profile
Re: Boredom.
« Reply #3 on: December 31, 2009, 08:44:03 PM »
Code: [Select]
@echo off
ECHO.
ECHO Network Tests.
ECHO.
ECHO ===============
ECHO RANDLan #11
ECHO Checking connection, please wait...
PING -n 1 randlan|find "Reply from " >NUL
IF NOT ERRORLEVEL 1 goto :SUCCESS
IF     ERRORLEVEL 1 goto :TRYAGAIN

:TRYAGAIN
ECHO FAILURE!
ECHO Attempt...
@echo off
PING -n 3 randlan|find "Reply from " >NUL
IF NOT ERRORLEVEL 1 goto :SUCCESS2
IF     ERRORLEVEL 1 goto :TRYIP

:TRYIP
ECHO FAILURE!
ECHO Checking DNS...
ECHO Lets try by IP address...
@echo off
ping -n 1 192.168.10.1|find "Reply from " >NUL
IF NOT ERRORLEVEL 1 goto :SUCCESSDNS
IF     ERRORLEVEL 1 goto :FAILURE

:SUCCESSDNS
ECHO It appears that you are having DNS issues.
goto :FAILURE

:SUCCESS
ECHO You have an active connection
pause
goto END

:SUCCESS2
ECHO You have an active connection but some packet loss was detected. Press any key to go to network resolution. Otherwise please exit.
pause
goto :TESTING

:FAILURE
ECHO You do not have an active connection press any key to proceed with automatic resolution.
pause
goto :TESTING

:TESTING
ECHO Flushing DNS...
ipconfig /flushdns >nul
ECHO Reseting TCP/IP...
netsh int ip reset >nul
ECHO Releasing IP...
ipconfig /release >nul
ECHO Renewing IP...
ipconfig /renew >nul
ECHO Reattempting Tests...
ECHO Checking Connection...
PING -n 1 randlan|find "Reply from " >NUL
IF NOT ERRORLEVEL 1 set testsuccessq2=Y
IF     ERRORLEVEL 1 set testsuccessq2=FAILCONNECT
ECHO Checking DNS...
ping -n 1 192.168.10.1|find "Reply from " >NUL
IF NOT ERRORLEVEL 1 set testsuccessq=Y
IF     ERRORLEVEL 1 set testsuccessq=FAILDNS
IF testsuccessq2==y goto firsttestsucc
IF testsuccessq2==FAILCONNECT goto firsttestfail

:firsttestsucc
if testsuccessq==Y goto bothtestsucc
if testsuccessq==FAILDNS
echo

:bothtestsucc
ECHO Your issue has been resolved! You now have an active connection... Press any key to exit.
PAUSE
EXIT

:firsttestfail
if testsuccessq==FAILDNS goto bothtestsfail
echo You have a


:bothtestfail
ECHO All attempts to resolve the issue have failed... Press any key to exit
PAUSE
EXIT



:TESTINGFAILED
ECHO Testing failed. All attempts to reconfigure your network issues have failed. Press any key to exit.
PAUSE
EXIT

:TESTINGSUCCES
ECHO Your issue is now resolved and you have an active connection... Press any key to exit.
pause
EXIT

I'm a bit stressed and tense at the moment can't think straight. This is what I've got so far.

Offline Sebastian

  • Regular Member
  • **
  • Posts: 115
  • Karma: +0/-6
    • View Profile
Re: Boredom.
« Reply #4 on: December 31, 2009, 09:02:27 PM »
Scratch that. Done.

Code: [Select]
@echo off
:START
cls
ECHO.
ECHO Network Test
ECHO.
ECHO ===============
ECHO RandLan #11
ECHO.
set /p consoleornot=Press enter to continue...
cls
IF %consoleornot%==CONSOLE goto CONSOLE
IF %consoleornot%==console goto CONSOLE
IF %consoleornot%==Console goto CONSOLE

ECHO.
ECHO Network Test
ECHO.
ECHO ===============
ECHO RandLan #11
ECHO.
ECHO Checking connection, please wait...
PING -n 1 randlan|find "Reply from " >NUL
IF NOT ERRORLEVEL 1 goto :SUCCESS
IF     ERRORLEVEL 1 goto :TRYAGAIN

:TRYAGAIN
ECHO FAILURE!
ECHO Attempt...
@echo off
PING -n 3 randlan|find "Reply from " >NUL
IF NOT ERRORLEVEL 1 goto :SUCCESS2
IF     ERRORLEVEL 1 goto :TRYIP

:TRYIP
ECHO FAILURE!
ECHO Checking DNS...
ECHO Lets try by IP address...
@echo off
ping -n 1 192.168.10.1|find "Reply from " >NUL
IF NOT ERRORLEVEL 1 goto :SUCCESSDNS
IF     ERRORLEVEL 1 goto :FAILURE

:SUCCESSDNS
ECHO It appears that you are having DNS issues.
goto :FAILURE

:SUCCESS
ECHO You have an active connection
pause
goto END

:SUCCESS2
ECHO You have an active connection but some packet loss was detected. Press any key to go to network resolution. Otherwise please exit.
pause
goto :TESTING

:FAILURE
ECHO You do not have an active connection press any key to proceed with automatic resolution.
pause
goto :TESTING

:TESTING
ECHO Flushing DNS...
ipconfig /flushdns >nul
ECHO Reseting TCP/IP...
netsh int ip reset >nul
ECHO Releasing IP...
ipconfig /release >nul
ECHO Renewing IP...
ipconfig /renew >nul
ECHO Reattempting Tests...
ECHO Checking Connection...
ECHO Going to the start of the program to conduct the tests...
pause
goto :START

exit
:CONSOLE
title Console$ %command% %username%
set /p command=Console$
%command%
goto :CONSOLE