mencargo Posted October 30, 2008 Share Posted October 30, 2008 Hi there, I'm searching for a way to detect if the host OS is 64bit or 32bit. Is there any enviroment varable for this? (Available from ms-dos) Or any way to detect it with a vbs script? I was thinking something like: ver|find /c "X.X." or echo %programfiles%|find /c "(x86)" And, just curiosity, why do some usb payloads use "%windir%\system32\find.exe"? Isn't find available as default everywhere? Quote Link to comment Share on other sites More sharing options...
DMilton Posted October 30, 2008 Share Posted October 30, 2008 Hi there, I'm searching for a way to detect if the host OS is 64bit or 32bit. Is there any enviroment varable for this? (Available from ms-dos) Or any way to detect it with a vbs script? I was thinking something like: ver|find /c "X.X." or echo %programfiles%|find /c "(x86)" And, just curiosity, why do some usb payloads use "%windir%\system32\find.exe"? Isn't find available as default everywhere? Try this. It was implemented into Leapo's Pocket Knife and it works. ;) Quote Link to comment Share on other sites More sharing options...
mencargo Posted October 30, 2008 Author Share Posted October 30, 2008 Well, I'm developing my own payload because pocket knife doesn't work like it should, I was discussing it inside that thread. The OS recognition fails if the Windows is not English, that's why I was thinking about finding "(x86)" at the program files path, although I'm not sure if it's universally named with (x86) at any language. Quote Link to comment Share on other sites More sharing options...
DMilton Posted November 5, 2008 Share Posted November 5, 2008 Well, I'm developing my own payload because pocket knife doesn't work like it should, I was discussing it inside that thread. The OS recognition fails if the Windows is not English, that's why I was thinking about finding "(x86)" at the program files path, although I'm not sure if it's universally named with (x86) at any language. Sorry, I posted you to the incorrect link... For any language system, you can do this For all languages OS detection, If you modify: ver|find "[Version 5.00." if errorlevel 1 goto SetOSwin2k ver|find "[Version 5.1." if errorlevel 1 goto SetOSXP32 ver|find "[Version 5.2." if errorlevel 1 goto SetOSXP64 ver|find "[Version 6.0." if errorlevel 1 goto SetOSVISTA32 ver|find "[Version 6.???" if errorlevel 1 goto SetOSVISTA64 :SetOSDefault goto SetOSXP32 :SetOSwin2k SET CurrentOS=win2k GOTO EndDetect :SetOSXP32 SET CurrentOS=XP32 GOTO EndDetect :SetOSXP64 SET CurrentOS=XP64 GOTO EndDetect :SetOSVISTA32 SET CurrentOS=VISTA32 GOTO EndDetect :SetOSVISTA64 SET CurrentOS=VISTA64 GOTO EndDetect :EndDetect The code will not work for spanish systems (or other I supose), because the ver command shows lines as "VersiĆ³n 5.00....". You can modify the code with: ver|find "5.00." if errorlevel 1 goto SetOSwin2k ver|find "5.1." if errorlevel 1 goto SetOSXP32 ver|find "5.2." if errorlevel 1 goto SetOSXP64 ver|find "6.0." if errorlevel 1 goto SetOSVISTA32 ver|find "6.???" if errorlevel 1 goto SetOSVISTA64 :SetOSDefault goto SetOSXP32 :SetOSwin2k SET CurrentOS=win2k GOTO EndDetect :SetOSXP32 SET CurrentOS=XP32 GOTO EndDetect :SetOSXP64 SET CurrentOS=XP64 GOTO EndDetect :SetOSVISTA32 SET CurrentOS=VISTA32 GOTO EndDetect :SetOSVISTA64 SET CurrentOS=VISTA64 GOTO EndDetect :EndDetect It will work for all languages OS's. ;) posted Here! Quote Link to comment Share on other sites More sharing options...
moonlit Posted November 17, 2008 Share Posted November 17, 2008 Fail. Server 2003 identifies as 5.2, regardless of whether it's 32 or 64bit. This is due to the fact that XP64 is essentially a client version of Server 2003. Quote Link to comment Share on other sites More sharing options...
DMilton Posted November 19, 2008 Share Posted November 19, 2008 Fail. Server 2003 identifies as 5.2, regardless of whether it's 32 or 64bit. This is due to the fact that XP64 is essentially a client version of Server 2003. That's occurs when one can't try it in Server 2003... Ok, another thing to think about! <_< I'll be squishing my little brain to find a solution (in batch) for helping in the payload development. Thanks a lot for your memo moonlit. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.